Skip to content

Commit cdb0cea

Browse files
author
Adrian Clay
authored
Build ActiveMQ from image to avoid rate limiting on archive.apache.org (#1062)
1 parent c906999 commit cdb0cea

File tree

3 files changed

+128
-364
lines changed

3 files changed

+128
-364
lines changed

docker/activemq/Dockerfile

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,3 @@
1-
FROM eclipse-temurin:21-jdk-alpine
2-
3-
ENV ACTIVEMQ_VERSION 5.16.3
4-
ENV ACTIVEMQ apache-activemq-$ACTIVEMQ_VERSION
5-
ENV ACTIVEMQ_AMQP=5672 ACTIVEMQ_UI=8161
6-
ENV SHA512_VAL=3394afe9963f55cf62dafb287bdc58cac1fb76a614cc87939bec7b7909972eb5b3069022a9eb324242a315899b1096335c0531af75152c74eb309c0c5981b217
7-
8-
ENV ACTIVEMQ_HOME /opt/activemq
9-
10-
RUN set -x && \
11-
mkdir -p /opt && \
12-
apk --update add --virtual build-dependencies curl
13-
14-
# Uncomment the next line to use a local binary
15-
#COPY ./$ACTIVEMQ-bin.tar.gz $ACTIVEMQ-bin.tar.gz
16-
# Comment out the next line to use a local binary
17-
RUN curl https://archive.apache.org/dist/activemq/$ACTIVEMQ_VERSION/$ACTIVEMQ-bin.tar.gz -o $ACTIVEMQ-bin.tar.gz
18-
19-
# Validate checksum
20-
RUN if [ "$SHA512_VAL" != "$(sha512sum $ACTIVEMQ-bin.tar.gz | awk '{print($1)}')" ];\
21-
then \
22-
echo "sha512 values doesn't match! exiting." && \
23-
exit 1; \
24-
fi;
25-
26-
27-
RUN tar xzf $ACTIVEMQ-bin.tar.gz -C /opt && \
28-
ln -s /opt/$ACTIVEMQ $ACTIVEMQ_HOME && \
29-
addgroup -S activemq && adduser -S -H -G activemq -h $ACTIVEMQ_HOME activemq && \
30-
chown -R activemq:activemq /opt/$ACTIVEMQ && \
31-
chown -h activemq:activemq $ACTIVEMQ_HOME && \
32-
apk del build-dependencies && \
33-
rm -rf /var/cache/apk/*
34-
35-
USER activemq
36-
37-
COPY --chown=activemq:activemq ./activemq.xml $ACTIVEMQ_HOME/conf/activemq.xml
38-
COPY --chown=activemq:activemq ./jetty.xml $ACTIVEMQ_HOME/conf/jetty.xml
39-
40-
WORKDIR $ACTIVEMQ_HOME
41-
EXPOSE $ACTIVEMQ_AMQP $ACTIVEMQ_UI
42-
43-
CMD ["/bin/sh", "-c", "bin/activemq console"]
1+
ARG ACTIVEMQ_VERSION=6.1.4
2+
FROM apache/activemq-classic:${ACTIVEMQ_VERSION}
3+
COPY ./activemq.xml /opt/apache-activemq/conf

docker/activemq/activemq.xml

Lines changed: 125 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -16,136 +16,131 @@
1616
-->
1717
<!-- START SNIPPET: example -->
1818
<beans
19-
xmlns="http://www.springframework.org/schema/beans"
20-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
19+
xmlns="http://www.springframework.org/schema/beans"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
2222
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
23-
<!-- Allows us to use system properties as variables in this configuration file -->
24-
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
25-
<property name="locations">
26-
<value>file:${activemq.conf}/credentials.properties</value>
27-
</property>
28-
</bean>
29-
30-
<!-- Allows accessing the server log -->
31-
<bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
32-
lazy-init="false" scope="singleton"
33-
init-method="start" destroy-method="stop">
34-
</bean>
35-
36-
<!--
37-
The <broker> element is used to configure the ActiveMQ broker.
38-
-->
39-
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}"
40-
schedulerSupport="true">
41-
42-
<destinationPolicy>
43-
<policyMap>
44-
<policyEntries>
45-
<policyEntry topic=">">
46-
<!-- The constantPendingMessageLimitStrategy is used to prevent
47-
slow topic consumers to block producers and affect other consumers
48-
by limiting the number of messages that are retained
49-
For more information, see:
50-
51-
http://activemq.apache.org/slow-consumer-handling.html
52-
53-
-->
54-
<pendingMessageLimitStrategy>
55-
<constantPendingMessageLimitStrategy limit="1000"/>
56-
</pendingMessageLimitStrategy>
57-
</policyEntry>
58-
<policyEntry queue=">">
59-
<deadLetterStrategy>
60-
<!--
61-
Use the prefix 'DLQ.' for the destination name, and make
62-
the DLQ a queue rather than a topic
63-
-->
64-
<individualDeadLetterStrategy queuePrefix="DLQ." useQueueForQueueMessages="true" processNonPersistent="true"/>
65-
</deadLetterStrategy>
66-
</policyEntry>
67-
</policyEntries>
68-
</policyMap>
69-
</destinationPolicy>
70-
71-
72-
<!--
73-
The managementContext is used to configure how ActiveMQ is exposed in
74-
JMX. By default, ActiveMQ uses the MBean server that is started by
75-
the JVM. For more information, see:
76-
77-
http://activemq.apache.org/jmx.html
78-
-->
79-
<managementContext>
80-
<managementContext createConnector="false"/>
81-
</managementContext>
82-
83-
<!--
84-
Configure message persistence for the broker. The default persistence
85-
mechanism is the KahaDB store (identified by the kahaDB tag).
86-
For more information, see:
87-
88-
http://activemq.apache.org/persistence.html
89-
-->
90-
<persistenceAdapter>
91-
<kahaDB directory="${activemq.data}/kahadb"/>
92-
</persistenceAdapter>
93-
94-
95-
<!--
96-
The systemUsage controls the maximum amount of space the broker will
97-
use before disabling caching and/or slowing down producers. For more information, see:
98-
http://activemq.apache.org/producer-flow-control.html
99-
-->
100-
<systemUsage>
101-
<systemUsage>
102-
<memoryUsage>
103-
<memoryUsage percentOfJvmHeap="70"/>
104-
</memoryUsage>
105-
<storeUsage>
106-
<storeUsage limit="100 gb"/>
107-
</storeUsage>
108-
<tempUsage>
109-
<tempUsage limit="50 gb"/>
110-
</tempUsage>
111-
</systemUsage>
112-
</systemUsage>
113-
114-
<!--
115-
The transport connectors expose ActiveMQ over a given protocol to
116-
clients and other brokers. For more information, see:
117-
118-
http://activemq.apache.org/configuring-transports.html
119-
-->
120-
<transportConnectors>
121-
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
122-
<transportConnector name="openwire"
123-
uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
124-
<transportConnector name="amqp"
125-
uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
126-
<transportConnector name="stomp"
127-
uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
128-
<transportConnector name="mqtt"
129-
uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
130-
<transportConnector name="ws"
131-
uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
132-
</transportConnectors>
133-
134-
<!-- destroy the spring context on shutdown to stop jetty -->
135-
<shutdownHooks>
136-
<bean xmlns="http://www.springframework.org/schema/beans"
137-
class="org.apache.activemq.hooks.SpringContextHook"/>
138-
</shutdownHooks>
139-
140-
</broker>
141-
142-
<!--
143-
Enable web consoles, REST and Ajax APIs and demos
144-
The web consoles requires by default login, you can disable this in the jetty.xml file
145-
146-
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
147-
-->
148-
<import resource="jetty.xml"/>
23+
<!-- Allows us to use system properties as variables in this configuration file -->
24+
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
25+
<property name="locations">
26+
<value>file:${activemq.conf}/credentials.properties</value>
27+
</property>
28+
</bean>
29+
30+
31+
<!--
32+
The <broker> element is used to configure the ActiveMQ broker.
33+
-->
34+
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}"
35+
schedulerSupport="true">
36+
37+
<destinationPolicy>
38+
<policyMap>
39+
<policyEntries>
40+
<policyEntry topic=">">
41+
<!-- The constantPendingMessageLimitStrategy is used to prevent
42+
slow topic consumers to block producers and affect other consumers
43+
by limiting the number of messages that are retained
44+
For more information, see:
45+
46+
http://activemq.apache.org/slow-consumer-handling.html
47+
48+
-->
49+
<pendingMessageLimitStrategy>
50+
<constantPendingMessageLimitStrategy limit="1000"/>
51+
</pendingMessageLimitStrategy>
52+
</policyEntry>
53+
<policyEntry queue=">">
54+
<deadLetterStrategy>
55+
<!--
56+
Use the prefix 'DLQ.' for the destination name, and make
57+
the DLQ a queue rather than a topic
58+
-->
59+
<individualDeadLetterStrategy queuePrefix="DLQ." useQueueForQueueMessages="true" processNonPersistent="true"/>
60+
</deadLetterStrategy>
61+
</policyEntry>
62+
</policyEntries>
63+
</policyMap>
64+
</destinationPolicy>
65+
66+
67+
<!--
68+
The managementContext is used to configure how ActiveMQ is exposed in
69+
JMX. By default, ActiveMQ uses the MBean server that is started by
70+
the JVM. For more information, see:
71+
72+
http://activemq.apache.org/jmx.html
73+
-->
74+
<managementContext>
75+
<managementContext createConnector="false"/>
76+
</managementContext>
77+
78+
<!--
79+
Configure message persistence for the broker. The default persistence
80+
mechanism is the KahaDB store (identified by the kahaDB tag).
81+
For more information, see:
82+
83+
http://activemq.apache.org/persistence.html
84+
-->
85+
<persistenceAdapter>
86+
<kahaDB directory="${activemq.data}/kahadb"/>
87+
</persistenceAdapter>
88+
89+
90+
<!--
91+
The systemUsage controls the maximum amount of space the broker will
92+
use before disabling caching and/or slowing down producers. For more information, see:
93+
http://activemq.apache.org/producer-flow-control.html
94+
-->
95+
<systemUsage>
96+
<systemUsage>
97+
<memoryUsage>
98+
<memoryUsage percentOfJvmHeap="70"/>
99+
</memoryUsage>
100+
<storeUsage>
101+
<storeUsage limit="100 gb"/>
102+
</storeUsage>
103+
<tempUsage>
104+
<tempUsage limit="50 gb"/>
105+
</tempUsage>
106+
</systemUsage>
107+
</systemUsage>
108+
109+
<!--
110+
The transport connectors expose ActiveMQ over a given protocol to
111+
clients and other brokers. For more information, see:
112+
113+
http://activemq.apache.org/configuring-transports.html
114+
-->
115+
<transportConnectors>
116+
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
117+
<transportConnector name="openwire"
118+
uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
119+
<transportConnector name="amqp"
120+
uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
121+
<transportConnector name="stomp"
122+
uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
123+
<transportConnector name="mqtt"
124+
uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
125+
<transportConnector name="ws"
126+
uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
127+
</transportConnectors>
128+
129+
<!-- destroy the spring context on shutdown to stop jetty -->
130+
<shutdownHooks>
131+
<bean xmlns="http://www.springframework.org/schema/beans"
132+
class="org.apache.activemq.hooks.SpringContextHook"/>
133+
</shutdownHooks>
134+
135+
</broker>
136+
137+
<!--
138+
Enable web consoles, REST and Ajax APIs and demos
139+
The web consoles requires by default login, you can disable this in the jetty.xml file
140+
141+
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
142+
-->
143+
<import resource="jetty.xml"/>
149144

150145
</beans>
151-
<!-- END SNIPPET: example -->
146+
<!-- END SNIPPET: example -->

0 commit comments

Comments
 (0)