MuleSoft’s Anypoint Platform is an Integration and API management platform. Anypoint Runtime Fabric (RTF) is a container service that automates the deployment and orchestration of Mule applications. With the release of the certified MuleSoft Runtime Fabric Operator, MuleSoft customers have the option of deploying their containerized workloads anywhere OpenShift can be deployed - whether it is on-prem, or on a public cloud of their choice (either as Red Hat managed or self managed).

Mule workloads on OpenShift

The objective of this blog post is to show customers the value of running Mule workloads on OpenShift. We show how to deploy Mule workloads on OpenShift using the certified MuleSoft Runtime Fabric (RTF) Operator. As an example, we deploy a Mule application on OpenShift to send JSON data over to Active MQ broker which is also deployed on OpenShift.


Installation of MuleSoft Anypoint Runtime Fabric (RTF) instance

Below is a high level diagram which summarizes the creation of RTF instance on OpenShift.

Diagram of MuleSoft on OpenShift

Prerequisites

You will need an enterprise MuleSoft account to have access to Runtime Fabric from Runtime Manager. With that enterprise account, from https://anypoint.mulesoft.com/ Anypoint platform, navigate to the Runtime Manager and then you will be able to create a Runtime Fabric instance.

Your MuleSoft account representative will help you acquire an Enterprise license in the form of a licence.lic file which will be needed for creating an RTF instance.

Have a running OpenShift cluster ready - whether it is on prem or on a public cloud.

Once you have the above prerequisites in place, follow the instructions listed on https://anypoint.mulesoft.com/cloudhub/#/console/home/runtimefabrics/list and create a Runtime Fabric by selecting "OpenShift" as the installation platform.

Then navigate to the Operator hub in the OpenShift cluster and install the RTF Operator. After the RTF Operator is installed, navigate to the Runtime Fabric namespace. Use the form view to create a RTF instance.

Fill the RTF instance form view with activation data from the Anypoint Runtime Fabric page, base64 encoded format of the license from the enterprise mule license file.

https://github.com/gskumar1010/mule-rtf-openshift/blob/main/installing-rtf-openshift/README.md has additional details with screenshots.

screenshot of project view in OpenShift

Create a Service account which can be used for running the RTF instance.

Before creating the RTF instance, toggle to the yaml view and add the service account. Then create the RTF instance.

Once all the pods in the “rtf” namespace are active and registered with Anypoint platform, in under 5 minutes the Runtime Fabric will become active in Anypoint platform.

From the above github repo, copy the ingress template yaml into your OpenShift cluster, modify the hostname by providing appropriate value and create an ingress. This will create an ingress in the “rtf” namespace. All Mule applications for this RTF instance will use this ingress.


Deploying example application

For this deployment, we are using the example from Anypoint Exchange. We customized it to connect to an Active MQ Broker running on OpenShift. Mule flow kicks in by receiving a HTTP request for Sales Data, converting it to JSON, and sending it to “Sales” Queue on Active MQ. These messages can then be viewed on the Admin console deployed using OpenShift routes.

Below is a high level diagram which summarizes the above example.

Summary diagram of deployment example for MuleSoft on OpenShift

Prerequisites

Once you have the above prerequisites in place, click “Deploy Application” and fill in details as shown below in your Anypoint Runtime Manager, under “Applications”.  Make sure to select the RTF instance in the Target section, and upload the previously saved JAR from the above step.

Go ahead and fill in the properties section, Active MQ details for your broker. Note that you can mask sensitive information. Once deployed, you should see the application as shown below. Allow a few minutes for RTF to connect to Openshift Instance and deploy the application.

Go to your OpenShift project created by RTF, and validate that the application pod, corresponding services/routes are created successfully.

OpenShift routes expose the http endpoint to the outside world, and we can test this endpoint by using CURL or Postman client.

Externalizing properties

In this example, to expose above http and Active MQ connection properties, configuration.xml has been updated as shown below in the Mule application. Configuration.xml
Above properties, will reflect as Config Map and Secrets on OpenShift project.
OpenShift Projects Screen with new configuration

Testing Mule Application

Once deployed successfully, we should be able to send a message to the HTTP  endpoint exposed by the OpenShift route, and the message gets published to Active MQ “sales” queue successfully.

Screenshot of console showing http messages

You should now see the published message on the “sales” queue on the Active MQ Admin console.

Conclusion

In this article, we discussed the value of running Mule workloads on OpenShift. We showed how to install Anypoint Runtime Fabric on OpenShift and deployed an example application.

You can work with a trusted ecosystem of system integrator partners like IBM, Accenture, Deloitte, CapGemini, and PWC who provide expertise in implementing MuleSoft and OpenShift platforms.

Please reach out to your alliance contacts or account teams from Red Hat or MuleSoft for more information.

Reference: