ARTEMIS-4408 Update docker-run.sh for etc override

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.
This commit is contained in:
Muammer Eroglu 2023-08-08 11:17:05 +03:00 committed by Justin Bertram
parent 47a3ee5304
commit fd5b64f035
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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