Ibm Mq For Docker Mac

MQ, IIB, Docker, Kubernetes & IBM Cloud MQ in Containers. MQ Technical Conference v2.0.1.8 2 MQ in the Cloud Content. IBM MQ MQCONN from host to Docker container 0 Trying to connect from a C application running as an IBM MQ client on a host to an MQ server running as a docker container. The client code taken from an IBM example is provided below. Integrate data and applications across cloud, mobile, IoT and on-premises environments.

In a previous blogpost, I described how you can install IBM MQ on your local development machine. This is still a lot of work just to get MQ up and running…

This post describes how to run IBM MQ in Docker and get you up and running in less than 5 minutes!(you should have of course already a working installation of Docker Desktop on your machine)

Skin editor for minecraft mac. The official GitHub repository of the MQ Container can be found here: https://github.com/ibm-messaging/mq-container.

Step 1 – Run MQ with default config

These instructions are based on the official usage documentation. In this example, I will not use the default MQ_DEV config.

Step 2 – Disable security

The default configuration has security configured out of the box. And that is a good thing! But it might be a bit annoying for local development.

Docker For Mac

Connect to your container using the cli. Use runmqsc to disable security and create a new channel that runs under the mqm user.

At this point, security is disabled and the channel “DEMO.ADMIN.SVRCONN” can be used for messaging (from Java / .NET) and admin purposes (MQ Explorer) without any security.

DISCLAIMER: you should only disable security like this in a development scenario!

Article ID: KB000785

Overview

This Solution Brief illustrates how Docker Enterprise Edition, Universal Control Plane (UCP), and Docker Trusted Registry (DTR), is used to stand up a topology with IBM MQ communicating between two applications running on separate instances of WebSphere Liberty.

Information on IBM MQ and WebSphere Liberty is provided by Docker as a known, working configuration at the time of publishing. Docker does not support IBM MQ or WebSphere Liberty. Please contact IBM Support if you have any questions or problems with them.

IBM MQ Overview

IBM MQ (often referred to as 'MQ') is IBM's Messaging solution for Enterprise and IBM's Message Oriented Middleware offering. It allows independent applications to securely communicate with each other across multiple different systems. WebSphere Application Server provides flexible and secure runtimes for mission-critical Java enterprise applications, lightweight web applications, and micro services.

These two products are often found in enterprise IT deployments. MQ is used to securely communicate between applications running in WebSphere Liberty servers.

Architecture

This deployment shows:

  1. MQ and two Websphere Liberty servers are deployed on Docker for Mac or Docker Enterprise Edition. A 'sender' Java application is deployed and managed by one Liberty server. A 'receiver' application is deployed and managed by the other.
  2. After the containers are started, the sender application creates a connection to the queue manager (QM1). The sender application puts a message on the queue (Q1).
  3. The sender application then waits for a response from the receiver.
  4. The receiver application continuously monitors the queue for messages using a message-driven bean.
  5. The receiving application consumes the message from the queue and creates a response.
  6. The receiving application puts the response on a temporary response queue and closes the connection to the queue.
  7. The sending application then sees the message and consumes it from the queue.
  8. The sending application reports its progress back to the browser and writes the same messages out to the logs.

Prerequisites

The following are prerequisites for installing IBM MQ and WebSphere Liberty:

  • sample.docker.mq.git (for building the sender and receiver java applications)
  • Docker Enterprise Edition 17.06 UCP 2.2.5 DTR 2.4.2 for Ubuntu (other platforms available)
Ibm docker container

Installation and Configuration (Docker for Mac)

Use the following steps to install and configure IBM MQ and WebSphere Liberty:

  1. Install the git utility if not already installed.

  2. In a terminal window, navigate to the folder you would like to place the repository (or create a new one), then run the command:

  3. MQ requires a resource adapter that allows WebSphere Liberty to connect to IBM MQ to enable it to send messages to a second web application. The MQ resource adapter is available through the IBM Fix Central page or from the MQ installation. To locate a version that is available for download, unblock any popups from IBM, and search for the term 'InstallRA' from the search box provided. The name of the file to be downloaded is in the format of <V.R.M.F>-IBM-MQ-Java-InstallRA.jar.

  4. Click through the selection and agreement forms. Download the most recent resource adapter. (This guide was tested with version 9.0.5.0.)

  5. Put the resource adapter JAR file that you downloaded into both the liberty-sender and liberty-receiver application folders found in ./sample.docker.mq.

  6. Edit the Dockerfile in both liberty-sender and liberty-receiver:

    1. Change to the Docker Store version of the WebSphere Liberty (replace FROM websphere-liberty with FROM store/ibmcorp/websphere-liberty:webProfile7).
    2. Ensure that the COPY commands for the resource adapter is up-to-date with the current resource adapter’s version (e.g. change 9.0.0.0 to 9.0.5.0 in two places).
    3. (Optional) To enable the WebSphere Admin Center console, paste this Run statement to the bottom of each of the Dockerfiles:
  7. Navigate to the mq directory under ./sample.docker.mq and edit the Dockerfile.

    Replace FROM ibmcom/mq with FROM store/ibmcorp/mqadvanced-server-dev:9.0.3.

  8. In the ./sample.docker.mq directory, edit the docker-compose.yml file, and replace the entire contents with the following commands. Make sure that the indentation of the text is preserved.

  9. In a browser and using a previously created Docker ID, log into Docker Store. Subscribe to both the Websphere Liberty and MQ Advanced images. These images are free. Here are the example steps to subscribe to the Websphere Liberty image. Follow the same process for the MQ Advanced image.

    Subscription Screen:

  10. Execute:

    This uses maven to build the WAR files for both of the applications in the sender and receiver directories and makes sure they are put in the correct locations. This will take several minutes.

  11. (Optional) To ensure a stable build environment, make sure that any stopped containers and layers have been cleaned up.

