Deploying IBM MQ with a single command
Introduction
In a previous blog (https://medium.com/ibm-garage/deploying-ibm-app-connect-with-a-single-command-fc02e4887228), I described how to deploy IBM App Connect with a single command.
Well, AppConnect is part of Cloud Pak for Integration, which has other components.
In this blog, I will describe how to deploy IBM MQ, another component of the same Cloud Pak, then I will tell you to do the same with a single command.
Step-by-Step Deployment
I assume you have deployed Cloud Pak for Integration in your OpenShift cluster, and now you want to deploy an instance of IBM MQ. Follow these steps to deploy:
Define the following environment variables:
export NAME=<name-of-mq-instance>
export PROJECT=mq
export SCC=ibm-anyuid-hostpath-scc
export IMAGE_SECRET=prod-secret
export TLS_SECRET=ibm-mq-tls-secret
export ICP_PASSWORD=<icp-password>
Obtain the ICP Console route:
export MASTER_URL=$(oc get route icp-console -n kube-system -o jsonpath='{@.status.ingress[0].host}')
Configure the Helm CLI:
cloudctl login -a $MASTER_URL -u admin -p $ICP_PASSWORD -n kube-system --skip-ssl-validation
Create the MQ project:
oc new-project $PROJECT
Associate the OpenShift Security Context Constraint to the project service account:
oc adm policy add-scc-to-group $SCC system:serviceaccounts:$PROJECT
Create the TLS Secret, using the certificates stored in the Helm directory:
oc create secret generic $TLS_SECRET \
--from-file=tls.crt=$HOME/.helm/cert.pem \
--from-file=ca.crt=$HOME/.helm/ca.pem \
--from-file=tls.key=$HOME/.helm/key.pem
As we are using the IBM Container Registry to pull the container images, we need to set the image pull secret.
Assuming you have a valid entitlement key, we need to fetch the key first.
The good news is that there is a github repository with a script that shows the key.
So, run the following commands to download the script and add to your path:
curl https://raw.github.ibm.com/CloudPakOpenContent/cloudpak-entitlement/master/pak-entitlement.sh?token=AAAslythPohyzFwjlgwEmZFFna3_T2K4ks5d3-uwwA%3D%3D > pak-entitlement.sh
chmod a+x ./pak-entitlement.sh
sudo mv ./pak-entitlement.sh /usr/local/bin
Now run the following script to set the entitlement key:
ENTITLEMENT_KEY=$(pak-entitlement.sh show-key Integration)
echo Key: $ENTITLEMENT_KEY
Create the image pull secret:
oc create secret docker-registry $IMAGE_SECRET \
--docker-server=cp.icr.io --docker-username=ekey \
--docker-password=$ENTITLEMENT_KEY
Finally, install the IBM MQ, using the Helm chart:
helm install https://github.com/IBM/charts/blob/master/repo/entitled/ibm-mqadvanced-server-integration-prod-4.1.0.tgz?raw=true \
--name $NAME --tls --set image.pullSecret=$IMAGE_SECRET \
--set license="accept"
This is pretty cool, but lot’s of commands and copy-and-paste.
Let’s describe a better way.
Deploying IBM MQ with a single command
I wrapped all these commands in a nice script. The first thing you need to do is to clone the Github repository:
git clone https://github.com/patrocinio/cloud-paks-resilience
cd cloud-paks-resilience/Integration
Now, just run the following command:
./deploy_mq <mq-name>
And you’ll see the Helm release output:
Eduardos-MBP:Integration edu$ ./deploy_mq.sh my-mq2[...]NOTES:Get the MQ Console URL by running these commands:export CONSOLE_PORT=$(kubectl get services my-mq2-ibm-mq -n mq -o jsonpath="{.spec.ports[?(@.port=="9443")].nodePort}")export CONSOLE_IP=$(kubectl get configmap ibmcloud-cluster-info -n kube-public -o jsonpath="{.data.proxy_address}")echo https://$CONSOLE_IP:$CONSOLE_PORT/ibmmq/consoleGet the MQ connection information for clients outside the cluster by running these commands:export MQ_PORT=$(kubectl get services my-mq2-ibm-mq -n mq -o jsonpath="{.spec.ports[?(@.port=="1414")].nodePort}")export MQ_IP=$(kubectl get configmap ibmcloud-cluster-info -n kube-public -o jsonpath="{.data.proxy_address}")echo $MQ_IP:$MQ_PORTThe MQ connection information for clients inside the cluster is as follows:my-mq2-ibm-mq.mq.svc:1414
Conclusion
In this blog, I showed how to deploy IBM MQ using a sequence of commands, then using a single script.
Now, you can deploy IBM MQ with a single command!
Bring your plan to the IBM Garage.
Are you ready to learn more about working with the IBM Garage? We’re here to help. Contact us today to schedule a time to speak with a Garage expert about your next big idea. Learn about our IBM Garage Method, the design, development, and startup communities we work in, and the deep expertise and capabilities we bring to the table.
Schedule a no-charge visit with the IBM Garage.