This is an automated email from the ASF dual-hosted git repository. marat pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
The following commit(s) were added to refs/heads/main by this push: new 253678e Artemis Docker Image build script (#212) 253678e is described below commit 253678e6d0b61b554fb174788dfb9f6388d72de6 Author: Marat Gubaidullin <marat.gubaidul...@gmail.com> AuthorDate: Tue Mar 15 10:25:37 2022 -0400 Artemis Docker Image build script (#212) --- karavan-demo/postman/README.md | 9 + .../postman/artemis/Dockerfile-adoptopenjdk-11 | 69 +++++++ karavan-demo/postman/artemis/Dockerfile-centos | 69 +++++++ karavan-demo/postman/artemis/Dockerfile-debian | 69 +++++++ karavan-demo/postman/artemis/docker-run.sh | 49 +++++ karavan-demo/postman/artemis/prepare-docker.sh | 184 +++++++++++++++++++ karavan-demo/postman/artemis/readme.md | 198 +++++++++++++++++++++ karavan-demo/postman/docker-compose.yml | 11 +- 8 files changed, 653 insertions(+), 5 deletions(-) diff --git a/karavan-demo/postman/README.md b/karavan-demo/postman/README.md index 04ae89f..f393b73 100644 --- a/karavan-demo/postman/README.md +++ b/karavan-demo/postman/README.md @@ -8,6 +8,15 @@ 2. Apache Camel [Karavan](https://marketplace.visualstudio.com/items?itemName=camel-karavan.karavan) extension installed 3. [Jbang](https://www.jbang.dev/download/) installed 4. Docker and Docker compose installed +5. Build Apache Artemis Docker Image +``` +cd artemis +./prepare-docker.sh --from-release --artemis-version 2.20.0 +cd _TMP_/artemis/2.20.0 +docker build -f ./docker/Dockerfile-adoptopenjdk-11 -t artemis-adoptopenjdk-11 . +cd ../../../../ +``` +For MacOS users, in case of `tree command not found` error, install tree `brew install tree` ## How-to diff --git a/karavan-demo/postman/artemis/Dockerfile-adoptopenjdk-11 b/karavan-demo/postman/artemis/Dockerfile-adoptopenjdk-11 new file mode 100644 index 0000000..499f871 --- /dev/null +++ b/karavan-demo/postman/artemis/Dockerfile-adoptopenjdk-11 @@ -0,0 +1,69 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# ActiveMQ Artemis + +FROM adoptopenjdk:11-jre-hotspot +LABEL maintainer="Apache ActiveMQ Team" +# Make sure pipes are considered to determine success, see: https://github.com/hadolint/hadolint/wiki/DL4006 +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +WORKDIR /opt + +ENV ARTEMIS_USER artemis +ENV ARTEMIS_PASSWORD artemis +ENV ANONYMOUS_LOGIN false +ENV EXTRA_ARGS --http-host 0.0.0.0 --relax-jolokia + +# add user and group for artemis +RUN groupadd -g 1001 -r artemis && useradd -r -u 1001 -g artemis artemis \ + && apt-get -qq -o=Dpkg::Use-Pty=0 update && \ + apt-get -qq -o=Dpkg::Use-Pty=0 install -y libaio1 && \ + rm -rf /var/lib/apt/lists/* + +USER artemis + +ADD . /opt/activemq-artemis + +# Web Server +EXPOSE 8161 \ +# JMX Exporter + 9404 \ +# Port for CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE + 61616 \ +# Port for HORNETQ,STOMP + 5445 \ +# Port for AMQP + 5672 \ +# Port for MQTT + 1883 \ +#Port for STOMP + 61613 + +USER root + +RUN mkdir /var/lib/artemis-instance && chown -R artemis.artemis /var/lib/artemis-instance + +COPY ./docker/docker-run.sh / + +USER artemis + +# Expose some outstanding folders +VOLUME ["/var/lib/artemis-instance"] +WORKDIR /var/lib/artemis-instance + +ENTRYPOINT ["/docker-run.sh"] +CMD ["run"] diff --git a/karavan-demo/postman/artemis/Dockerfile-centos b/karavan-demo/postman/artemis/Dockerfile-centos new file mode 100644 index 0000000..b6fe8f0 --- /dev/null +++ b/karavan-demo/postman/artemis/Dockerfile-centos @@ -0,0 +1,69 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# ActiveMQ Artemis + +FROM jboss/base-jdk:11 +LABEL maintainer="Apache ActiveMQ Team" +# Make sure pipes are considered to determine success, see: https://github.com/hadolint/hadolint/wiki/DL4006 +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +WORKDIR /opt + +ENV ARTEMIS_USER artemis +ENV ARTEMIS_PASSWORD artemis +ENV ANONYMOUS_LOGIN false +ENV EXTRA_ARGS --http-host 0.0.0.0 --relax-jolokia + +USER root + +# add user and group for artemis +RUN groupadd -g 1001 -r artemis && useradd -r -u 1001 -g artemis artemis \ + && yum install -y libaio && yum -y clean all + +USER artemis + +ADD . /opt/activemq-artemis + +# Web Server +EXPOSE 8161 \ +# JMX Exporter + 9404 \ +# Port for CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE + 61616 \ +# Port for HORNETQ,STOMP + 5445 \ +# Port for AMQP + 5672 \ +# Port for MQTT + 1883 \ +#Port for STOMP + 61613 + +USER root + +RUN mkdir /var/lib/artemis-instance && chown -R artemis.artemis /var/lib/artemis-instance + +COPY ./docker/docker-run.sh / + +USER artemis + +# Expose some outstanding folders +VOLUME ["/var/lib/artemis-instance"] +WORKDIR /var/lib/artemis-instance + +ENTRYPOINT ["/docker-run.sh"] +CMD ["run"] \ No newline at end of file diff --git a/karavan-demo/postman/artemis/Dockerfile-debian b/karavan-demo/postman/artemis/Dockerfile-debian new file mode 100644 index 0000000..263dbb3 --- /dev/null +++ b/karavan-demo/postman/artemis/Dockerfile-debian @@ -0,0 +1,69 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# ActiveMQ Artemis + +FROM openjdk:11 +LABEL maintainer="Apache ActiveMQ Team" +# Make sure pipes are considered to determine success, see: https://github.com/hadolint/hadolint/wiki/DL4006 +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +WORKDIR /opt + +ENV ARTEMIS_USER artemis +ENV ARTEMIS_PASSWORD artemis +ENV ANONYMOUS_LOGIN false +ENV EXTRA_ARGS --http-host 0.0.0.0 --relax-jolokia + +# add user and group for artemis +RUN groupadd -g 1001 -r artemis && useradd -r -u 1001 -g artemis artemis \ + && apt-get -qq -o=Dpkg::Use-Pty=0 update && \ + apt-get -qq -o=Dpkg::Use-Pty=0 install -y libaio1 && \ + rm -rf /var/lib/apt/lists/* + +USER artemis + +ADD . /opt/activemq-artemis + +# Web Server +EXPOSE 8161 \ +# JMX Exporter + 9404 \ +# Port for CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE + 61616 \ +# Port for HORNETQ,STOMP + 5445 \ +# Port for AMQP + 5672 \ +# Port for MQTT + 1883 \ +#Port for STOMP + 61613 + +USER root + +RUN mkdir /var/lib/artemis-instance && chown -R artemis.artemis /var/lib/artemis-instance + +COPY ./docker/docker-run.sh / + +USER artemis + +# Expose some outstanding folders +VOLUME ["/var/lib/artemis-instance"] +WORKDIR /var/lib/artemis-instance + +ENTRYPOINT ["/docker-run.sh"] +CMD ["run"] diff --git a/karavan-demo/postman/artemis/docker-run.sh b/karavan-demo/postman/artemis/docker-run.sh new file mode 100755 index 0000000..ba7ee68 --- /dev/null +++ b/karavan-demo/postman/artemis/docker-run.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + + +# This is the entry point for the docker images. +# This file is executed when docker run is called. + + +set -e + +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 + /opt/activemq-artemis/bin/artemis create ${CREATE_ARGUMENTS} . +else + echo "broker already created, ignoring creation" +fi + +exec ./bin/artemis "$@" + + diff --git a/karavan-demo/postman/artemis/prepare-docker.sh b/karavan-demo/postman/artemis/prepare-docker.sh new file mode 100755 index 0000000..017c1f5 --- /dev/null +++ b/karavan-demo/postman/artemis/prepare-docker.sh @@ -0,0 +1,184 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Setting the script to fail if anything goes wrong +set -e + +#This is a script to Prepare an artemis folder to generate the Release. + + +usage () { + cat <<HERE + +$@ + +Usage: + # Prepare for build the Docker Image from the local distribution + ./prepare-docker.sh --from-local-dist --local-dist-path {local-distribution-directory} + + # Prepare for build the Docker Image from the release version + ./prepare-docker.sh --from-release --artemis-version {release-version} + + # Show the usage command + ./prepare-docker.sh --help + +Example: + ./prepare-docker.sh --from-local-dist --local-dist-path ../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT + ./prepare-docker.sh --from-release --artemis-version 2.16.0 + +HERE + exit 1 +} + +next_step () { + cat <<HERE + +Well done! Now you can continue with the Docker image build. +Building the Docker Image: + Go to $ARTEMIS_DIST where you prepared the binary with Docker files. + + # Go to $ARTEMIS_DIST + $ cd $ARTEMIS_DIST + + # For Debian + $ docker build -f ./docker/Dockerfile-debian -t artemis-debian . + + # For CentOS + $ docker build -f ./docker/Dockerfile-centos -t artemis-centos . + + # For AdoptOpen JDK 11 + $ docker build -f ./docker/Dockerfile-adoptopenjdk-11 -t artemis-adoptopenjdk-11 . + + # For AdoptOpen JDK 11 (Build for linux ARMv7/ARM64) + $ docker buildx build --platform linux/arm64,linux/arm/v7 --push -t {your-repository}/apache-artemis:2.17.0-SNAPSHOT -f ./docker/Dockerfile-adoptopenjdk-11 . + +Note: -t artemis-debian, -t artemis-centos and artemis-adoptopenjdk-11 are just +tag names for the purpose of this guide + +For more info read the readme.md + +HERE + exit 1 +} + +while [ "$#" -ge 1 ] +do +key="$1" + case $key in + --help) + usage + ;; + --from-local-dist) + FROM_LOCAL="true" + ;; + --from-release) + FROM_RELEASE="true" + ;; + --local-dist-path) + LOCAL_DIST_PATH="$2" + shift + ;; + --artemis-version) + ARTEMIS_VERSION="$2" + shift + ;; + *) + # unknown option + usage "Unknown option" + ;; + esac + shift +done + +# TMPDIR must be contained within the working directory so it is part of the +# Docker context. (i.e. it can't be mktemp'd in /tmp) +BASE_TMPDIR="_TMP_/artemis" + +cleanup() { + if [ -d "${BASE_TMPDIR}/${ARTEMIS_VERSION}" ] + then + echo "Clean up the ${BASE_TMPDIR}/${ARTEMIS_VERSION} directory" + find "${BASE_TMPDIR}" -name "${ARTEMIS_VERSION}" -type d -mmin +60 -exec rm -rf "{}" \; + else + mkdir -p "${BASE_TMPDIR}/${ARTEMIS_VERSION}" + fi +} + +if [ -n "${FROM_RELEASE}" ]; then + [ -n "${ARTEMIS_VERSION}" ] || usage "You must specify the release version (es.: --artemis-version 2.16.0)" + + cleanup + + ARTEMIS_BASE_URL="$(curl -s https://www.apache.org/dyn/closer.cgi\?preferred=true)activemq/activemq-artemis/${ARTEMIS_VERSION}/" + ARTEMIS_DIST_FILE_NAME="apache-artemis-${ARTEMIS_VERSION}-bin.tar.gz" + CURL_OUTPUT="${BASE_TMPDIR}/${ARTEMIS_VERSION}/${ARTEMIS_DIST_FILE_NAME}" + + if [ -z "$(ls -A ${BASE_TMPDIR}/${ARTEMIS_VERSION})" ] + then + echo "Downloading ${ARTEMIS_DIST_FILE_NAME} from ${ARTEMIS_BASE_URL}..." + curl --progress-bar "${ARTEMIS_BASE_URL}${ARTEMIS_DIST_FILE_NAME}" --output "${CURL_OUTPUT}" + + echo "Expanding ${BASE_TMPDIR}/${ARTEMIS_VERSION}/${ARTEMIS_DIST_FILE_NAME}..." + tar xzf "$CURL_OUTPUT" --directory "${BASE_TMPDIR}/${ARTEMIS_VERSION}" --strip 1 + + echo "Removing ${BASE_TMPDIR}/${ARTEMIS_VERSION}/${ARTEMIS_DIST_FILE_NAME}..." + rm -rf "${BASE_TMPDIR}/${ARTEMIS_VERSION}"/"${ARTEMIS_DIST_FILE_NAME}" + fi + + ARTEMIS_DIST="${BASE_TMPDIR}/${ARTEMIS_VERSION}" + + echo "Using Artemis dist: ${ARTEMIS_DIST}" + +elif [ -n "${FROM_LOCAL}" ]; then + + if [ -n "${LOCAL_DIST_PATH}" ]; then + ARTEMIS_DIST=${LOCAL_DIST_PATH} + echo "Using Artemis dist: ${ARTEMIS_DIST}" + else + usage "You must specify the local distribution directory" + fi + + if [ ! -d "${ARTEMIS_DIST}" ] + then + usage "Directory ${ARTEMIS_DIST} does not exist" + fi + + if [ -d "${ARTEMIS_DIST}/docker" ] + then + echo "Clean up the ${ARTEMIS_DIST}/docker directory" + rm -rf "${ARTEMIS_DIST}/docker" + fi + +else + + usage + +fi + +if [ ! -d "${ARTEMIS_DIST}/docker" ] +then + mkdir "${ARTEMIS_DIST}/docker" +fi + +cp ./Dockerfile-* "$ARTEMIS_DIST/docker" +cp ./docker-run.sh "$ARTEMIS_DIST/docker" + +echo "Docker file support files at : $ARTEMIS_DIST/docker" +tree "$ARTEMIS_DIST/docker" + +next_step \ No newline at end of file diff --git a/karavan-demo/postman/artemis/readme.md b/karavan-demo/postman/artemis/readme.md new file mode 100644 index 0000000..3f17743 --- /dev/null +++ b/karavan-demo/postman/artemis/readme.md @@ -0,0 +1,198 @@ +# Docker Image Example + +This is an example on how you could create your own Docker Image For Apache +ActiveMQ Artemis based on CentOS or Debian (JDK 8) or AdoptOpen JDK 11 (Ubuntu). + +# Preparing + +Use the script ./prepare-docker.sh as it will copy the docker files under the +binary distribution. + +Below is shown the command to prepare the build of the Docker Image starting +from the local distribution (from the source codes of ActiveMQ Artemis) +``` +# Prepare for build the Docker Image from the local distribution. Replace the +# {local-distribution-directory} with your directory. +$ ./prepare-docker.sh --from-local-dist --local-dist-path {local-distribution-directory} +``` + +The output of the previous command is shown below. + +``` +$ ./prepare-docker.sh --from-local-dist --local-dist-path ../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT + +Using Artemis dist: ../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT +Clean up the ../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT/docker directory +Docker file support files at : ../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT/docker +../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT/docker +├── Dockerfile-adoptopenjdk-11 +├── Dockerfile-centos +├── Dockerfile-debian +└── docker-run.sh + +0 directories, 4 files + +Well done! Now you can continue with the Docker image build. +Building the Docker Image: + Go to ../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT where you prepared the binary with Docker files. + + # Go to ../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT + $ cd ../artemis-distribution/target/apache-artemis-2.17.0-SNAPSHOT-bin/apache-artemis-2.17.0-SNAPSHOT + + # For Debian + $ docker build -f ./docker/Dockerfile-debian -t artemis-debian . + + # For CentOS + $ docker build -f ./docker/Dockerfile-centos -t artemis-centos . + + # For AdoptOpen JDK 11 + $ docker build -f ./docker/Dockerfile-adoptopenjdk-11 -t artemis-adoptopenjdk-11 . + +Note: -t artemis-debian, -t artemis-centos and artemis-adoptopenjdk-11 are just +tag names for the purpose of this guide + +For more info read the readme.md + +``` + +The command to prepare the build of the Docker Image starting from the official +release of ActiveMQ Artemis is shown below +``` +# Prepare for build the Docker Image from the release version. Replace the +# {release-version} with the version that you want +$ ./prepare-docker.sh --from-release --artemis-version {release-version} +``` + +The output of the previous command is shown below. + +``` +$ ./prepare-docker.sh --from-release --artemis-version 2.16.0 + +Downloading apache-artemis-2.16.0-bin.tar.gz from https://downloads.apache.org/activemq/activemq-artemis/2.16.0/... +################################################################################################################################################################################################################################ 100,0% +Expanding _TMP_/artemis/2.16.0/apache-artemis-2.16.0-bin.tar.gz... +Removing _TMP_/artemis/2.16.0/apache-artemis-2.16.0-bin.tar.gz... +Using Artemis dist: _TMP_/artemis/2.16.0 +Docker file support files at : _TMP_/artemis/2.16.0/docker +_TMP_/artemis/2.16.0/docker +├── Dockerfile-adoptopenjdk-11 +├── Dockerfile-centos +├── Dockerfile-debian +└── docker-run.sh + +0 directories, 4 files + +Well done! Now you can continue with the Docker image build. +Building the Docker Image: + Go to _TMP_/artemis/2.16.0 where you prepared the binary with Docker files. + + # Go to _TMP_/artemis/2.16.0 + $ cd _TMP_/artemis/2.16.0 + + # For Debian + $ docker build -f ./docker/Dockerfile-debian -t artemis-debian . + + # For CentOS + $ docker build -f ./docker/Dockerfile-centos -t artemis-centos . + + # For AdoptOpen JDK 11 + $ docker build -f ./docker/Dockerfile-adoptopenjdk-11 -t artemis-adoptopenjdk-11 . + +Note: -t artemis-debian, -t artemis-centos and artemis-adoptopenjdk-11 are just +tag names for the purpose of this guide + +For more info read the readme.md +``` + +# Building + +Go to `$ARTEMIS_DIST` where you prepared the binary with Docker files. + +## For Debian + +From within the `$ARTEMIS_DIST` folder: +``` +$ docker build -f ./docker/Dockerfile-debian -t artemis-debian . +``` + +## For CentOS + +From within the `$ARTEMIS_DIST` folder: +``` +$ docker build -f ./docker/Dockerfile-centos -t artemis-centos . +``` + +## For AdoptOpen JDK 11 +From within the `$ARTEMIS_DIST` folder: +``` +$ docker build -f ./docker/Dockerfile-adoptopenjdk-11 -t artemis-adoptopenjdk-11 . +``` + +# For AdoptOpen JDK 11 (Build for linux ARMv7/ARM64) +``` +$ docker buildx build --platform linux/arm64,linux/arm/v7 --push -t {your-repository}/apache-artemis:2.17.0-SNAPSHOT -f ./docker/Dockerfile-adoptopenjdk-11 . +``` + +**Note:** +`-t artemis-debian`,`-t artemis-centos`,`artemis-adoptopenjdk-11` are just tag +names for the purpose of this guide + + +# Environment Variables + +Environment variables determine the options sent to `artemis create` on first execution of the Docker +container. The available options are: + +**`ARTEMIS_USER`** + +The administrator username. The default is `artemis`. + +**`ARTEMIS_PASSWORD`** + +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 + +- `/var/lib/artemis-instance` + +It's possible to map a folder as the instance broker. +This will hold the configuration and the data of the running broker. This is useful for when you want the data persisted outside of a container. + + +# Lifecycle of the execution + +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. + + + +## Running a CentOS image + +The image just created in the previous step allows both stateless or stateful runs. +The stateless run is achieved by: +``` +$ docker run --rm -it -p 61616:61616 -p 8161:8161 artemis-centos +``` +The image will also support mapped folders and mapped ports. To run the image with the instance persisted on the host: +``` +docker run -it -p 61616:61616 -p 8161:8161 -v <broker folder on host>:/var/lib/artemis-instance artemis-centos +``` +where `<broker folder on host>` is a folder where the broker instance is supposed to +be saved and reused on each run. diff --git a/karavan-demo/postman/docker-compose.yml b/karavan-demo/postman/docker-compose.yml index 852194a..6bedcc2 100644 --- a/karavan-demo/postman/docker-compose.yml +++ b/karavan-demo/postman/docker-compose.yml @@ -27,12 +27,13 @@ services: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_CREATE_TOPICS: "events:1:1" - activemq: - image: registry.redhat.io/amq7/amq-broker:latest - container_name: activemq + artemis: + image: artemis-adoptopenjdk-11:latest + container_name: artemis environment: - - AMQ_USER=admin - - AMQ_PASSWORD=admin + - ARTEMIS_USER=admin + - ARTEMIS_PASSWORD=admin + - ANONYMOUS_LOGIN=true ports: - "61616:61616" - "1883:1883"