From 54f0ae65a6b7a93392cd1b99ae2ee4e2eaf3be77 Mon Sep 17 00:00:00 2001 From: Rob Parker Date: Wed, 30 May 2018 16:24:03 +0100 Subject: [PATCH] Add MQIPT Sample (#93) --- .gitignore | 1 + incubating/mqipt/Dockerfile | 32 +++++++++++++++++++++++++ incubating/mqipt/README.md | 44 ++++++++++++++++++++++++++++++++++ incubating/mqipt/startMQIPT.sh | 28 ++++++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 incubating/mqipt/Dockerfile create mode 100644 incubating/mqipt/README.md create mode 100755 incubating/mqipt/startMQIPT.sh diff --git a/.gitignore b/.gitignore index 7b6ddd1..8d8334b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ test/kubernetes/vendor build coverage downloads +incubating/mqipt/ms81* diff --git a/incubating/mqipt/Dockerfile b/incubating/mqipt/Dockerfile new file mode 100644 index 0000000..3b43c77 --- /dev/null +++ b/incubating/mqipt/Dockerfile @@ -0,0 +1,32 @@ +# © Copyright IBM Corporation 2018 +# +# Licensed 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. + +FROM ibmcom/ibmjava:jre + +ARG IPTFILE=ms81_2.1.0.4_amd64_linux_2.tar + +COPY $IPTFILE /opt/ + +RUN rm -rf /var/lib/apt/lists/* \ + && cd /opt/ \ + && tar xvf ./$IPTFILE \ + && chmod -R a-w /opt/mqipt + +ENV MQIPT_PATH=/opt/mqipt + +COPY startMQIPT.sh /usr/local/bin + +VOLUME /var/mqipt + +ENTRYPOINT ["startMQIPT.sh"] diff --git a/incubating/mqipt/README.md b/incubating/mqipt/README.md new file mode 100644 index 0000000..6e3ad2e --- /dev/null +++ b/incubating/mqipt/README.md @@ -0,0 +1,44 @@ +# IBM MQ Internet Pass-Thru (SupportPac MS81) on Docker + +IBM® MQ Internet Pass-Thru (MQIPT) is an extension to the base IBM MQ product. MQIPT runs as a stand-alone service that can receive and forward IBM MQ message flows, either between two IBM MQ queue managers or between an IBM MQ client and an IBM MQ queue manager. +MQIPT enables this connection when the client and server are not on the same physical network. + +This repository contains all of the resources you will need to create a Docker image containing MQIPT for use in your infrastructure. + +## How to build this image + +1. First download MQIPT from the [IBM MQ SupportPacs website](http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg27007198#3). MQIPT is a `Category 3 - Product Extensions SupportPacs` with the identifier `MS81`. +2. Ensure the MQIPT downloaded tar file is available in this directory. +3. If the tar file is not called `ms81_2.1.0.4_amd64_linux_2.tar` you will need to either: + * Rename the file. + * Supply the new name as a `--build-arg IPTFILE=` when executing the docker build command in the next step. + * Alter the Dockerfile `IPTFILE` ARG to specify the new file name. +4. Run the following command in this directory to build the Docker image. `docker build -t mqipt .` + +Once the Docker build has completed you will have a new Docker image called `mqipt:latest` available which contains MQIPT. + +## How to run this image + +Before you run the MQIPT docker image you should understand how MQIPT operates, please ensure you have read the [MQIPT knowledgecenter](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ipt.doc/ipt0000_.htm) and any documentation supplied with the MQIPT installation tar. + +First you need to create your [MQIPT configuration file](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ipt.doc/ipt2540_.htm) and place this file in a directory that can be [mounted to a docker container](https://docs.docker.com/storage/). This file **must** be called `mqipt.conf`; there is a sample file available in the MQIPT installation tar. + +Run the following command to start a container with your built MQIPT image: + +`docker run -d --volume :/var/mqipt -p 1414:1414 mqipt` + +If you want the container ports to be accessible outside of the host you must expose the required ports, this will map the container port to a port on the host, meaning you can connect to that port on the host and access MQIPT. You will need to provide multiple `-p` parameters to expose all of the ports required by your MQIPT configuration. **Note:** these must be available otherwise the docker container will fail to start. + +See [Docker Run reference](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) for more information on how to expose container ports. + +## Further information + +For further information on MQIPT please view the [MQIPT knowledgecenter](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ipt.doc/ipt0000_.htm) + +## License + +The Dockerfiles and associated code and scripts are provided as-is and licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). + +## Copyright + +© Copyright IBM Corporation 2018 diff --git a/incubating/mqipt/startMQIPT.sh b/incubating/mqipt/startMQIPT.sh new file mode 100755 index 0000000..fb3d1f6 --- /dev/null +++ b/incubating/mqipt/startMQIPT.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# -*- mode: sh -*- +# © Copyright IBM Corporation 2018 +# +# Licensed 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. + +stop() +{ + /opt/mqipt/bin/mqiptAdmin -stop +} + +trap stop SIGTERM SIGINT + +# Run MQIPT and then wait on the process to end. +/opt/mqipt/bin/mqipt /var/mqipt & +MQIPTPROCESS=$! + +wait "$MQIPTPROCESS"