From 7bddddb041d71a89a5c5a4ab34ab474b04b9499d Mon Sep 17 00:00:00 2001 From: dakirily Date: Wed, 8 Nov 2023 14:05:30 +0100 Subject: [PATCH] QPID-8352: [Broker-J] Official Docker image for Broker-J --- .../src/main/markdown/release-instructions.md | 1 - .../src/docbkx/Java-Broker-Docker.xml | 372 +++++++++++++++++- qpid-docker/Containerfile | 27 +- qpid-docker/README.md | 138 ++++--- qpid-docker/broker.acl | 6 +- qpid-docker/config.json | 8 +- qpid-docker/docker-build.sh | 22 +- qpid-docker/entrypoint.sh | 36 ++ 8 files changed, 513 insertions(+), 97 deletions(-) create mode 100644 qpid-docker/entrypoint.sh diff --git a/doc/developer-guide/src/main/markdown/release-instructions.md b/doc/developer-guide/src/main/markdown/release-instructions.md index f125c8e630..b59dd08c4f 100644 --- a/doc/developer-guide/src/main/markdown/release-instructions.md +++ b/doc/developer-guide/src/main/markdown/release-instructions.md @@ -184,4 +184,3 @@ Sources are kept in a Git repository. Thus a git client is required. when a new one is announced. 15. Update jenkins jobs if required. 16. Docker images can be build and pushed to the container registry according to the qpid-docker [README.md](https://github.com/apache/qpid-broker-j/tree/main/qpid-docker#readme). -16. Docker images can be build and pushed to the container registry according to the qpid-docker [README.md](https://github.com/apache/qpid-broker-j/tree/main/qpid-docker#readme). diff --git a/doc/java-broker/src/docbkx/Java-Broker-Docker.xml b/doc/java-broker/src/docbkx/Java-Broker-Docker.xml index 683ddea732..1b117419cf 100644 --- a/doc/java-broker/src/docbkx/Java-Broker-Docker.xml +++ b/doc/java-broker/src/docbkx/Java-Broker-Docker.xml @@ -23,12 +23,68 @@ Docker Images -
+
- Docker Image + Building Container Image - By default broker images is built with BDB message storage. + To use an official Apache release in your image run the following command from the qpid-docker directory where + <QPID_RELEASE_VERSION> is the release version you wish to use (e.g. 9.1.0): + + + + + cd qpid-docker + + + + + + docker-build.sh --release <QPID_RELEASE_VERSION> + + + + + This will download the Qpid Broker-J release and copy all the files necessary to build the pre-configured + Docker image and provide you with additional instructions. Follow these instructions to finish building + the image you want based on the provided Docker file or even one of your own. + + + + If you would rather prefer to build the docker image from local Broker-J distribution, build the parent + project using the command + + + + + mvn clean install -DskipTests=true + + + + + Navigate to the module 'qpid-docker': + + + + + cd qpid-docker + + + + + Execute the command: + + + + + docker-build.sh --local-dist-path <PATH_TO_LOCAL_QPID_DISTRIBUTION> + + + + + This will copy all the files necessary to build the pre-configured Docker image and provide you with additional + instructions. Follow these instructions to finish building the image you want based on one of the provided + Docker file or even one of your own.
@@ -42,22 +98,12 @@ Container Start - Before starting the container a volume should be created: + Container can be started using following command: - docker volume create --driver local --opt device=<PATH_TO_FOLDER> --opt type=none --opt o=bind qpid_volume - - - - - Then container using created volume can be started: - - - - - docker run -d -p 5672:5672 -p 8080:8080 -v qpid_volume:/qpid-broker-j/work --name qpid <IMAGE_NAME> + docker run -d -p 5672:5672 -p 8080:8080 --name qpid <IMAGE_NAME> @@ -109,6 +155,50 @@
+
+ + Container Volume + + + The image will use the directory /qpid-broker-j/work to hold the configuration and the data of the + running broker. To persist the broker configuration and the data outside the container, start container + with the volume mapping: + + + + + docker run -d -p 5672:5672 -p 8080:8080 -v <BROKER_DIRECTOR_ON_HOST>:/qpid-broker-j/work --name qpid <IMAGE_NAME> + + + + + or + + + + + podman run -d -p 5672:5672 -p 8080:8080 -v <BROKER_DIRECTOR_ON_HOST>:/qpid-broker-j/work:Z --name qpid <IMAGE_NAME> + + + +
+ +
+ + Stopping the Container + + + Running container can be stopped using following command: + + + + + docker stop <CONTAINER_NAME> + + + +
+
@@ -116,26 +206,266 @@ Broker Users - Container has two preconfigured broker users: + Default configuration provides a preconfigured broker user, having read and write access to all broker objects: - admin (password 'admin') - guest (password 'guest') + admin (default password 'admin') - User 'admin' has read and write access to all broker objects. User 'guest' has read-only access to all broker - objects, can not send or consume messages. + Username of the 'admin' user can be overridden be providing the variable QPID_ADMIN_USER on start, and the default + password of the 'admin' user can be overridden be providing the variable QPID_ADMIN_PASSWORD on start: + + + + + docker run -d -p 5672:5672 -p 8080:8080 -v qpid_volume:/qpid-broker-j/work -e QPID_ADMIN_USER=myuser -e QPID_ADMIN_PASSWORD=mypassword --name qpid <IMAGE_NAME> + Further broker users as well as other broker objects (queues, exchanges, keystores, truststore, ports etc.) - can be created via HTTP management interface. + can be created via HTTP management interface. Description of the broker REST API can be found in broker book + (chapter 6.3). + + +
+ +
+ + Broker Customization + + + To customize broker before building the container image, its configuration files may be edited to start + broker with queues, exchanges, users or other objects. + + The file config.json contains definitions of the broker objects and references a file containing definitions + of virtualhost objects (exchanges and queues). + + + + It may be helpful first to create broker objects needed via broker web GUI or via REST API, and then + investigate the configuration files and copy the appropriate definitions to the configuration files used + for container image creation. + + + + An example of the default initial configuration JSON file is provided in broker book + (chapter 5.7). + + +
+ + Exchanges + + + To create exchanges a JSON element "exchanges" should be created containing an array of single + exchange definitions: + + + + + "exchanges" : [ { + "name" : "amq.direct", + "type" : "direct" + }, { + "name" : "amq.fanout", + "type" : "fanout" + }, { + "name" : "amq.match", + "type" : "headers" + }, { + "name" : "amq.topic", + "type" : "topic" + }, { + "name" : "request.QUEUE1", + "type" : "topic", + "durable" : true, + "durableBindings" : [ { + "arguments" : { }, + "destination" : "QUEUE1", + "bindingKey" : "#" + } ], + "unroutableMessageBehaviour" : "REJECT" + } ] + + + + + Information about exchanges, their types and properties can be found in broker book + (chapter 4.6). + + + + Please note that each virtualhost pre-declares several exchanges, described in the broker book + (chapter 4.6.1). + + +
+ +
+ + Queues + + + To create queue a JSON element "queues" should be created containing an array of single queue definitions: + + + + + "queues" : [ { + "name" : "QUEUE1", + "type" : "standard", + "durable" : true, + "maximumQueueDepthBytes" : 6144000, + "maximumQueueDepthMessages" : 6000, + "messageDurability" : "ALWAYS", + "overflowPolicy" : "REJECT" + }, { + "name" : "QUEUE2", + "type" : "standard", + "durable" : true, + "maximumQueueDepthBytes" : 6144000, + "maximumQueueDepthMessages" : 6000, + "messageDurability" : "ALWAYS", + "overflowPolicy" : "REJECT" + } ] + + + + + Information about queues, their types and properties can be found in broker book + (chapter 4.7). + + +
+ +
+ + Users + + + Users can be defined in an authentication provider. Authentication providers are defined on broker + level (file config.json). + + + + Information about authentication providers, their types and properties can be found in broker book + (chapter 8.1). + + + + Examples for most commonly used authentication providers can be found below. + + +
+ + Anonymous Authentication Provider + + + + "authenticationproviders" : [ { + "name" : "anon", + "type" : "Anonymous" + } ] + + + + + For additional details see broker book + (chapter 8.1.5). + + +
+ +
+ + Plain Authentication Provider + + + + "authenticationproviders" : [{ + "name" : "plain", + "type" : "Plain", + "secureOnlyMechanisms" : [], + "users" : [ { + "name" : "admin", + "type" : "managed", + "password" : "<PASSWORD>" + } ] + } ] + + + + + For additional details see broker book + (chapter 8.1.7). + + +
+ +
+ + ACL Rules + + + The ACL rules for users are defined in file broker.acl following the syntax: + + + + + ACL {permission} {<group-name>|<user-name>|ALL} {action|ALL} [object|ALL] [property=<property-values>] + + + + + The predefined broker.acl file contains permissions for the 'admin' user: + + + + + # account 'admin' - enabled all actions + ACL ALLOW-LOG admin ALL ALL + + + + + For additional details see broker book + (chapter 8.3.2). + + +
+ +
+ +
+ + Overriding Broker Configuration + + + Customized configuration for the Broker-J instance can be used by replacing the files residing in the work + folder with the custom ones, e.g. config.json or default.json. Put the replacement files inside a folder + and map it as a volume to: + + + + + docker run -d -p 5672:5672 -p 8080:8080 -v <DIRECTORY_ON_HOST>:/qpid-broker-j/work-override:Z --name qpid <IMAGE_NAME> + + + + + The contents of work-override folder will be copied over to work folder first time after the instance creation so that + the broker will start with user-supplied configuration. + + +
+
\ No newline at end of file diff --git a/qpid-docker/Containerfile b/qpid-docker/Containerfile index a25d6e7df9..a402cb2e32 100644 --- a/qpid-docker/Containerfile +++ b/qpid-docker/Containerfile @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -ARG OS_NAME=alpine +ARG OS_NAME=ubuntu # # Builder images @@ -39,10 +39,10 @@ ARG BROKER_VERSION="unknown" # Labels LABEL description="Apache Qpid Broker-J ${BROKER_VERSION}" LABEL io.k8s.display-name="qpid-broker-j ${BROKER_VERSION}" -LABEL io.k8s.description="Apache Qpid Broker-J ${BROKER_VERSION} using BDB as a message storage" +LABEL io.k8s.description="Apache Qpid Broker-J ${BROKER_VERSION}" LABEL maintainer="Apache Qpid Team, users@qpid.apache.org" LABEL name="Apache Qpid Broker-J" -LABEL summary="Apache Qpid Broker-J ${BROKER_VERSION} using BDB as a message storage" +LABEL summary="Apache Qpid Broker-J ${BROKER_VERSION}" LABEL version="${BROKER_VERSION}" LABEL url="https://qpid.apache.org/components/broker-j/index.html" @@ -51,9 +51,15 @@ ENV JAVA_GC="-XX:+UseG1GC" ENV JAVA_MEM="-Xmx300m -XX:MaxDirectMemorySize=200m" ENV JAVA_OPTS="" +# Broker-J admin user credentials +ENV QPID_ADMIN_USER="admin" +ENV QPID_ADMIN_PASSWORD="admin" + # Create work folder and subfolders RUN mkdir -p /qpid-broker-j/etc && \ mkdir -p /qpid-broker-j/work && \ + mkdir -p /qpid-broker-j/work-init && \ + mkdir -p /qpid-broker-j/work-override && \ chmod -R 770 /qpid-broker-j && \ chown -R 1001:root /qpid-broker-j @@ -63,12 +69,15 @@ VOLUME ["/qpid-broker-j/work"] # Copy jar files COPY --chown=1001:root --chmod=770 ./lib /qpid-broker-j/lib +# Copy entrypoint script +COPY --chown=1001:root --chmod=770 entrypoint.sh /qpid-broker-j + # Copy configuration files -COPY --chown=1001:root --chmod=660 broker.acl /qpid-broker-j/work -COPY --chown=1001:root --chmod=660 config.json /qpid-broker-j/work -COPY --chown=1001:root --chmod=660 default.json /qpid-broker-j/work/default.json -COPY --chown=1001:root --chmod=660 preferences.json /qpid-broker-j/work -COPY --chown=1001:root --chmod=660 userPreferences.json /qpid-broker-j/work +COPY --chown=1001:root --chmod=660 broker.acl /qpid-broker-j/work-init +COPY --chown=1001:root --chmod=660 config.json /qpid-broker-j/work-init +COPY --chown=1001:root --chmod=660 default.json /qpid-broker-j/work-init +COPY --chown=1001:root --chmod=660 preferences.json /qpid-broker-j/work-init +COPY --chown=1001:root --chmod=660 userPreferences.json /qpid-broker-j/work-init WORKDIR /qpid-broker-j @@ -76,4 +85,4 @@ EXPOSE 5672 8080 USER 1001:root -ENTRYPOINT java -server $JAVA_GC $JAVA_MEM $JAVA_OPTS -DQPID_HOME=/qpid-broker-j -DQPID_WORK=/qpid-broker-j/work -cp "/qpid-broker-j/lib/*" org.apache.qpid.server.Main +ENTRYPOINT exec /qpid-broker-j/entrypoint.sh diff --git a/qpid-docker/README.md b/qpid-docker/README.md index a05bf02fa2..68f11fa34e 100644 --- a/qpid-docker/README.md +++ b/qpid-docker/README.md @@ -4,7 +4,21 @@ This is an example on how a Docker Image For Apache Qpid Broker-J based on Eclip ## Building Container Image -Build the parent project using command +To use an official Apache release in your image run the following command from the qpid-docker directory where + is the release version you wish to use (e.g. 9.1.0): + +``` +cd qpid-docker + +docker-build.sh --release +``` + +This will download the Qpid Broker-J release and copy all the files necessary to build the pre-configured Docker image +and provide you with additional instructions. Follow these instructions to finish building the image you want based on +the provided Docker file or even one of your own. + +If you would rather prefer to build the docker image from local Broker-J distribution, build the parent project using +the command ``` mvn clean install -DskipTests=true @@ -16,27 +30,16 @@ Navigate to the module 'qpid-docker': cd qpid-docker ``` -Execute command +Execute the command ``` docker-build.sh --local-dist-path ``` -This will copy all the files necessary to build the pre-configured Docker image and provide you with additional -instructions. Follow these instructions to finish building the image you want based on one of the provided Docker file +This will copy all the files necessary to build the pre-configured Docker image and provide you with additional +instructions. Follow these instructions to finish building the image you want based on one of the provided Docker file or even one of your own. -If you would rather use an official Apache release in your image rather than a local release then run the following -command from the qpid-docker directory where is the release version you wish to use (e.g. 9.1.0): - -``` -docker-build.sh --qpid-version -``` - -This will download the Qpid Broker-J release and copy all the files necessary to build the pre-configured Docker image -and provide you with additional instructions. Follow these instructions to finish building the image you want based on -the provided Docker file or even one of your own. - ### Container Structure Broker-J files are copied to the folder /qpid-broker-j \ @@ -60,32 +63,35 @@ There are following environment variables available when running the container: #### Container Volume -Before starting the container a volume should be created: +The image will use the directory /qpid-broker-j/work to hold the configuration and the data of the running broker. +To persist the broker configuration and the data outside the container, start container with the volume mapping: ``` -docker volume create --driver local --opt device= --opt type=none --opt o=bind qpid_volume +docker run -d -p 5672:5672 -p 8080:8080 -v :/qpid-broker-j/work --name qpid ``` - -Then container using created volume can be started as follows: - +or ``` -docker run -d -p 5672:5672 -p 8080:8080 -v qpid_volume:/qpid-broker-j/work --name qpid +podman run -d -p 5672:5672 -p 8080:8080 -v :/qpid-broker-j/work:Z --name qpid ``` -or + +### Stopping the Container + +Running container can be stopped using following command: ``` -podman run -d -p 5672:5672 -p 8080:8080 -v qpid_volume:/qpid-broker-j/work:Z --name qpid +docker stop qpid ``` -When container is started for the first time, configuration files become available in the mapped folder being persisted -after subsequent restarts. ### Broker Users -Default configuration provides two preconfigured broker users: -- admin (password 'admin') -- guest (password 'guest') +Default configuration provides a preconfigured broker user, having read and write access to all broker objects: +- admin (default password 'admin') + +Username of the 'admin' user can be overridden be providing the variable QPID_ADMIN_USER on start, and the default +password of the 'admin' user can be overridden be providing the variable QPID_ADMIN_PASSWORD on start: -User 'admin' has read and write access to all broker objects. -User 'guest' has read-only access to all broker objects, can not send or consume messages. +``` +docker run -d -p 5672:5672 -p 8080:8080 -v :/qpid-broker-j/work -e QPID_ADMIN_USER=myuser -e QPID_ADMIN_PASSWORD=mypassword --name qpid +``` Further broker users as well as other broker objects (queues, exchanges, keystores, truststore, ports etc.) can be created via HTTP management interface. Description of the broker REST API can be found in broker book (chapter 6.3). @@ -101,25 +107,39 @@ curl -d '{"password": ""}' http://admin:admin@localhost:8080/api/l To customize broker before building the container image, its configuration files may be edited to start broker with queues, exchanges, users or other objects. -The file config.json contains definitions of the broker objects and references a file containing definitions +The file config.json contains definitions of the broker objects and references a file containing definitions of virtualhost objects (exchanges and queues). -It may be helpful first to create broker objects needed via broker web GUI or via REST API, and then investigate the +It may be helpful first to create broker objects needed via broker web GUI or via REST API, and then investigate the configuration files and copy the appropriate definitions to the configuration files used for container image creation. +An example of the default initial configuration JSON file is provided in broker book (chapter 5.7). + ### Exchanges To create exchanges a JSON element "exchanges" should be created containing an array of single exchange definitions: ``` "exchanges" : [ { - "name" : "request.QUEUE1", - "type" : "topic", - "durable" : true, - "durableBindings" : [ { - "arguments" : { }, - "destination" : "QUEUE1", - "bindingKey" : "#" + "name" : "amq.direct", + "type" : "direct" + }, { + "name" : "amq.fanout", + "type" : "fanout" + }, { + "name" : "amq.match", + "type" : "headers" + }, { + "name" : "amq.topic", + "type" : "topic" + }, { + "name" : "request.QUEUE1", + "type" : "topic", + "durable" : true, + "durableBindings" : [ { + "arguments" : { }, + "destination" : "QUEUE1", + "bindingKey" : "#" } ], "unroutableMessageBehaviour" : "REJECT" } @@ -128,7 +148,7 @@ To create exchanges a JSON element "exchanges" should be created containing an a Information about exchanges, their types and properties can be found in broker book (chapter 4.6). -Please note that each virtualhost pre-declares several exchanges, described in the broker book (chapter 4.6.1). +Please note that each virtualhost pre-declares several exchanges, described in the broker book (chapter 4.6.1). ### Queues @@ -157,7 +177,6 @@ To create queue a JSON element "queues" should be created containing an array of Information about queues, their types and properties can be found in broker book (chapter 4.7). - ### Users Users can be defined in an authentication provider. Authentication providers are defined on broker level (file config.json). @@ -172,7 +191,7 @@ Examples for most commonly used authentication providers can be found below. "authenticationproviders" : [ { "name" : "anon", "type" : "Anonymous" - } ], + } ] ``` For additional details see broker book (chapter 8.1.5). @@ -187,12 +206,37 @@ For additional details see broker book (chapter 8.1.5). "name" : "admin", "type" : "managed", "password" : "" - }, { - "name" : "guest", - "type" : "managed", - "password" : "" } ] - } ], + } ] ``` For additional details see broker book (chapter 8.1.7). + +#### ACL Rules + +The ACL rules for users are defined in file broker.acl following the syntax: + +``` +ACL {permission} {||ALL} {action|ALL} [object|ALL] [property=] +``` + +The predefined broker.acl file contains permissions for the 'admin' user: + +``` +# account 'admin' - enabled all actions +ACL ALLOW-LOG QPID_ADMIN_USER ALL ALL +``` + +For additional details see broker book (chapter 8.3.2). + +### Overriding Broker Configuration + +Customized configuration for the Broker-J instance can be used by replacing the files residing in the work folder with +the custom ones, e.g. config.json or default.json. Put the replacement files inside a folder and map it as a volume to: + +``` +docker run -d -p 5672:5672 -p 8080:8080 -v :/qpid-broker-j/work-override:Z --name qpid +``` + +The contents of work-override folder will be copied over to work folder first time after the instance creation so that +the broker will start with user-supplied configuration. \ No newline at end of file diff --git a/qpid-docker/broker.acl b/qpid-docker/broker.acl index 656a15f24f..7ab82ca278 100644 --- a/qpid-docker/broker.acl +++ b/qpid-docker/broker.acl @@ -16,8 +16,4 @@ # under the License. # account 'admin' - enabled all actions -ACL ALLOW-LOG admin ALL ALL - -# account 'guest' - enabled read-only access, cannot read/send messages -ACL DENY-LOG guest ACCESS VIRTUALHOST -ACL ALLOW-LOG guest ACCESS ALL +ACL ALLOW-LOG QPID_ADMIN_USER ALL ALL diff --git a/qpid-docker/config.json b/qpid-docker/config.json index a9bad2a509..68565c573c 100644 --- a/qpid-docker/config.json +++ b/qpid-docker/config.json @@ -31,13 +31,9 @@ "type" : "Plain", "secureOnlyMechanisms" : [], "users" : [ { - "name" : "admin", + "name" : "${QPID_ADMIN_USER}", "type" : "managed", - "password" : "admin" - }, { - "name" : "guest", - "type" : "managed", - "password" : "guest" + "password" : "${QPID_ADMIN_PASSWORD}" }] } ], "brokerloggers" : [ { diff --git a/qpid-docker/docker-build.sh b/qpid-docker/docker-build.sh index 36670aae21..41103233ff 100644 --- a/qpid-docker/docker-build.sh +++ b/qpid-docker/docker-build.sh @@ -29,8 +29,8 @@ Usage: $MY_NAME [OPTION]... options: - --local-dist-path Path to the local Apache Qpid Broker-J distribution - --qpid-version Apache Qpid Broker-J version + --release Apache Qpid Broker-J release version to build with + --local-dist-path Path to the local Apache Qpid Broker-J distribution to build with --help, -h, -? Print this help and exit END_OF_HELP @@ -41,10 +41,10 @@ parse_parameters() while [ $# -gt 0 ]; do case $1 in --local-dist-path) - from_local=true + from_local_dist=true local_dist_path=$2 shift;; - --qpid-version) + --release) from_release=true qpid_version=$2 shift;; @@ -125,7 +125,7 @@ install() fi - elif [ -n "${from_local}" ]; then + elif [ -n "${from_local_dist}" ]; then qpid_dist_file_name=$(basename ${local_dist_path}) qpid_version=$(echo "$qpid_dist_file_name" | sed -e 's/apache-qpid-broker-j-\(.*\)-bin.tar.gz/\1/') @@ -151,6 +151,7 @@ install() cp ./*.json "$qpid_dist_dir/${qpid_version}/docker/" cp ./Containerfile "$qpid_dist_dir/${qpid_version}/docker/" cp -r $qpid_dist_dir/${qpid_version}/lib "$qpid_dist_dir/${qpid_version}/docker/" + cp ./entrypoint.sh "$qpid_dist_dir/${qpid_version}/docker/" } print_instruction() @@ -161,11 +162,16 @@ Well done! Now you can continue with building the Docker image: # Go to $qpid_dist_dir/${qpid_version}/docker/ $ cd $qpid_dist_dir/${qpid_version}/docker/ - $ docker build -f ./Containerfile -t qpid-alpine . -Note: -t qpid-alpine is just a tag name for the purpose of this guide + # For Ubuntu with JRE 17 + $ docker build -f ./Containerfile -t qpid-ubuntu . -For more info see readme.md + # For Alpine with JRE 17 + $ docker build -f ./Containerfile --build-arg OS_NAME=alpine -t qpid-alpine . + +Note: -t qpid-ubuntu and -t qpid-alpine are just a tag names for the purpose of this guide + +For more info see README.md HERE exit 0 diff --git a/qpid-docker/entrypoint.sh b/qpid-docker/entrypoint.sh new file mode 100644 index 0000000000..8af2430a58 --- /dev/null +++ b/qpid-docker/entrypoint.sh @@ -0,0 +1,36 @@ +#!/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 container create" or "docker run" is called. + +set -e + +if ! [ -f ./work/config.json ]; then + if [ -d ./work-init ]; then + for file in `ls ./work-init`; do echo copying file to work folder: $file; cp ./work-init/$file ./work || :; done + fi + sed -i "s/QPID_ADMIN_USER/${QPID_ADMIN_USER}/g" /qpid-broker-j/work/broker.acl + if [ -d ./work-override ]; then + for file in `ls ./work-override`; do echo copying file to work folder: $file; cp ./work-override/$file ./work || :; done + fi +else + echo "skipping broker instance creation; instance already exists" +fi + +exec java -server $JAVA_GC $JAVA_MEM $JAVA_OPTS -DQPID_HOME=/qpid-broker-j -DQPID_WORK=/qpid-broker-j/work -cp "/qpid-broker-j/lib/*" org.apache.qpid.server.Main \ No newline at end of file