Verifying the Deployment (Docker for Mac)

To verify the deployment, simply execute:

This confirms the successful build and bring up three containers: mqfull, liberty-server, and liberty-receiver. A docker ps will look something like this:

You can now access the application, the MQ Console, and the two Liberty servers:

  • Application: http://localhost:10080/sender/

    Output to log files upon refresh of browser http://localhost:10080/sender/

  • MQ Console: https://localhost:9443/ibmmq/console/login.html (admin/passw0rd)

  • liberty-sender is at https://localhost:10443/adminCenter/login.jsp (wsadmin/wsadmin); likewise, liberty-receiver is at https://localhost:10444/adminCenter/login.jsp.

Stopping the Application (Docker for Mac)

To stop the application, execute:

Configuration and Deployment (Docker Enterprise Edition)

To deploy IBM MQ and WebSphere Liberty on Docker Enterprise Edition 17.06, begin with the provisioning of an appropriate number of instances for site-specific performance and high availability.

In this example, a four instance deployment was provisioned consisting of one instance for UCP Management and three instances to run each of the three worker containers: MQ, Sender, and Receiver. Docker Trusted Registry (DTR) is also installed on the instance with one of the worker containers. This guide assumes that UCP and DTR have been installed and configured and that access to the 'admin' account and password have been provided.

Move Images to Docker EE

Since the original MQ and Liberty images have been extended during the build process, these extended images must be tagged and pushed into the cloud service provider environment. This can be done by pushing the local images to DTR and then altering the docker-compose.yml so that it points to these images.

  1. Log into DTR (https://{dtr-registry-address}) as 'admin' and click on the New repository button towards the upper right portion of the window.

  2. In the field REPOSITORY NAME, enter test-mq and then click on Save towards the bottom right of the window.

  3. Create two more repositories named test-sender and test-receiver. Log out of DTR.

  4. From a new terminal window on Docker for Mac/Linux, execute:

  5. When prompted, enter 'admin' as the username and then the appropriate password.

  6. Prepare the images created in the previous steps for the Docker Trusted Registry:

  7. Push images to the Docker Trusted Registry:

    Use an edited version docker-compose.yml file to run the MQ-Liberty Solution directly from UCP.

  8. Copy the docker-compose.yml commands below into a text or code editor:

  9. Change the {dtr-registry-address} fields with the URL appropriate for the installation of DTR.

  10. Copy the entire contents into the clipboard. Be sure to preserve indentation layout.

  11. Access the URL for the UCP management node and login as 'admin'.

  12. Click on Stacks in the left sidebar:

  13. Click on Create Stack in the upper right of window:

  14. On the Create Stack screen, provide a Stack Name and Mode (Choose Services). Paste the edited docker-compose.yml commands from the clipboard with the appropriate address for DTR Registry.

  15. Finally, click on the Create button to deploy the stack:

Verifying the Deployment (Docker EE)

Ibm Mq For Docker Mac Install

  • To verify that the containers launched successfully, click on Services in the left sidebar on the UCP home screen The mqfull, liberty-sender, and liberty-receiver show with green status and no errors.

  • To verify that it is functioning correctly, connect to http://{ucp-ip-address}:10080/sender/. After each screen refresh, the sender will post a message to receiver. Receiver will answer with a message back.

  • To bring down the solution, click on Stacks in the left sidebar and then click on the 'Name' of the stack. A menu bar will appear on the right. Click on Remove to stop and remove the containers:

Ibm Mq For Docker Macos

Troubleshooting

If errors occur in the build or the sender/receiver communication, it may be necessary to re-build after removing all images and clearing cashes. This can be achieved using the following commands:

Further Reading

Mac Docker Machine

Refer to the following links for additional information:

  • Developer Works Blog: This is the original guide for the MQ-Liberty demo published in Jan 2017.
Ibm Mq For Docker Mac

Additional Application Guides and Solution Briefs

Docker provides additional application guides on success.docker.com as well as Solution Briefs about related information.