Skip to content

Commit 1696e1a

Browse files
committed
fix some bugs with init scripts
1 parent 3367bc2 commit 1696e1a

6 files changed

Lines changed: 192 additions & 32 deletions

File tree

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ VOLUME ["/data/activemq"]
4141
VOLUME ["/var/log/activemq"]
4242
VOLUME ["/opt/activemq/conf"]
4343

44-
WORKDIR /opt/activemq
44+
#WORKDIR /opt/activemq
4545

46-
ENTRYPOINT ["/app/init"]
47-
CMD ["/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf"]
46+
#ENTRYPOINT ["/app/init"]
47+
CMD ["/app/init", "start"]
4848

assets/bin/wrapper.conf

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# ------------------------------------------------------------------------
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ------------------------------------------------------------------------
17+
18+
#********************************************************************
19+
# Wrapper Properties
20+
#********************************************************************
21+
22+
#wrapper.debug=TRUE
23+
set.default.ACTIVEMQ_HOME=../..
24+
set.default.ACTIVEMQ_BASE=../..
25+
set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf
26+
set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data
27+
wrapper.working.dir=.
28+
29+
# Java Application
30+
wrapper.java.command=java
31+
32+
# Java Main class. This class must implement the WrapperListener interface
33+
# or guarantee that the WrapperManager class is initialized. Helper
34+
# classes are provided to do this for you. See the Integration section
35+
# of the documentation for details.
36+
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
37+
38+
# Java Classpath (include wrapper.jar) Add class path elements as
39+
# needed starting from 1
40+
wrapper.java.classpath.1=%ACTIVEMQ_HOME%/bin/wrapper.jar
41+
wrapper.java.classpath.2=%ACTIVEMQ_HOME%/bin/activemq.jar
42+
43+
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
44+
wrapper.java.library.path.1=%ACTIVEMQ_HOME%/bin/linux-x86-64/
45+
46+
# Java Additional Parameters
47+
# note that n is the parameter number starting from 1.
48+
wrapper.java.additional.1=-Dactivemq.home=%ACTIVEMQ_HOME%
49+
wrapper.java.additional.2=-Dactivemq.base=%ACTIVEMQ_BASE%
50+
wrapper.java.additional.3=-Djavax.net.ssl.keyStorePassword=password
51+
wrapper.java.additional.4=-Djavax.net.ssl.trustStorePassword=password
52+
wrapper.java.additional.5=-Djavax.net.ssl.keyStore=%ACTIVEMQ_CONF%/broker.ks
53+
wrapper.java.additional.6=-Djavax.net.ssl.trustStore=%ACTIVEMQ_CONF%/broker.ts
54+
wrapper.java.additional.7=-Dcom.sun.management.jmxremote
55+
wrapper.java.additional.8=-Dorg.apache.activemq.UseDedicatedTaskRunner=true
56+
wrapper.java.additional.9=-Djava.util.logging.config.file=logging.properties
57+
wrapper.java.additional.10=-Dactivemq.conf=%ACTIVEMQ_CONF%
58+
wrapper.java.additional.11=-Dactivemq.data=%ACTIVEMQ_DATA%
59+
wrapper.java.additional.12=-Djava.security.auth.login.config=%ACTIVEMQ_CONF%/login.config
60+
61+
# Uncomment to enable jmx
62+
#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.port=1616
63+
#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.authenticate=false
64+
#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.ssl=false
65+
66+
# Uncomment to enable YourKit profiling
67+
#wrapper.java.additional.n=-Xrunyjpagent
68+
69+
# Uncomment to enable remote debugging
70+
#wrapper.java.additional.n=-Xdebug -Xnoagent -Djava.compiler=NONE
71+
#wrapper.java.additional.n=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
72+
73+
# Initial Java Heap Size (in MB)
74+
#wrapper.java.initmemory=3
75+
76+
# Maximum Java Heap Size (in MB)
77+
wrapper.java.maxmemory=1024
78+
79+
# Application parameters. Add parameters as needed starting from 1
80+
wrapper.app.parameter.1=org.apache.activemq.console.Main
81+
wrapper.app.parameter.2=start
82+
83+
#********************************************************************
84+
# Wrapper Logging Properties
85+
#********************************************************************
86+
# Format of output for the console. (See docs for formats)
87+
wrapper.console.format=PM
88+
89+
# Log Level for console output. (See docs for log levels)
90+
wrapper.console.loglevel=INFO
91+
92+
# Log file to use for wrapper output logging.
93+
wrapper.logfile=/var/log/activemq/wrapper.log
94+
95+
# Format of output for the log file. (See docs for formats)
96+
wrapper.logfile.format=LPTM
97+
98+
# Log Level for log file output. (See docs for log levels)
99+
wrapper.logfile.loglevel=INFO
100+
101+
# Maximum size that the log file will be allowed to grow to before
102+
# the log is rolled. Size is specified in bytes. The default value
103+
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
104+
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
105+
wrapper.logfile.maxsize=0
106+
107+
# Maximum number of rolled log files which will be allowed before old
108+
# files are deleted. The default value of 0 implies no limit.
109+
wrapper.logfile.maxfiles=0
110+
111+
# Log Level for sys/event log output. (See docs for log levels)
112+
wrapper.syslog.loglevel=NONE
113+
114+
#********************************************************************
115+
# Wrapper Windows Properties
116+
#********************************************************************
117+
# Title to use when running as a console
118+
wrapper.console.title=ActiveMQ
119+
120+
#********************************************************************
121+
# Wrapper Windows NT/2000/XP Service Properties
122+
#********************************************************************
123+
# WARNING - Do not modify any of these properties when an application
124+
# using this configuration file has been installed as a service.
125+
# Please uninstall the service before modifying this section. The
126+
# service can then be reinstalled.
127+
128+
# Name of the service
129+
wrapper.ntservice.name=ActiveMQ
130+
131+
# Display name of the service
132+
wrapper.ntservice.displayname=ActiveMQ
133+
134+
# Description of the service
135+
wrapper.ntservice.description=ActiveMQ Broker
136+
137+
# Service dependencies. Add dependencies as needed starting from 1
138+
wrapper.ntservice.dependency.1=
139+
140+
# Mode in which the service is installed. AUTO_START or DEMAND_START
141+
wrapper.ntservice.starttype=AUTO_START
142+
143+
# Allow the service to interact with the desktop.
144+
wrapper.ntservice.interactive=false

