Skip to content
This repository was archived by the owner on May 5, 2020. It is now read-only.

Commit 2fbbdd8

Browse files
authored
Merge pull request #76 from ibm-messaging/v3
V3
2 parents b8be6ed + 61e2c2c commit 2fbbdd8

15 files changed

+363
-183
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change log
22

3+
## 3.0.0 (2017-06-08)
4+
### Action required
5+
* Updated to install Ubuntu `.deb` files - Any changes to the `MQ_PACKAGES` variable will now need to use the new package names (for example, "ibmmq-web" instead of "MQSeriesWeb")
6+
7+
### Other notable changes
8+
* Updated to MQ V9.0.3
9+
* Migrated from `amqicdir` to new official `crtmqdir` utility
10+
* Restructured startup scripts
11+
* Removed fixed UID numbers for developer config
12+
* Use HTTPS for MQ installer download
13+
* Reduced image size by purging 32-bit libraries
14+
315
## 2.0.0 (2017-03-11)
416
### Action required
517
* Ensure that you use the `REPLACE` keyword in all of your `DEFINE` MQSC statements. With this change, any supplied MQSC files are run *every* time the queue manager runs. This allows you to update the MQSC file, re-build the image, and then have the changes applied when you start a container based on that new image.

Dockerfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,25 @@
1414

1515
FROM ubuntu:16.04
1616

17-
LABEL maintainer "Arthur Barr <arthur.barr@uk.ibm.com>"
17+
LABEL maintainer "Arthur Barr <arthur.barr@uk.ibm.com>, Rob Parker <PARROBE@uk.ibm.com>"
1818

1919
# The URL to download the MQ installer from in tar.gz format
20-
ARG MQ_URL=http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev901_linux_x86-64.tar.gz
20+
ARG MQ_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev903_ubuntu_x86-64.tar.gz
2121

2222
# The MQ packages to install
23-
ARG MQ_PACKAGES="MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesMsg*.rpm MQSeriesJava*.rpm MQSeriesJRE*.rpm MQSeriesGSKit*.rpm MQSeriesWeb*.rpm"
23+
ARG MQ_PACKAGES="ibmmq-server ibmmq-java ibmmq-jre ibmmq-gskit ibmmq-web ibmmq-msg-.*"
2424

