ARTEMIS-2776 Improve Dockerfiles

Fixes the Dockerfiles handling of ANONYMOUS_LOGIN and adds an
EXTRA_ARGS environment variable to allow specifying extra arguments
separate from the username, password and anonymous login options.
This commit is contained in:
zekeoptimo 2020-05-21 16:16:21 -07:00 committed by Clebert Suconic
parent 0c3ced60ff
commit 44e15b0e1f
4 changed files with 35 additions and 11 deletions

View File

@ -26,7 +26,7 @@ WORKDIR /opt
ENV ARTEMIS_USER artemis
ENV ARTEMIS_PASSWORD artemis
ENV ANONYMOUS_LOGIN false
ENV CREATE_ARGUMENTS --user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent --http-host 0.0.0.0 --relax-jolokia
ENV EXTRA_ARGS --http-host 0.0.0.0 --relax-jolokia
USER root

View File

@ -26,7 +26,7 @@ WORKDIR /opt
ENV ARTEMIS_USER artemis
ENV ARTEMIS_PASSWORD artemis
ENV ANONYMOUS_LOGIN false
ENV CREATE_ARGUMENTS --user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent --http-host 0.0.0.0 --relax-jolokia
ENV EXTRA_ARGS --http-host 0.0.0.0 --relax-jolokia
# add user and group for artemis
RUN groupadd -g 1000 -r artemis && useradd -r -u 1000 -g artemis artemis \

View File

@ -28,6 +28,14 @@ BROKER_HOME=/var/lib/
CONFIG_PATH=$BROKER_HOME/etc
export BROKER_HOME OVERRIDE_PATH CONFIG_PATH
if [[ ${ANONYMOUS_LOGIN,,} == "true" ]]; then
LOGIN_OPTION="--allow-anonymous"
else
LOGIN_OPTION="--require-login"
fi
CREATE_ARGUMENTS="--user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent ${LOGIN_OPTION} ${EXTRA_ARGS}"
echo CREATE_ARGUMENTS=${CREATE_ARGUMENTS}
if ! [ -f ./etc/broker.xml ]; then

View File

@ -13,7 +13,7 @@ $ ./prepare-docker.sh $ARTEMIS_HOME
Go to `$ARTEMIS_HOME` where you prepared the binary with Docker files.
## For Debian:
## For Debian
From within the `$ARTEMIS_HOME` folder:
```
@ -30,21 +30,37 @@ $ docker build -f ./docker/Dockerfile-centos -t artemis-centos .
**Note:**
`-t artemis-debian`,`-t artemis-centos` are just tag names for the purpose of this guide
# Variables:
- ARTEMIS_USER
- ARTEMIS_PASSWORD
- ANONYMOUS_LOGIN
# Environment Variables
Default here is FALSE. If you set this to true, it will change security settings passed on the broker instance creation.
Environment variables determine the options sent to `artemis create` on first execution of the Docker
container. The available options are:
- CREATE_ARGUMENTS
**`ARTEMIS_USER`**
Default here is `--user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent --http-host 0.0.0.0 --relax-jolokia`
The administrator username. The default is `artemis`.
**`ARTEMIS_PASSWORD`**
This will be passed straight to `./artemis create` during the execution.
The administrator password. The default is `artemis`.
**`ANONYMOUS_LOGIN`**
Set to `true` to allow anonymous logins. The default is `false`.
**`EXTRA_ARGS`**
Additional arguments sent to the `artemis create` command. The default is `--http-host 0.0.0.0 --relax-jolokia`.
Setting this value will override the default. See the documentation on `artemis create` for available options.
**Final broker creation command:**
The combination of the above environment variables results in the `docker-run.sh` script calling
the following command to create the broker instance the first time the Docker container runs:
${ARTEMIS_HOME}/bin/artemis create --user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent ${LOGIN_OPTION} ${EXTRA_ARGS}
Note: `LOGIN_OPTION` is either `--allow-anonymous` or `--require-login` depending on the value of `ANONYMOUS_LOGIN`.
# Mapping point