assets/config/activemq.xml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -124,23 +124,26 @@
124124

125125
{{ACTIVEMQ_PERSISTENT_DESTINATION}}
126126

127-
<authorizationPlugin>
128-
<map>
129-
<authorizationMap>
130-
<authorizationEntries>
131-
<authorizationEntry queue=">" read="admins,reads,writes,owners" write="admins,writes,owners" admin="admins,owners" />
132-
<authorizationEntry topic=">" read="admins,reads,writes,owners" write="admins,writes,owners" admin="admins,owners" />
133-
<authorizationEntry topic="ActiveMQ.Advisory.>" read="admins,reads,writes,owners" write="admins,reads,writes,owners" admin="admins,reads,writes,owners"/>
134-
</authorizationEntries>
127+
<plugins>
128+
<!-- use JAAS to authenticate using the login.config file on the classpath to configure JAAS -->
129+
<jaasAuthenticationPlugin configuration="activemq-domain" />
130+
<authorizationPlugin>
131+
<map>
132+
<authorizationMap>
133+
<authorizationEntries>
134+
<authorizationEntry queue=">" read="admins,reads,writes,owners" write="admins,writes,owners" admin="admins,owners" />
135+
<authorizationEntry topic=">" read="admins,reads,writes,owners" write="admins,writes,owners" admin="admins,owners" />
136+
<authorizationEntry topic="ActiveMQ.Advisory.>" read="admins,reads,writes,owners" write="admins,reads,writes,owners" admin="admins,reads,writes,owners"/>
137+
</authorizationEntries>
135138

136-
<!-- let's assign roles to temporary destinations. comment this entry if we don't want any roles assigned to temp destinations -->
137-
<tempDestinationAuthorizationEntry>
138-
<tempDestinationAuthorizationEntry read="tempDestinationAdmins" write="tempDestinationAdmins" admin="tempDestinationAdmins"/>
139-
</tempDestinationAuthorizationEntry>
140-
</authorizationMap>
141-
</map>
142-
</authorizationPlugin>
143-
139+
<!-- let's assign roles to temporary destinations. comment this entry if we don't want any roles assigned to temp destinations -->
140+
<tempDestinationAuthorizationEntry>
141+
<tempDestinationAuthorizationEntry read="tempDestinationAdmins" write="tempDestinationAdmins" admin="tempDestinationAdmins"/>
142+
</tempDestinationAuthorizationEntry>
143+
</authorizationMap>
144+
</map>
145+
</authorizationPlugin>
146+
</plugins>
144147

145148
</broker>
146149

assets/config/log4j.properties

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ log4j.appender.console.layout.ConversionPattern=%5p | %m%n
4343
log4j.appender.console.threshold=INFO
4444

