DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Terraform Best Practices: The 24 Practices You Should Adopt
  • Let’s Build an End-to-End NFT Project Using Truffle Suite
  • Running SpringBoot Application On OpenShift
  • Command Design Pattern In Java

Trending

  • Next Evolution in Integration: Architecting With Intent Using Model Context Protocol
  • ITBench, Part 1: Next-Gen Benchmarking for IT Automation Evaluation
  • Apache Spark 4.0: Transforming Big Data Analytics to the Next Level
  • Caching 101: Theory, Algorithms, Tools, and Best Practices
  1. DZone
  2. Coding
  3. Languages
  4. Automating the IBM MQ Upgrade on Redhat OpenShift Using BuildConfigs as CI/CD

Automating the IBM MQ Upgrade on Redhat OpenShift Using BuildConfigs as CI/CD

This article explains the IBM MQ upgrade automatically using buildconfigs following that uses Image stream to trigger the new build for upgrade IBM MQ.

By 
Vamsi Kiran Naidu user avatar
Vamsi Kiran Naidu
·
Apr. 12, 23 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
3.6K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, I will walk you through the IBM MQ upgrade automatically using buildconfigs following that uses Image stream to trigger the new build for upgrade IBM MQ on OpenShift Container Platform 4.x cluster setup on Linux. Further,  I will be creating ImageStream, Dockerfile, BuidConfig and triggering the build to upgrade IBM MQ on OCP.

Prerequisite

Verify that your OpenShift cluster is up and running. 

  1. Check the compatibility of the new version of IBM MQ with your OpenShift environment, and verify the system requirements.
  2. Check if there is any known issue or limitation with the new version of IBM MQ by reviewing the IBM MQ documentation.
  3. Create a backup of the existing IBM MQ installation data and configuration.

Automating IBM MQ Upgrade on OCP

Create the image stream for IBM MQ with the latest or specific version by running the following image stream definition file.

ImageStream Definition YAML

YAML
 
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
  name: ibm-mq-server
  namespace: samp-mq-ns
spec:
  lookupPolicy:
    local: false
  tags:
  - from:
      kind: DockerImage
      name: ibmcom/mq
    name: <latest-version>
    annotations:
      description: IBM MQ Server <latest-version>
      iconClass: icon-ibm-mq
      tags: mq,ibm,middleware


This YAML file creates an ImageStream object named "ibm-mq-server" with a single tag for version <latest-version> of the IBM MQ Server image. The from field specifies the source Docker image for the tag and the annotations field provides additional metadata for the tag.

To create the ImageStream object in your OpenShift project, save this YAML file to a file on your local system and then run the following command:

Shell
 
oc create -f mq-server-is.yaml


Image Build Definition on Docker File

This Dockerfile installs IBM MQ version  <latest-version> on a UBI 8 base image. The rpm command is used with the -Uvh option to upgrade the existing IBM MQ installation to the new version.

You can modify this Dockerfile to use a different version of IBM MQ by changing the MQ_URL argument to point to the URL of the installation package for the desired version and updating the MQ_PACKAGES variable with the names of the RPM packages required for that version. Be sure also to update any other relevant parts of the Dockerfile, such as the exposed ports, entry point script, and user.

Dockerfile
 
FROM registry.access.redhat.com/ubi8/ubi:latest

LABEL maintainer="Your Name <yourname@example.com>"

ARG MQ_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev932_ubuntu_x86-64.tar.gz
ARG MQ_PACKAGES="MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesSDK-*.rpm MQSeriesSamples-*.rpm"

ENV LANG=en_US.UTF-8

# Install IBM MQ
RUN mkdir /tmp/mq \
 && cd /tmp/mq \
 && curl -LO $MQ_URL \
 && tar -zxvf ./*.tar.gz \
 && rm -f ./*.tar.gz \
 && cd MQServer \
 && ./mqlicense.sh -text_only -accept \
 && yum -y update \
 && yum -y install gskit \
 && rpm -Uvh --force-debian $MQ_PACKAGES \
 && /opt/mqm/bin/setmqinst -p /opt/mqm -i

# Create MQ data directory
RUN mkdir -p /var/mqm \
 && chown mqm:mqm /var/mqm \
 && chmod 770 /var/mqm

# Expose default MQ ports
EXPOSE 1414 9443

# Define the entrypoint script
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

# Set the default user
USER mqm


Definition of BuildConfig File

Below YAML file creates a BuildConfig object named "ibm-mq-server-upgrade" that builds an image for version  <latest-version> of the IBM MQ Server using the ImageStream created in the previous example. The output field specifies that the output should be saved to the ibm-mq-server:<latest-version>  tag in an ImageStream. The source field specifies the input source for the build, which is an existing image in the ibm-mq-server ImageStream. The strategy field specifies the build strategy to use, which is the default Docker strategy using a base image from the ubi8 ImageStream. The triggers field specifies that the build should be triggered by an ImageChange event. 

YAML
 
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: ibm-mq-server-upgrade
  namespace: samp-mq-ns
spec:
  output:
    to:
      kind: ImageStreamTag
      name: ibm-mq-server:<latest-version>
  source:
    git:
      uri: <git-repo-url>
      ref: <git-repo-ref>
    contextDir: <dockerfile-directory>
    type: Dockerfile
  strategy:
    dockerStrategy:
      dockerfilePath: <dockerfile-path>
      from:
        kind: ImageStreamTag
        name: ubi8:latest
  triggers:
    - type: ImageChange
      imageChange: {}


To create the BuildConfig object in your OpenShift project, save this YAML file to a file on your local system and then run the following command: 

Shell
 
 oc create -f ibm-mq-server-upgrade.yaml


Start the build process by running the following command:

Shell
 
oc start-build ibm-mq-server-upgrade --from-dir=<directory-containing-dockerfile>


Replace <directory-containing-dockerfile> with the path to the directory containing the Dockerfile on your local system.

This will start a new build process for the upgraded version of IBM MQ. Once the build is complete, the new image will be pushed to the specified ImageStream tag, and you can deploy the updated IBM MQ image to your OpenShift environment.

Summary

Automating the upgrade of IBM MQ on Red Hat OpenShift using buildconfig with imagestream,  the existing imagestream for IBM MQ is used to create a new buildconfig that specifies the updated Dockerfile. The buildconfig is then run to create a new image, which is tagged with the latest version of IBM MQ. Finally, the image is deployed using a new deployment configuration, and any dependent applications are updated as necessary.

Contextual design OpenShift System requirements YAML Command (computing) Object (computer science)

Opinions expressed by DZone contributors are their own.

Related

  • Terraform Best Practices: The 24 Practices You Should Adopt
  • Let’s Build an End-to-End NFT Project Using Truffle Suite
  • Running SpringBoot Application On OpenShift
  • Command Design Pattern In Java

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!