Skip to content

Commit

Permalink
ARTEMIS-4408 Update docker-run.sh for etc override
Browse files Browse the repository at this point in the history
ARTEMIS-4408 Update docker-run.sh for etc override

After creating the artemis docker image using the docker-run.sh script,
it is not possible to map a user supplied broker.xml using a volume
mapping. The broker.xml file is not there before instance creation,
so we cannot a static file mapping.

This change introduces an etc-override folder to write over the etc
folder contents. If a folder named etc-override exists inside the
instance folder, its contents will be copied over to etc folder after
instance creation. In order to use custom files that reside in etc,
eg. broker.xml or artemis.profile; it is sufficient to place these
files to a folder and map it to /var/lib/artemis-instance/etc-override
folder of the image.

The usage is also documented in readme.md file under the docker folder.
  • Loading branch information
muammereroglu authored and jbertram committed Sep 1, 2023
1 parent 47a3ee5 commit fd5b64f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions artemis-docker/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ echo CREATE_ARGUMENTS=${CREATE_ARGUMENTS}

if ! [ -f ./etc/broker.xml ]; then
/opt/activemq-artemis/bin/artemis create ${CREATE_ARGUMENTS} .
if [ -d ./etc-override ]; then
for file in `ls ./etc-override`; do echo copying file to etc folder: $file; cp ./etc-override/$file ./etc || :; done
fi
else
echo "broker already created, ignoring creation"
fi
Expand Down
7 changes: 7 additions & 0 deletions artemis-docker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,14 @@ This will hold the configuration and the data of the running broker. This is use

A broker instance will be created during the execution of the instance. If you pass a mapped folder for `/var/lib/artemis-instance` an image will be created or reused depending on the contents of the folder.

# Overriding files in etc folder

You can use customized configuration for the artemis instance by replacing the files residing in `etc` folder with the custom ones, eg. `broker.xml` or `artemis.profile`. Put the replacement files inside a folder and map it as a volume to:
- `/var/lib/artemis-instance/etc-override`

The contents of `etc-override` folder will be copied over to etc folder after the instance creation. Therefore, the image will always start with user-supplied configuration.

It you are mapping the whole `var/lib/artemis-instance` to an outside folder for persistence, you can place an `etc-override` folder inside the mapped one, its contents will again be copied over etc folder after creating the instance.

## Running a CentOS image

Expand Down

0 comments on commit fd5b64f

Please sign in to comment.