4545
# File appender
46-
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
47-
log4j.appender.logfile.file=/var/log/activemq.log
48-
log4j.appender.logfile.maxFileSize=1024KB
49-
log4j.appender.logfile.maxBackupIndex=5
46+
log4j.appender.logfile=org.apache.log4j.FileAppender
47+
log4j.appender.logfile.file=/var/log/activemq/activemq.log
5048
log4j.appender.logfile.append=true
5149
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
5250
log4j.appender.logfile.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
@@ -69,10 +67,8 @@ log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
6967
log4j.additivity.org.apache.activemq.audit=false
7068
log4j.logger.org.apache.activemq.audit={{ACTIVEMQ_LOGLEVEL}}, audit
7169

72-
log4j.appender.audit=org.apache.log4j.RollingFileAppender
73-
log4j.appender.audit.file=/var/log/audit.log
74-
log4j.appender.audit.maxFileSize=1024KB
75-
log4j.appender.audit.maxBackupIndex=5
70+
log4j.appender.audit=org.apache.log4j.FileAppender
71+
log4j.appender.audit.file=/var/log/activemq/audit.log
7672
log4j.appender.audit.append=true
7773
log4j.appender.audit.layout=org.apache.log4j.PatternLayout
7874
log4j.appender.audit.layout.ConversionPattern=%-5p | %m | %t%n

assets/init

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ set -e
44

55
SETUP_DIR="/app/setup"
66
ACTIVEMQ_HOME="/opt/activemq"
7-
7+
ACTIVEMQ_DATA="/data/activemq"
8+
ACTIVEMQ_CONF="${ACTIVEMQ_HOME}/conf"
9+
ACTIVEMQ_LOG="/var/log/activemq"
810

911

1012
# ActiveMQ setting
@@ -105,7 +107,20 @@ if [ "${ACTIVEMQ_STATIC_QUEUES}X" != "X" ]; then
105107
fi
106108
if [ "${ACTIVEMQ_PERSISTENT_TOPIC}X" != "X" ] || [ "${ACTIVEMQ_PERSISTENT_QUEUE}X" != "X" ]; then
107109
sudo -u activemq -H sed 's/{{ACTIVEMQ_PERSISTENT_DESTINATION}}/'"<destinations>${ACTIVEMQ_PERSISTENT_QUEUE} ${ACTIVEMQ_PERSISTENT_TOPIC} </destinations>"'/' -i conf/activemq.xml
110+
else
111+
sudo -u activemq -H sed 's/{{ACTIVEMQ_PERSISTENT_DESTINATION}}/'""'/' -i conf/activemq.xml
108112
fi
109113

110114

115+
chown -R activemq:activemq ${ACTIVEMQ_DATA}
116+
chown -R activemq:activemq ${ACTIVEMQ_LOG}
117+
chown -R activemq:activemq ${ACTIVEMQ_CONF}
118+
119+
case "$1" in
120+
start)
121+
/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
122+
;;
123+
esac
124+
111125

126+
exit 0

assets/setup/install

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ACTIVEMQ_VERSION=5.10.0
66
ACTIVEMQ_HOME="/opt/activemq"
77
SETUP_DIR="/app/setup"
88
LOG_DIR="/var/log"
9+
DATA_DIR="/data"
910

1011
# Start install
1112
mkdir -p ${ACTIVEMQ_HOME}
@@ -24,10 +25,11 @@ useradd --system --home ${ACTIVEMQ_HOME} -g activemq activemq
2425

2526
# we move folder dir to activemq
2627
cp ${SETUP_DIR}/config/* ${ACTIVEMQ_HOME}/conf/
27-
cp ${SETUP_DIR}/bin/* ${ACTIVEMQ_HOME}/bin/
28+
cp ${SETUP_DIR}/bin/* ${ACTIVEMQ_HOME}/bin/linux-x86-64/
2829

2930
chown -R activemq:activemq ${ACTIVEMQ_HOME}
30-
31+
chown -R activemq:activemq ${DATA_DIR}/activemq
32+
chown -R activemq:activemq ${LOG_DIR}/activemq
3133

3234

3335

@@ -80,6 +82,6 @@ command=/opt/activemq/bin/linux-x86-64/activemq console
8082
user=root
8183
autostart=true
8284
autorestart=true
83-
stdout_logfile=${GITLAB_LOG_DIR}/supervisor/%(program_name)s.log
84-
stderr_logfile=${GITLAB_LOG_DIR}/supervisor/%(program_name)s.log
85+
stdout_logfile=${LOG_DIR}/supervisor/%(program_name)s.log
86+
stderr_logfile=${LOG_DIR}/supervisor/%(program_name)s.log
8587
EOF

0 commit comments

Comments
 (0)