2525
RUN export DEBIAN_FRONTEND=noninteractive \
2626
# Install additional packages required by MQ, this install process and the runtime scripts
2727
&& apt-get update -y \
2828
&& apt-get install -y --no-install-recommends \
2929
bash \
3030
bc \
31+
ca-certificates \
3132
coreutils \
3233
curl \
3334
debianutils \
35+
file \
3436
findutils \
3537
gawk \
3638
grep \
@@ -39,7 +41,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \
3941
mount \
4042
passwd \
4143
procps \
42-
rpm \
4344
sed \
4445
tar \
4546
util-linux \
@@ -52,14 +53,22 @@ RUN export DEBIAN_FRONTEND=noninteractive \
5253
&& groupadd --gid 1000 mqm \
5354
&& useradd --uid 1000 --gid mqm mqm \
5455
&& usermod -G mqm root \
55-
&& cd /tmp/mq/MQServer \
56+
&& cd /tmp/mq/DebianMQServer \
5657
# Accept the MQ license
5758
&& ./mqlicense.sh -text_only -accept \
58-
# Install MQ using the RPM packages
59-
&& rpm -ivh --force-debian $MQ_PACKAGES \
59+
&& echo "deb [trusted=yes] file:/tmp/mq/DebianMQServer ./" > /etc/apt/sources.list.d/IBM_MQ.list \
60+
# Install MQ using the DEB packages
61+
&& apt-get update \
62+
&& apt-get install -y $MQ_PACKAGES \
63+
# Remove 32-bit libraries from 64-bit container
64+
&& find /opt/mqm /var/mqm -type f -exec file {} \; \
65+
| awk -F: '/ELF 32-bit/{print $1}' | xargs --no-run-if-empty rm -f \
66+
# Remove tar.gz files unpacked by RPM postinst scripts
67+
&& find /opt/mqm -name '*.tar.gz' -delete \
6068
# Recommended: Set the default MQ installation (makes the MQ commands available on the PATH)
6169
&& /opt/mqm/bin/setmqinst -p /opt/mqm -i \
6270
# Clean up all the downloaded files
71+
&& rm -f /etc/apt/sources.list.d/IBM_MQ.list \
6372
&& rm -rf /tmp/mq \
6473
# Apply any bug fixes not included in base Ubuntu or MQ image.
6574
# Don't upgrade everything based on Docker best practices https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Contents
22
* [Overview](#overview)
33
* [Docker Hub](#docker-hub)
4+
* [Bluemix Container Service](#bluemix-container-service)
45
* [Preparing your Docker host](#preparing-your-docker-host)
56
* [Build](#build)
67
* [Usage](#usage)
78
* [Running with the default configuration](#running-with-the-default-configuration)
8-
* [Running on Bluemix with volumes](#running-on-bluemix-with-volumes)
9+
* [Running on Bluemix with volumes](#running-on-ibm-bluemix-with-volumes)
910
* [Customizing the queue manager configuration](#customizing-the-queue-manager-configuration)
1011
* [Running MQ commands](#running-mq-commands)
1112
* [Installed components](#installed-components)
@@ -29,6 +30,11 @@ The image is available on Docker Hub as [`ibmcom/mq`](https://hub.docker.com/r/i
2930
* `cd`, `9-cd`, `9`, `latest` ([Dockerfile](https://github.com/ibm-messaging/mq-docker/blob/master/server/Dockerfile))
3031
* `lts`, `9-lts` ([Dockerfile](https://github.com/ibm-messaging/mq-docker/blob/mq-9-lts/Dockerfile))
3132
* `8` ([Dockerfile](https://github.com/ibm-messaging/mq-docker/blob/mq-8/Dockerfile))
33+
34+
# Bluemix Container Service
35+
This image is available on the Bluemix Container Service as a default image.
36+
37+
* `latest` ([catalog](https://console.eu-gb.bluemix.net/catalog/images/ibm-mq?env_id=ibm:yp:eu-gb))
3238

3339
# Preparing your Docker host
3440
You need to make sure that you either have a Linux kernel version of V3.16, or else you need to add the [`--ipc host`](http://docs.docker.com/reference/run/#ipc-settings) option when you run an MQ container. The reason for this is that IBM MQ uses shared memory, and on Linux kernels prior to V3.16, containers are usually limited to 32 MB of shared memory. In a [change](https://git.kernel.org/cgit/linux/kernel/git/mhocko/mm.git/commit/include/uapi/linux/shm.h?id=060028bac94bf60a65415d1d55a359c3a17d5c31

mq-configure-qmgr.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# -*- mode: sh -*-
3+
# © Copyright IBM Corporation 2015, 2017
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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+
# Turn off script failing here because of listeners failing the script
18+
19+
for MQSC_FILE in $(ls -v /etc/mqm/*.mqsc); do
20+
runmqsc ${MQ_QMGR_NAME} < ${MQSC_FILE}
21+
done

mq-create-qmgr.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
# -*- mode: sh -*-
3+
# © Copyright IBM Corporation 2015, 2017
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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+
set -e
18+
19+
if [ -z ${MQ_QMGR_NAME+x} ]; then
20+
# no ${MQ_QMGR_NAME} supplied so set Queue Manager name as the hostname
21+
# However make sure we remove any characters that are not valid.
22+
echo "Hostname is: $(hostname)"
23+
MQ_QMGR_NAME=`echo $(hostname) | sed 's/[^a-zA-Z0-9._%/]//g'`
24+
fi
25+
echo "Setting Queue Manager name to ${MQ_QMGR_NAME}"
26+
27+
QMGR_EXISTS=`dspmq | grep ${MQ_QMGR_NAME} > /dev/null ; echo $?`
28+
29+
if [ ${QMGR_EXISTS} -ne 0 ]; then
30+
MQ_DEV=${MQ_DEV:-"true"}
31+
if [ "${MQ_DEV}" == "true" ]; then
32+
# Turns on early adopt if we're using Developer defaults
33+
export AMQ_EXTRA_QM_STANZAS=Channels:ChlauthEarlyAdopt=Y
34+
fi
35+
crtmqm -q ${MQ_QMGR_NAME} || true
36+
fi

mq-dev-config.sh

Lines changed: 33 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,24 @@ set -e
1919

2020
configure_os_user()
2121
{
22-
# The UID of the user to configure
23-
local -r ID_NUM=$1
2422
# The group ID of the user to configure
25-
local -r GROUP_NUM=$2
23+
local -r GROUP_NAME=$1
2624
# Name of environment variable containing the user name
27-
local -r USER_VAR=$3
25+
local -r USER_VAR=$2
2826
# Name of environment variable containing the password
29-
local -r PASSWORD=$4
27+
local -r PASSWORD=$3
3028
# Home directory for the user
31-
local -r HOME=$5
29+
local -r HOME=$4
3230
# Determine the login name of the user (assuming it exists already)
33-
local -r LOGIN=$(getent passwd ${ID_NUM} | cut -f1 -d:)
34-
if [ -z ${!USER_VAR+x} ]; then
35-
# MQ_CLIENT_USER is unset
36-
if id --user ${ID_NUM}; then
37-
userdel --force --remove ${LOGIN} >/dev/null 2>&1
38-
fi
39-
else
40-
# MQ_CLIENT_USER is set
41-
if id --user ${ID_NUM}; then
42-
# Modify the existing user
43-
usermod -l ${!USER_VAR} ${LOGIN}
44-
else
45-
useradd --uid ${ID_NUM} --gid ${GROUP_NUM} --home ${HOME} ${!USER_VAR}
46-
fi
47-
48-
# Change the user's password (if set)
49-
if [ ! "${!PASSWORD}" == "" ]; then
50-
echo ${!USER_VAR}:${!PASSWORD} | chpasswd
51-
fi
31+
32+
# if user does not exist
33+
if ! id ${!USER_VAR} 2>1 > /dev/null; then
34+
# create
35+
useradd --gid ${GROUP_NAME} --home ${HOME} ${!USER_VAR}
36+
fi
37+
# Change the user's password (if set)
38+
if [ ! "${!PASSWORD}" == "" ]; then
39+
echo ${!USER_VAR}:${!PASSWORD} | chpasswd
5240
fi
5341
}
5442

@@ -89,24 +77,21 @@ configure_tls()
8977
# Now copy the key files
9078
chown mqm:mqm /tmp/tlsTemp/key.*
9179
chmod 640 /tmp/tlsTemp/key.*
92-
su -c "cp -PTv /tmp/tlsTemp/key.kdb ${DATA_PATH}/qmgrs/$1/ssl/key.kdb" -l mqm
93-
su -c "cp -PTv /tmp/tlsTemp/key.sth ${DATA_PATH}/qmgrs/$1/ssl/key.sth" -l mqm
80+
su -c "cp -PTv /tmp/tlsTemp/key.kdb ${DATA_PATH}/qmgrs/${MQ_QMGR_NAME}/ssl/key.kdb" -l mqm
81+
su -c "cp -PTv /tmp/tlsTemp/key.sth ${DATA_PATH}/qmgrs/${MQ_QMGR_NAME}/ssl/key.sth" -l mqm
9482

9583
# Set up Dev default MQ objects
9684
# Make channel TLS CHANNEL
9785
# Create SSLPEERMAP Channel Authentication record
9886
if [ "${MQ_DEV}" == "true" ]; then
99-
su -l mqm -c "echo \"ALTER CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH(TLS_RSA_WITH_AES_256_GCM_SHA384) SSLCAUTH(OPTIONAL)\" | runmqsc $1"
100-
su -l mqm -c "echo \"ALTER CHANNEL('DEV.ADMIN.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH(TLS_RSA_WITH_AES_256_GCM_SHA384) SSLCAUTH(OPTIONAL)\" | runmqsc $1"
87+
su -l mqm -c "echo \"ALTER CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH(TLS_RSA_WITH_AES_256_GCM_SHA384) SSLCAUTH(OPTIONAL)\" | runmqsc ${MQ_QMGR_NAME}"
88+
su -l mqm -c "echo \"ALTER CHANNEL('DEV.ADMIN.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH(TLS_RSA_WITH_AES_256_GCM_SHA384) SSLCAUTH(OPTIONAL)\" | runmqsc ${MQ_QMGR_NAME}"
10189
fi
10290
}
10391

10492
# Check valid parameters
10593
if [ ! -z ${MQ_TLS_KEYSTORE+x} ]; then
106-
if [ -z ${MQ_TLS_PASSPHRASE+x} ]; then
107-
echo "Error: If you supply MQ_TLS_KEYSTORE, you must supply MQ_TLS_PASSPHRASE"
108-
exit 1;
109-
fi
94+
: ${MQ_TLS_PASSPHRASE?"Error: If you supply MQ_TLS_KEYSTORE, you must supply MQ_TLS_PASSPHRASE"}
11095
fi
11196

11297
# Set default unless it is set
@@ -123,37 +108,38 @@ INSTALLATION=`dspmqver -b -f 512`
123108
echo "Configuring app user"
124109
if ! getent group mqclient; then
125110
# Group doesn't exist already
126-
groupadd --gid 1002 mqclient
111+
groupadd mqclient
127112
fi
128-
configure_os_user 1002 1002 MQ_APP_NAME MQ_APP_PASSWORD /home/app
113+
configure_os_user mqclient MQ_APP_NAME MQ_APP_PASSWORD /home/app
114+
129115
# Set authorities to give access to qmgr, queues and topic
130-
su -l mqm -c "setmqaut -m $1 -t qmgr -g mqclient +connect +inq"
131-
su -l mqm -c "setmqaut -m $1 -n \"DEV.**\" -t queue -g mqclient +put +get +browse"
132-
su -l mqm -c "setmqaut -m $1 -n \"DEV.**\" -t topic -g mqclient +sub +pub"
116+
su -l mqm -c "setmqaut -m ${MQ_QMGR_NAME} -t qmgr -g mqclient +connect +inq"
117+
su -l mqm -c "setmqaut -m ${MQ_QMGR_NAME} -n \"DEV.**\" -t queue -g mqclient +put +get +browse"
118+
su -l mqm -c "setmqaut -m ${MQ_QMGR_NAME} -n \"DEV.**\" -t topic -g mqclient +sub +pub"
133119

134120
echo "Configuring admin user"
135-
configure_os_user 1001 1000 MQ_ADMIN_NAME MQ_ADMIN_PASSWORD /home/admin
121+
configure_os_user mqm MQ_ADMIN_NAME MQ_ADMIN_PASSWORD /home/admin
136122

137123
if [ "${MQ_DEV}" == "true" ]; then
138-
echo "Configuring default objects for queue manager: $1"
124+
echo "Configuring default objects for queue manager: ${MQ_QMGR_NAME}"
139125
set +e
140-
runmqsc $1 < /etc/mqm/mq-dev-config
141-
echo "ALTER CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) MCAUSER('${MQ_APP_NAME}')" | runmqsc $1
126+
runmqsc ${MQ_QMGR_NAME} < /etc/mqm/mq-dev-config
127+
echo "ALTER CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) MCAUSER('${MQ_APP_NAME}')" | runmqsc ${MQ_QMGR_NAME}
142128

143129
# If client password set to "" allow users to connect to application channel without a userid
144130
if [ "${MQ_APP_PASSWORD}" == "" ]; then
145-
echo "SET CHLAUTH('DEV.APP.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) CHCKCLNT(ASQMGR) ACTION(REPLACE)" | runmqsc $1
131+
echo "SET CHLAUTH('DEV.APP.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) CHCKCLNT(ASQMGR) ACTION(REPLACE)" | runmqsc ${MQ_QMGR_NAME}
146132
fi
147133
set -e
148134
fi
149135

150136
if [ ! -z ${MQ_TLS_KEYSTORE+x} ]; then
151-
if [ ! -e "${DATA_PATH}/qmgrs/$1/ssl/key.kdb" ]; then
152-
echo "Configuring TLS for queue manager $1"
137+
if [ ! -e "${DATA_PATH}/qmgrs/${MQ_QMGR_NAME}/ssl/key.kdb" ]; then
138+
echo "Configuring TLS for queue manager ${MQ_QMGR_NAME}"
153139
mkdir -p /tmp/tlsTemp
154140
chown mqm:mqm /tmp/tlsTemp
155-
configure_tls $1
141+
configure_tls
156142
else
157-
echo "A key store already exists at '${DATA_PATH}/qmgrs/$1/ssl/key.kdb'"
143+
echo "A key store already exists at '${DATA_PATH}/qmgrs/${MQ_QMGR_NAME}/ssl/key.kdb'"
158144
fi
159145
fi

mq-monitor-qmgr.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
# -*- mode: sh -*-
3+
# © Copyright IBM Corporation 2015, 2017
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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+
set -e
18+
19+
MQ_QMGR_NAME=$1
20+
21+
state()
22+
{
23+
dspmq -n -m ${MQ_QMGR_NAME} | awk -F '[()]' '{ print $4 }'
24+
}
25+
26+
trap "source mq-stop-container.sh" SIGTERM SIGINT
27+
28+
echo "Monitoring Queue Manager ${MQ_QMGR_NAME}"
29+
30+
# Loop until "dspmq" says the queue manager is running
31+
until [ "`state`" == "RUNNING" ]; do
32+
sleep 1
33+
done
34+
dspmq
35+
36+
echo "IBM MQ Queue Manager ${MQ_QMGR_NAME} is now fully running"
37+
38+
# Loop until "dspmq" says the queue manager is not running any more
39+
until [ "`state`" != "RUNNING" ]; do
40+
sleep 5
41+
done
42+
43+
# Wait until queue manager has ended before exiting
44+
while true; do
45+
STATE=`state`
46+
case "$STATE" in
47+
ENDED*) break;;
48+
*) ;;
49+
esac
50+
sleep 1
51+
done
52+
dspmq

mq-parameter-check.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# -*- mode: sh -*-
3+
# © Copyright IBM Corporation 2015, 2017
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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+
set -e
18+
19+
# We want to do parameter checking early as then we can stop and error early before it looks
20+
# like everything is going to be ok (when it won't)
21+
if [ ! -z ${MQ_TLS_KEYSTORE+x} ]; then
22+
: ${MQ_TLS_PASSPHRASE?"Error: If you supply MQ_TLS_KEYSTORE, you must supply MQ_TLS_PASSPHRASE"}
23+
fi

mq-pre-create-setup.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# -*- mode: sh -*-
3+
# © Copyright IBM Corporation 2015, 2017
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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+
set -e
18+
19+
source /opt/mqm/bin/setmqenv -s
20+
dspmqver
21+
echo "Checking filesystem..."
22+
amqmfsck /var/mqm

0 commit comments

Comments
 (0)