THIS PROJECT HAS BEEN ARCHIVED, AND MOVED TO A PRIVATE REPO ON gitlab.com
This project creates a Docker image of the ActiveMQ distribution, configured to run against SQL Server.
If run without any configuration, it falls back to using an in-memory HSQL database.
The Docker image of this app is available at Docker hub.
To allow configuration to be easily externalized, the image expects a /run/secrets
directory to exist, and switches to and then runs the application in that directory.
Spring Boot will then automatically pick up that configuration and use it.
Typically therefore all that is required is to define an spring.properties
file as a secret.
We run the activemq broker using an updated config, conf/activemq.xml
.
This takes the place of the default config, and is baked into the Docker image.
This replacement activemq.xml
uses the PropertyPlaceholderConfigurer
to read configuration property values (specifying the database URL etc) from an external properties file.
The name of this file is specified using the spring.config.file
system property.
The Docker image’s entrypoint (CMD
, in fact) is entrypoint.sh
, which runs the ActiveMQ console as follows:
activemq console -Dspring.config.file=file:/run/secrets/spring.properties
This assumes that the spring.properties
has been mounted as a secret in /run/secrets
.
However, if no /run/secrets/spring.properties
can be found, then the script will automatically generate a fallback spring.properties
to run with an in-memory HSQLDB database.
This is useful if running adhoc/in development, outside of an orchestrator.
The format of spring.properties
is:
activemq.data=activemq-data
activemq.db.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
activemq.db.url=jdbc:sqlserver://localhost:1433;instance=.;databaseName=activemq
activemq.db.username=activemq
activemq.db.password=activemq
activemq.db.jdbcAdapter=org.apache.activemq.store.jdbc.adapter.TransactJDBCAdapter
activemq.db.databaseLocker=org.apache.activemq.store.jdbc.adapter.TransactDatabaseLocker
Typically just the activemq.db.url
, activemq.db.username
and activemq.db.password
properties need configuring; the rest can be left as is.
To run the Docker image locally, use:
export TAG=20191011.1912.master.880118bc
docker run -p61616:61616 -p8161:8161 incodehq/activemq-mssqlserver:$TAG
where $TAG
is set to one of the images from the tags page.
This exposes :
-
the TCP broker at port 61616
-
the UI at port 8161 (that is, http://localhost:8161])
The hard-coded password is admin/admin
(from conf/users.properties
, hard-coded into the image).
Additional info at:
-
https://activemq.apache.org/broker-xbean-uri]
However, didn’t seem to pick up
xbean:file:…
so decided to just overwrite theconf/activemq.xml
file
Adapted from https://hub.docker.com/r/rmohr/activemq/dockerfile