From commits-return-55012-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Tue Feb 5 18:57:49 2019 Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6DD6518AEE for ; Tue, 5 Feb 2019 18:57:49 +0000 (UTC) Received: (qmail 2219 invoked by uid 500); 5 Feb 2019 18:57:49 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 2183 invoked by uid 500); 5 Feb 2019 18:57:49 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 2174 invoked by uid 99); 5 Feb 2019 18:57:49 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2019 18:57:49 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 84A11881FD; Tue, 5 Feb 2019 18:57:48 +0000 (UTC) Date: Tue, 05 Feb 2019 18:57:48 +0000 To: "commits@activemq.apache.org" Subject: [activemq-artemis] 01/05: ARTEMIS-2245 Implement Docker images MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: clebertsuconic@apache.org In-Reply-To: <154939306780.2279.10128863552581445306@gitbox.apache.org> References: <154939306780.2279.10128863552581445306@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: activemq-artemis X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: f2a2d6d99fcffccddec411fbff50c655c3ba1dd1 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20190205185748.84A11881FD@gitbox.apache.org> 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 commit f2a2d6d99fcffccddec411fbff50c655c3ba1dd1 Author: Clebert Suconic AuthorDate: Mon Oct 22 21:11:02 2018 -0400 ARTEMIS-2245 Implement Docker images --- .../activemq/artemis/cli/commands/Create.java | 10 ++ .../artemis/cli/commands/etc/jolokia-access.xml | 5 +- artemis-distribution/pom.xml | 15 ++- .../src/main/assembly/docker-assembly.xml | 40 ++++++++ .../src/main/resources/docker/Dockerfile | 101 +++++++++++++++++++++ .../resources/docker/assets/docker-entrypoint.sh | 18 ++++ 6 files changed, 185 insertions(+), 4 deletions(-) diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index cde6515..3982fac 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -119,6 +119,9 @@ public class Create extends InputAbstract { @Option(name = "--http-host", description = "The host name to use for embedded web server (Default: localhost)") private String httpHost = HTTP_HOST; + @Option(name = "--relax-jolokia", description = "disable strict checking on jolokia-access.xml") + private boolean relaxJolokia; + @Option(name = "--ping", description = "A comma separated string to be passed on to the broker config as network-check-list. The broker will shutdown when all these addresses are unreachable.") private String ping; @@ -774,6 +777,13 @@ public class Create extends InputAbstract { filters.remove("${artemis.instance}"); writeEtc(ETC_BOOTSTRAP_XML, etcFolder, filters, false); writeEtc(ETC_MANAGEMENT_XML, etcFolder, filters, false); + + if (relaxJolokia) { + filters.put("${jolokia.options}", ""); + } else { + filters.put("${jolokia.options}", "\n" + + " "); + } writeEtc(ETC_JOLOKIA_ACCESS_XML, etcFolder, filters, false); context.out.println(""); diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/jolokia-access.xml b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/jolokia-access.xml index aff5656..89aa41c 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/jolokia-access.xml +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/jolokia-access.xml @@ -26,8 +26,9 @@ under the License. *://${http.host}* - - + + + ${jolokia.options} \ No newline at end of file diff --git a/artemis-distribution/pom.xml b/artemis-distribution/pom.xml index af716cc..2618b09 100644 --- a/artemis-distribution/pom.xml +++ b/artemis-distribution/pom.xml @@ -242,7 +242,7 @@ maven-assembly-plugin ${maven.assembly.plugin.version} - + source src/main/assembly/source-assembly.xml @@ -254,7 +254,7 @@ - bin + bin src/main/assembly/dep.xml gnu @@ -264,6 +264,17 @@ single + + docker + + src/main/assembly/docker-assembly.xml + gnu + + package + + single + + diff --git a/artemis-distribution/src/main/assembly/docker-assembly.xml b/artemis-distribution/src/main/assembly/docker-assembly.xml new file mode 100644 index 0000000..054bd6b --- /dev/null +++ b/artemis-distribution/src/main/assembly/docker-assembly.xml @@ -0,0 +1,40 @@ + + + + + docker + + dir + + false + + + + ${activemq.basedir}/artemis-distribution/target/apache-artemis-${project.version}-bin/apache-artemis-${project.version} + /build/opt/activemq-artemis + true + + + src/main/resources/docker + /build + true + + + diff --git a/artemis-distribution/src/main/resources/docker/Dockerfile b/artemis-distribution/src/main/resources/docker/Dockerfile new file mode 100644 index 0000000..ae34d14 --- /dev/null +++ b/artemis-distribution/src/main/resources/docker/Dockerfile @@ -0,0 +1,101 @@ +# ActiveMQ Artemis + +########################################################## +## Build Image # +########################################################## +FROM openjdk:8u171-jdk-stretch as builder +LABEL maintainer="Apache ActiveMQ Team" + +ENV JMX_EXPORTER_VERSION=0.3.1 +ENV JGROUPS_KUBERNETES_VERSION=0.9.3 + +# See https://github.com/hadolint/hadolint/wiki/DL4006 +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +RUN apt-get -qq -o=Dpkg::Use-Pty=0 update && \ + apt-get -qq -o=Dpkg::Use-Pty=0 install -y --no-install-recommends \ + libaio1=0.3.110-3 \ + xmlstarlet=1.6.1-2 \ + jq=1.5+dfsg-1.3 \ + ca-certificates=20161130+nmu1+deb9u1 \ + wget=1.18-5+deb9u2 + +# I like to be able to verify files within a docker container +RUN apt-get install -y vim +RUN apt-get install -y screen +#RUN rm -rf /var/lib/apt/lists/* + +# Make sure pipes are considered to detemine success, see: https://github.com/hadolint/hadolint/wiki/DL4006 +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Uncompress and validate +WORKDIR /opt + +########################################################## +## Run Image # +########################################################## +FROM openjdk:8 +LABEL maintainer="Apache ActiveMQ Team" + +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 + +# add user and group for artemis +RUN groupadd -g 1000 -r artemis && useradd -r -u 1000 -g artemis artemis + +RUN apt-get -qq -o=Dpkg::Use-Pty=0 update && \ + apt-get -qq -o=Dpkg::Use-Pty=0 install -y --no-install-recommends \ + libaio1=0.3.110-3 \ + xmlstarlet=1.6.1-2 \ + jq=1.5+dfsg-1.3 \ + gettext-base=0.19.8.1-2 \ + dumb-init=1.2.0-1 + +RUN apt-get install -y vim +RUN apt-get install -y screen + +RUN rm -rf /var/lib/apt/lists/* + +USER artemis + +COPY "/opt/activemq-artemis/" "/opt/activemq-artemis" + +# Web Server +EXPOSE 8161 + +# JMX Exporter +EXPOSE 9404 + +# Port for CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE +EXPOSE 61616 + +# Port for HORNETQ,STOMP +EXPOSE 5445 + +# Port for AMQP +EXPOSE 5672 + +# Port for MQTT +EXPOSE 1883 + +#Port for STOMP +EXPOSE 61613 + +USER root + +RUN mkdir /var/lib/artemis-instance +RUN chown -R artemis.artemis /var/lib/artemis-instance +COPY assets/docker-entrypoint.sh / + +USER artemis + + +# Expose some outstanding folders +VOLUME ["/var/lib/artemis-instance"] +WORKDIR /var/lib/artemis-instance + + +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["artemis-server"] diff --git a/artemis-distribution/src/main/resources/docker/assets/docker-entrypoint.sh b/artemis-distribution/src/main/resources/docker/assets/docker-entrypoint.sh new file mode 100755 index 0000000..cd4c3f4 --- /dev/null +++ b/artemis-distribution/src/main/resources/docker/assets/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +BROKER_HOME=/var/lib/ +CONFIG_PATH=$BROKER_HOME/etc +export BROKER_HOME OVERRIDE_PATH CONFIG_PATH + +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 + +./bin/artemis run + +