Skip to content

Commit 618da61

Browse files
committed
MQClient Sample
1 parent 36e2fe1 commit 618da61

File tree

5 files changed

+202
-3
lines changed

5 files changed

+202
-3
lines changed

samples/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
The samples folder contains Dockerfiles that build a sample image containing sample applications.
44

5-
* [Update base package sample](updateBase/) - This sample applies updates all the base OS packages. This can be used to resolve CVEs in the base packages
6-
* [iFix sample](applyIfix/) - This sample applies an iFix provided by IBM to an existing image.
5+
* [MQ Client](mqclient/) - This sample adds mq client libraries to an existing image.
76
* [Bar sample](bars/) - This sample adds some bar files to an existing image.
87
* [Scripts sample](scripts/) - This sample adds scripts which are run on startup.
9-
8+
* [Update base package sample](updateBase/) - This sample applies updates all the base OS packages. This can be used to resolve CVEs in the base packages
9+
* [iFix sample](applyIfix/) - This sample applies an iFix provided by IBM to an existing image.

samples/mqclient/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
ARG FROMIMAGE=cp.icr.io/cp/appc/ace:12.0.4.0-r1
2+
FROM ${FROMIMAGE}
3+
4+
USER root
5+
6+
# The MQ packages to install - see install-mq.sh for default value
7+
ARG MQ_URL
8+
ARG MQ_URL_USER
9+
ARG MQ_URL_PASS
10+
ARG MQ_PACKAGES="MQSeriesRuntime*.rpm MQSeriesJava*.rpm MQSeriesJRE*.rpm MQSeriesGSKit*.rpm MQSeriesClient*.rpm"
11+
ARG INSTALL_JRE=0
12+
13+
ARG MQM_UID=888
14+
15+
COPY install-mq.sh /usr/local/bin/
16+
COPY install-mq-client-prereqs.sh /usr/local/bin/
17+
# Install MQ. To avoid a "text file busy" error here, we sleep before installing.
18+
RUN chmod u+x /usr/local/bin/install-*.sh \
19+
&& sleep 1 \
20+
&& install-mq-client-prereqs.sh $MQM_UID \
21+
&& install-mq.sh $MQM_UID \
22+
&& chown -R 1001:root /opt/mqm/* \
23+
&& chown 1001:root /usr/local/bin/*mq* \
24+
&& mkdir -p /var/mqm/data \
25+
&& chown -R 1001:root /var/mqm \
26+
&& chmod -R 777 /var/mqm
27+
28+
ENV MQCERTLABL=aceclient
29+
30+
USER 1001

samples/mqclient/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
# Bars Sample
3+
4+
## What is in the sample?
5+
6+
- **mqclient** contains a sample dockerfile for adding the MQ client into the image.
7+
8+
## Building the sample
9+
10+
First [build the ACE image](../../README.md#Building-a-container-image) or obtain one of the shipped images.
11+
12+
Download a copy of the MQ redistributable client Example URL: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist/9.2.0.4-IBM-MQC-Redist-LinuxX64.tar.gz
13+
14+
In the `sample/mqclient` folder:
15+
16+
```bash
17+
docker build -t aceapp --build-arg FROMIMAGE=ace:12.0.4.0-r1 --build-arg MQ_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist/9.2.0.4-IBM-MQC-Redist-LinuxX64.tar.gz --file Dockerfile .
18+
```
19+
20+
## Running the sample
21+
22+
To run the container, launch the pod using a command such as:
23+
24+
```bash
25+
`docker run -d -p 7600:7600 -p 7800:7800 -e LICENSE=accept aceapp`
26+
```
27+
28+
This wll then start an IntegrationServer with a MQ Client installed.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# -*- mode: sh -*-
3+
# © Copyright IBM Corporation 2022
4+
#
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
# Fail on any non-zero return code
19+
set -ex
20+
21+
test -f /usr/bin/microdnf && MICRODNF=true || MICRODNF=false
22+
test -f /usr/bin/rpm && RPM=true || RPM=false
23+
24+
if ($RPM); then
25+
EXTRA_RPMS="bash bc ca-certificates file findutils gawk glibc-common grep ncurses-compat-libs passwd procps-ng sed shadow-utils tar util-linux which"
26+
$MICRODNF && microdnf install ${EXTRA_RPMS}
27+
else
28+
$MICRODNF && microdnf install findutils
29+
fi
30+
31+
# Clean up cached files
32+
$MICRODNF && microdnf clean all

samples/mqclient/install-mq.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/bin/bash
2+
# -*- mode: sh -*-
3+
# © Copyright IBM Corporation 2022
4+
#
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
# Fail on any non-zero return code
19+
set -ex
20+
21+
# Download and extract the MQ files
22+
DIR_TMP=/tmp/mq
23+
mkdir -p ${DIR_TMP}
24+
cd ${DIR_TMP}
25+
if [ -z "$MQ_URL_USER" ]
26+
then
27+
curl -LO $MQ_URL
28+
else
29+
curl -LO -u ${MQ_URL_USER}:${MQ_URL_PASS} $MQ_URL
30+
fi
31+
tar -xzf ./*.tar.gz
32+
rm -f ./*.tar.gz
33+
34+
# Check what sort of MQ package was downloaded
35+
if [ -f "${DIR_TMP}/bin/genmqpkg.sh" ]
36+
then
37+
# Generate MQ package in INSTALLATION_DIR
38+
#
39+
# Used if the downloaded package is the MQ redistributable client. Example URL:
40+
#
41+
# https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist/9.2.0.4-IBM-MQC-Redist-LinuxX64.tar.gz
42+
#
43+
echo "Detected genmqpkg.sh; installing MQ client components"
44+
export genmqpkg_inc32=0
45+
export genmqpkg_incadm=1
46+
export genmqpkg_incamqp=0
47+
export genmqpkg_incams=0
48+
export genmqpkg_inccbl=0
49+
export genmqpkg_inccics=0
50+
export genmqpkg_inccpp=1
51+
export genmqpkg_incdnet=0
52+
export genmqpkg_incjava=1
53+
export genmqpkg_incjre=${INSTALL_JRE}
54+
export genmqpkg_incman=0
55+
export genmqpkg_incmqbc=0
56+
export genmqpkg_incmqft=0
57+
export genmqpkg_incmqsf=0
58+
export genmqpkg_incmqxr=0
59+
export genmqpkg_incnls=0
60+
export genmqpkg_incras=1
61+
export genmqpkg_incsamp=0
62+
export genmqpkg_incsdk=0
63+
export genmqpkg_incserver=0
64+
export genmqpkg_inctls=1
65+
export genmqpkg_incunthrd=0
66+
export genmqpkg_incweb=0
67+
export INSTALLATION_DIR=/opt/mqm
68+
69+
# Install requested parts
70+
${DIR_TMP}/bin/genmqpkg.sh -b ${INSTALLATION_DIR}
71+
72+
# Accept the MQ license
73+
${INSTALLATION_DIR}/bin/mqlicense -accept
74+
else
75+
# Check if should try install using RPM
76+
test -f /usr/bin/rpm && RPM=true || RPM=false
77+
if [ ! $RPM ]; then
78+
echo "Did not find the rpm command; cannot continue MQ client install without rpm"
79+
exit 9
80+
fi
81+
#
82+
# Used if the downloaded package is the MQ client package from FixCentral. Example URL:
83+
#
84+
# https://ak-delivery04-mul.dhe.ibm.com/sdfdl/v2/sar/CM/WS/0a3ih/0/Xa.2/Xb.jusyLTSp44S0BnrSUlhcQXsmOX33PXiMu_opTWF4XkF7jFZV8UxrP0RFSE0/Xc.CM/WS/0a3ih/0/9.2.0.4-IBM-MQC-LinuxX64.tar.gz/Xd./Xf.LPR.D1VK/Xg.11634360/Xi.habanero/XY.habanero/XZ.m7uIgNXpo_VTCGzC-hylOC79m0eKS5pi/9.2.0.4-IBM-MQC-LinuxX64.tar.gz
85+
#
86+
# Also used if the downloaded package is the full MQ developer package. Example URL:
87+
#
88+
# https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev924_linux_x86-64.tar.gz
89+
#
90+
echo "Did not find genmqpkg.sh; installing MQ client components using rpm"
91+
$RPM && DIR_RPM=$(find ${DIR_TMP} -name "*.rpm" -printf "%h\n" | sort -u | head -1)
92+
93+
# Find location of mqlicense.sh
94+
MQLICENSE=$(find ${DIR_TMP} -name "mqlicense.sh")
95+
96+
# Accept the MQ license
97+
${MQLICENSE} -text_only -accept
98+
99+
# Install MQ using the rpm packages
100+
$RPM && cd $DIR_RPM && rpm -ivh $MQ_PACKAGES
101+
102+
# Remove tar.gz files unpacked by RPM postinst scripts
103+
find /opt/mqm -name '*.tar.gz' -delete
104+
fi
105+
106+
rm -rf ${DIR_TMP}
107+
108+
# Create the directory for MQ configuration files
109+
install --directory --mode 2775 --owner 1001 --group root /etc/mqm

0 commit comments

Comments
 (0)