From 1221a7ba0c0eb69891fa1d2272711e98b0f90c4b Mon Sep 17 00:00:00 2001 From: Anders Gunnarsson Date: Thu, 8 Nov 2018 11:42:07 +0100 Subject: [PATCH 1/5] Closed que and topic tags in config template --- root/opt/confd/etc/templates/activemq.xml.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/root/opt/confd/etc/templates/activemq.xml.tmpl b/root/opt/confd/etc/templates/activemq.xml.tmpl index a6269b3..c584be6 100644 --- a/root/opt/confd/etc/templates/activemq.xml.tmpl +++ b/root/opt/confd/etc/templates/activemq.xml.tmpl @@ -146,10 +146,10 @@ {{- if or (ge (len (ls "/config/topics")) 1) (ge (len (ls "/config/queues")) 1)}} {{- range $i, $key := ls "/config/topics"}} - {{- end}} {{- range $i, $key := ls "/config/queues"}} - {{- end}} {{- end}} @@ -164,4 +164,4 @@ - \ No newline at end of file + From 3295426395796037ae5835769d2fd31429ae4363 Mon Sep 17 00:00:00 2001 From: Anders Gunnarsson Date: Thu, 8 Nov 2018 11:43:28 +0100 Subject: [PATCH 2/5] Updated activemq version and download url --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4a2f221..4fb6a2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ENV CONFD_PREFIX_KEY="/activemq" \ S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \ LANG="en_US.utf8" \ APP_HOME="/opt/activemq" \ - APP_VERSION="5.15.2" \ + APP_VERSION="5.15.7" \ SCHEDULER_VOLUME="/opt/scheduler" \ USER=activemq \ GROUP=activemq \ @@ -39,7 +39,7 @@ RUN curl -sL https://github.com/just-containers/s6-overlay/releases/download/v1. # Install ActiveMQ software RUN \ mkdir -p ${APP_HOME} /data /var/log/activemq && \ - curl http://apache.mirrors.ovh.net/ftp.apache.org/dist/activemq/${APP_VERSION}/apache-activemq-${APP_VERSION}-bin.tar.gz -o /tmp/activemq.tar.gz &&\ + curl http://archive.apache.org/dist/activemq/${APP_VERSION}/apache-activemq-${APP_VERSION}-bin.tar.gz -o /tmp/activemq.tar.gz &&\ tar -xzf /tmp/activemq.tar.gz -C /tmp &&\ mv /tmp/apache-activemq-${APP_VERSION}/* ${APP_HOME} &&\ rm -rf /tmp/activemq.tar.gz &&\ @@ -63,4 +63,4 @@ EXPOSE 61614 VOLUME ["/data", "/var/log/activemq"] WORKDIR ${APP_HOME} -CMD ["/init"] \ No newline at end of file +CMD ["/init"] From dff85db3c4ff1ec2e6fbc549ac2e706b43eb4d1b Mon Sep 17 00:00:00 2001 From: Anders Gunnarsson Date: Mon, 12 Nov 2018 13:06:06 +0100 Subject: [PATCH 3/5] Move settings from wrapper.conf to env --- root/etc/cont-init.d/101-gen-confd-config.sh | 8 +- root/opt/confd/etc/templates/env.tmpl | 115 ++++++++++++++ .../opt/confd/etc/templates/wrapper.conf.tmpl | 148 ------------------ 3 files changed, 119 insertions(+), 152 deletions(-) create mode 100644 root/opt/confd/etc/templates/env.tmpl delete mode 100644 root/opt/confd/etc/templates/wrapper.conf.tmpl diff --git a/root/etc/cont-init.d/101-gen-confd-config.sh b/root/etc/cont-init.d/101-gen-confd-config.sh index 11846ba..553cb27 100644 --- a/root/etc/cont-init.d/101-gen-confd-config.sh +++ b/root/etc/cont-init.d/101-gen-confd-config.sh @@ -100,12 +100,12 @@ keys = [ ] EOF -cat << EOF > ${CONFD_HOME}/etc/conf.d/wrapper.conf.toml +cat << EOF > ${CONFD_HOME}/etc/conf.d/env.toml [template] prefix = "${CONFD_PREFIX_KEY}" -src = "wrapper.conf.tmpl" -dest = "${APP_HOME}/bin/linux-x86-64/wrapper.conf" -mode = "0744" +src = "env.tmpl" +dest = "${APP_HOME}/bin/env" +mode = "0644" gid = $GID uid = $UID keys = [ diff --git a/root/opt/confd/etc/templates/env.tmpl b/root/opt/confd/etc/templates/env.tmpl new file mode 100644 index 0000000..7c0b1de --- /dev/null +++ b/root/opt/confd/etc/templates/env.tmpl @@ -0,0 +1,115 @@ +#!/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. +# ------------------------------------------------------------------------ +# +# Configuration file for running Apache Active MQ as standalone provider. +# +# This file overwrites the predefined settings of the sysv init-script. +# You can also use alternate location for default settings - +# invoke the init-script without a argument an review help section "Configuration of this script" +# /etc/default/activemq /.activemqrc /bin/env + +# Active MQ installation dirs +# ACTIVEMQ_HOME="/" +# ACTIVEMQ_BASE="$ACTIVEMQ_HOME" +# ACTIVEMQ_CONF="$ACTIVEMQ_BASE/conf" +# ACTIVEMQ_DATA="$ACTIVEMQ_BASE/data" +# ACTIVEMQ_TMP="$ACTIVEMQ_BASE/tmp" + +# Set jvm memory configuration (minimal/maximum amount of memory) +ACTIVEMQ_OPTS_MEMORY="-Xms{{getv "/config/minmemory" "128"}}M -Xmx{{getv "/config/maxmemory" "1024"}}M" + +if [ -z "$ACTIVEMQ_OPTS" ] ; then + ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config" +fi + +if [ -z "$ACTIVEMQ_OUT" ]; then + ACTIVEMQ_OUT="/dev/null" +fi + +# Uncomment to enable audit logging +#ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS -Dorg.apache.activemq.audit=true" + +# Set jvm jmx configuration +# This enables jmx access over a configured jmx-tcp-port. +# You have to configure the first four settings if you run a ibm jvm, caused by the +# fact that IBM's jvm does not support VirtualMachine.attach(PID). +# JMX access is needed for quering a running activemq instance to gain data or to +# trigger management operations. +# +# Example for ${ACTIVEMQ_CONF}/jmx.access: +# --- +# # The "monitorRole" role has readonly access. +# # The "controlRole" role has readwrite access. +# monitorRole readonly +# controlRole readwrite +# --- +# +# Example for ${ACTIVEMQ_CONF}/jmx.password: +# --- +# # The "monitorRole" role has password "abc123". +# # # The "controlRole" role has password "abcd1234". +# monitorRole abc123 +# controlRole abcd1234 +# --- +# +# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port=11099 " +# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password" +# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access" +# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false" +ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote" + +# Set jvm jmx configuration for controlling the broker process +# You only have to configure the first four settings if you run a ibm jvm, caused by the +# fact that IBM's jvm does not support VirtualMachine.attach(PID) +# (see also com.sun.management.jmxremote.port, .jmx.password.file and .jmx.access.file ) +#ACTIVEMQ_SUNJMX_CONTROL="--jmxurl service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/jmxrmi --jmxuser controlRole --jmxpassword abcd1234" +ACTIVEMQ_SUNJMX_CONTROL="" + +# Specify the queue manager URL for using "browse" option of sysv initscript +if [ -z "$ACTIVEMQ_QUEUEMANAGERURL" ]; then + ACTIVEMQ_QUEUEMANAGERURL="--amqurl tcp://localhost:61616" +fi + +# Set additional JSE arguments +if [ -z "$ACTIVEMQ_SSL_OPTS" ] ; then + #ACTIVEMQ_SSL_OPTS="-Djava.security.properties=$ACTIVEMQ_CONF/java.security" + ACTIVEMQ_SSL_OPTS="" +fi + +# Uncomment to enable remote debugging +#ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" + +# ActiveMQ tries to shutdown the broker by jmx, +# after a specified number of seconds send SIGKILL +if [ -z "$ACTIVEMQ_KILL_MAXSECONDS" ]; then + ACTIVEMQ_KILL_MAXSECONDS=30 +fi + +# Configure a user with non root privileges, if no user is specified do not change user +# (the entire activemq installation should be owned by this user) +ACTIVEMQ_USER="" + +# location of the pidfile +# ACTIVEMQ_PIDFILE="$ACTIVEMQ_DATA/activemq.pid" + +# Location of the java installation +# Specify the location of your java installation using JAVA_HOME, or specify the +# path to the "java" binary using JAVACMD +# (set JAVACMD to "auto" for automatic detection) +#JAVA_HOME="" +JAVACMD="auto" diff --git a/root/opt/confd/etc/templates/wrapper.conf.tmpl b/root/opt/confd/etc/templates/wrapper.conf.tmpl deleted file mode 100644 index ef2d606..0000000 --- a/root/opt/confd/etc/templates/wrapper.conf.tmpl +++ /dev/null @@ -1,148 +0,0 @@ -# ------------------------------------------------------------------------ -# 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. -# ------------------------------------------------------------------------ - -#******************************************************************** -# Wrapper Properties -#******************************************************************** - -# wrapper.debug=TRUE -set.default.ACTIVEMQ_HOME=../.. -set.default.ACTIVEMQ_BASE=../.. -set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf -set.default.ACTIVEMQ_DATA=/data -wrapper.working.dir=. - -# Java Application -wrapper.java.command=java - -# Java Main class. This class must implement the WrapperListener interface -# or guarantee that the WrapperManager class is initialized. Helper -# classes are provided to do this for you. See the Integration section -# of the documentation for details. -wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp - -# Java Classpath (include wrapper.jar) Add class path elements as -# needed starting from 1 -wrapper.java.classpath.1=%ACTIVEMQ_HOME%/bin/wrapper.jar -wrapper.java.classpath.2=%ACTIVEMQ_HOME%/bin/activemq.jar - -# Java Library Path (location of Wrapper.DLL or libwrapper.so) -wrapper.java.library.path.1=%ACTIVEMQ_HOME%/bin/win64 - -# Java Additional Parameters -# note that n is the parameter number starting from 1. -wrapper.java.additional.1=-Dactivemq.home="%ACTIVEMQ_HOME%" -wrapper.java.additional.2=-Dactivemq.base="%ACTIVEMQ_BASE%" -wrapper.java.additional.3=-Djavax.net.ssl.keyStorePassword=password -wrapper.java.additional.4=-Djavax.net.ssl.trustStorePassword=password -wrapper.java.additional.5=-Djavax.net.ssl.keyStore="%ACTIVEMQ_CONF%/broker.ks" -wrapper.java.additional.6=-Djavax.net.ssl.trustStore="%ACTIVEMQ_CONF%/broker.ts" -wrapper.java.additional.7=-Dcom.sun.management.jmxremote -wrapper.java.additional.8=-Dorg.apache.activemq.UseDedicatedTaskRunner=true -wrapper.java.additional.9=-Djava.util.logging.config.file=logging.properties -wrapper.java.additional.10=-Dactivemq.conf="%ACTIVEMQ_CONF%" -wrapper.java.additional.11=-Dactivemq.data="%ACTIVEMQ_DATA%" -wrapper.java.additional.12=-Djava.security.auth.login.config="%ACTIVEMQ_CONF%/login.config" - -# Uncomment to enable remote jmx -#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.port=1616 -#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.authenticate=false -#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.ssl=false - -# Uncomment to enable YourKit profiling -#wrapper.java.additional.n=-Xrunyjpagent - -# Uncomment to enable remote debugging -#wrapper.java.additional.n=-Xdebug -Xnoagent -Djava.compiler=NONE -#wrapper.java.additional.n=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 - -# Initial Java Heap Size (in MB) -{{- if (exists "/config/minmemory")}} -wrapper.java.initmemory={{getv "/config/minmemory"}} -{{- else}} -#wrapper.java.initmemory=3 -{{- end}} - -# Maximum Java Heap Size (in MB) -wrapper.java.maxmemory={{getv "/config/maxmemory" "1024"}} - -# Application parameters. Add parameters as needed starting from 1 -wrapper.app.parameter.1=org.apache.activemq.console.Main -wrapper.app.parameter.2=start - -#******************************************************************** -# Wrapper Logging Properties -#******************************************************************** -# Format of output for the console. (See docs for formats) -wrapper.console.format=PM - -# Log Level for console output. (See docs for log levels) -wrapper.console.loglevel=INFO - -# Log file to use for wrapper output logging. -wrapper.logfile=/var/log/activemq/wrapper.log - -# Format of output for the log file. (See docs for formats) -wrapper.logfile.format=LPTM - -# Log Level for log file output. (See docs for log levels) -wrapper.logfile.loglevel=INFO - -# Maximum size that the log file will be allowed to grow to before -# the log is rolled. Size is specified in bytes. The default value -# of 0, disables log rolling. May abbreviate with the 'k' (kb) or -# 'm' (mb) suffix. For example: 10m = 10 megabytes. -wrapper.logfile.maxsize=0 - -# Maximum number of rolled log files which will be allowed before old -# files are deleted. The default value of 0 implies no limit. -wrapper.logfile.maxfiles=0 - -# Log Level for sys/event log output. (See docs for log levels) -wrapper.syslog.loglevel=NONE - -#******************************************************************** -# Wrapper Windows Properties -#******************************************************************** -# Title to use when running as a console -wrapper.console.title=ActiveMQ - -#******************************************************************** -# Wrapper Windows NT/2000/XP Service Properties -#******************************************************************** -# WARNING - Do not modify any of these properties when an application -# using this configuration file has been installed as a service. -# Please uninstall the service before modifying this section. The -# service can then be reinstalled. - -# Name of the service -wrapper.ntservice.name=ActiveMQ - -# Display name of the service -wrapper.ntservice.displayname=ActiveMQ - -# Description of the service -wrapper.ntservice.description=ActiveMQ Broker - -# Service dependencies. Add dependencies as needed starting from 1 -wrapper.ntservice.dependency.1= - -# Mode in which the service is installed. AUTO_START or DEMAND_START -wrapper.ntservice.starttype=AUTO_START - -# Allow the service to interact with the desktop. -wrapper.ntservice.interactive=false \ No newline at end of file From e523644d584ef16d57bb9a62a89acf74c4550c49 Mon Sep 17 00:00:00 2001 From: Anders Gunnarsson Date: Mon, 12 Nov 2018 15:17:26 +0100 Subject: [PATCH 4/5] Fix typos in the documentation --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cb34f43..616df9c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ docker run --name='activemq' -it --rm \ -P webcenter/activemq:latest ``` -This sample lauch ActiveMQ in docker with 512 MB of memory, and then ACtiveMQ can take 2048 MB of max memory +This sample lauch ActiveMQ in docker with 512 MB of memory, and then ActiveMQ can take 2048 MB of max memory ## Storage @@ -189,7 +189,7 @@ You can use the following variables to limit the disk usage: ## JMX You can control JMX access with the following variables: -- `ACTIVEMQ_JMX_X_ROLE`: Where X is the username and the value is the role (read or readwrite) +- `ACTIVEMQ_JMX_X_ROLE`: Where X is the username and the value is the role (readonly or readwrite) - `ACTIVEMQ_JMX_X_PASSWORD`: Where X is the username and the value is the password ## Avaible Configuration Parameters @@ -227,8 +227,8 @@ Below is the complete list of available options that can be used to customize yo - **ACTIVEMQ_JMX_X_ROLE**: Where X is the username and role is the value. - **ACTIVEMQ_JMX_X_PASSWORD**: Where X is the username and password is the value. -- **ACTIVEMQ_CONFIG_TOPICS_X**: Where X is the logical topics name (wihtout special char) and real topic name is the value. -- **ACTIVEMQ_CONFIG_QUEUES_X**: Where X is the logical queue name (wihtout special char) and real queue name is the value. +- **ACTIVEMQ_CONFIG_TOPICS_X**: Where X is the logical topics name (without special char) and real topic name is the value. +- **ACTIVEMQ_CONFIG_QUEUES_X**: Where X is the logical queue name (without special char) and real queue name is the value. ## Advance configuration @@ -237,4 +237,4 @@ For advance configuration, the best way is to read ActiveMQ documentation and cr Next, you can mount it when you run this image or you can create your own image (base on this image) and include your specifics config file. The home of ActiveMQ is in /opt/activemq, so if you want to override all the setting, you can launch docker with ` -v /your_path/conf:/opt/activemq/conf`. -If you overload the config, don't forget to disable confd or change the template instead to change activemq config `/opt/confd/etc/templates`. \ No newline at end of file +If you overload the config, don't forget to disable confd or change the template instead to change activemq config `/opt/confd/etc/templates`. From 6d6c41bc64473c85e518f325e45d4dbeb7b9703f Mon Sep 17 00:00:00 2001 From: Anders Gunnarsson Date: Mon, 12 Nov 2018 15:41:05 +0100 Subject: [PATCH 5/5] Enable remote JMX connections --- README.md | 5 ++++- root/opt/confd/etc/templates/env.tmpl | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 616df9c..82dd30a 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,10 @@ Below is the complete list of available options that can be used to customize yo - **ACTIVEMQ_GROUPS_X**: Where X is the group and list user separated by a comma is the value. - **ACTIVEMQ_JMX_X_ROLE**: Where X is the username and role is the value. - **ACTIVEMQ_JMX_X_PASSWORD**: Where X is the username and password is the value. - +- **ACTIVEMQ_CONFIG_JMX_REMOTE_PORT**: Enable remote jmx through this port. +- **ACTIVEMQ_CONFIG_JMX_REMOTE_SSL**: Set if jmx port should use ssl. Default is `false`. +- **ACTIVEMQ_CONFIG_JMX_REMOTE_RMIPORT**: Set a static rmi port for jmx, which is needed to be able to expose the port. Default is `1617`. +- **ACTIVEMQ_CONFIG_RMI_HOSTNAME**: Set hostname to associate with remote stubs. Default is `localhost`. - **ACTIVEMQ_CONFIG_TOPICS_X**: Where X is the logical topics name (without special char) and real topic name is the value. - **ACTIVEMQ_CONFIG_QUEUES_X**: Where X is the logical queue name (without special char) and real queue name is the value. diff --git a/root/opt/confd/etc/templates/env.tmpl b/root/opt/confd/etc/templates/env.tmpl index 7c0b1de..f3e4739 100644 --- a/root/opt/confd/etc/templates/env.tmpl +++ b/root/opt/confd/etc/templates/env.tmpl @@ -67,11 +67,16 @@ fi # controlRole abcd1234 # --- # -# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port=11099 " -# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password" -# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access" -# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false" +{{ if (exists "/config/jmx/remote/port") }} +ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port={{getv "/config/jmx/remote/port"}}" +ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password" +ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access" +ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl={{getv "/config/jmx/remote/ssl" "false"}}" +ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.rmi.port={{getv "/config/jmx/remote/rmiport" "1617"}}" +ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Djava.rmi.server.hostname={{getv "/config/rmi/hostname" "localhost"}}" +{{else}} ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote" +{{end}} # Set jvm jmx configuration for controlling the broker process # You only have to configure the first four settings if you run a ibm jvm, caused by the