This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new 44e15b0 ARTEMIS-2776 Improve Dockerfiles
new c5a823b This closes #3146
44e15b0 is described below
commit 44e15b0e1ff5a24e39b7e94074525309c17a189d
Author: zekeoptimo <[email protected]>
AuthorDate: Thu May 21 16:16:21 2020 -0700
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.
---
artemis-docker/Dockerfile-centos | 2 +-
artemis-docker/Dockerfile-debian | 2 +-
artemis-docker/docker-run.sh | 8 ++++++++
artemis-docker/readme.md | 34 +++++++++++++++++++++++++---------
4 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/artemis-docker/Dockerfile-centos b/artemis-docker/Dockerfile-centos
index 1494513..8426475 100644
--- a/artemis-docker/Dockerfile-centos
+++ b/artemis-docker/Dockerfile-centos
@@ -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
diff --git a/artemis-docker/Dockerfile-debian b/artemis-docker/Dockerfile-debian
index d584080..c28a79b 100644
--- a/artemis-docker/Dockerfile-debian
+++ b/artemis-docker/Dockerfile-debian
@@ -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 \
diff --git a/artemis-docker/docker-run.sh b/artemis-docker/docker-run.sh
index e8574b8..ba7ee68 100755
--- a/artemis-docker/docker-run.sh
+++ b/artemis-docker/docker-run.sh
@@ -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
diff --git a/artemis-docker/readme.md b/artemis-docker/readme.md
index ce4905e..c4c1032 100644
--- a/artemis-docker/readme.md
+++ b/artemis-docker/readme.md
@@ -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