An overview of MuleSoft workloads running on the OpenShift Container Platform
Mule workloads on OpenShift
This blog post’s goal is to demonstrate to readers the benefits of running Mulesoft workloads on OpenShift. Container Platform. We demonstrate how to use the licensed MuleSoft Runtime Fabric (RTF) Operator to deploy Mule workloads on OpenShift. As an example, we set up a Mule application on OpenShift so that it can send JSON data to an Active MQ broker that is also set up there.
The Anypoint Platform from MuleSoft is a platform for managing API integration. Mule application orchestration and deployment are automated using Anypoint Runtime Fabric (RTF), a container service. MuleSoft customers now have the option of deploying their containerized workloads anywhere OpenShift can be deployed, whether it be on-premises or on a public cloud of their choosing, thanks to the release of the certified MuleSoft Runtime Fabric Operator (either as RedHat managed or self-managed).
MuleSoft Anypoint Runtime Fabric (RTF) instance installation
A high-level diagram describing the creation of an RTF instance on OpenShift may be found below.
Prerequisites
Runtime Manager’s access to Runtime Fabric requires an enterprise MuleSoft account. You can build a Runtime Fabric instance using that enterprise account by going to the Runtime Manager on the Anypoint platform at https://anypoint.mulesoft.com.
A license.lic file, which is required to create an RTF instance, can be obtained with the aid of your MuleSoft account representative.
Be prepared with an active OpenShift cluster, whether it is on-prem or in a public cloud.
Following the directions on https://anypoint.mulesoft.com/cloudhub/#/console/home/runtimefabrics/list, build a Runtime Fabric by selecting “OpenShift” as the installation platform once you have the aforementioned prerequisites set up.
Install the RTF Operator by going to the Operator hub on the OpenShift cluster. Go to the Runtime Fabric namespace after installing the RTF Operator. Create an RTF instance using the form view.
The activation information from the Anypoint Runtime Fabric page and the base64-encoded license from the enterprise mule licensing file should be filled up in the RTF instance form view.
More information and examples can be found at https://github.com/gskumar1010/mule-rtf-openshift/blob/main/installing-rtf-openshift/README.md.
The RTF instance can be run using the Service account you create.
You need to switch to the yaml view and add the service account before establishing the RTF instance. Create the RTF instance after that.
The Runtime Fabric will become active in the Anypoint Platform in less than 5 minutes after all the pods in the “rtf” namespace are active and registered.
Copy the ingress template yaml from the above GitHub repository into your OpenShift cluster, change the hostname by entering the proper value, and then create an ingress. The “rtf” namespace will experience an ingress as a result. This ingress will be used by all Mule applications for this RTF instance.
Deploying example application
We are utilizing the Anypoint Exchange example for this setup. To connect to an Active MQ Broker running on OpenShift, we modified it. When Mule receives an HTTP request for sales data, it transforms the request into JSON and sends it to the “Sales” queue on Active MQ. These notifications can then be accessed on the OpenShift routes-deployed admin dashboard.
The above example is summarised in the high-level diagram that is provided below.
Prerequisites
- From https://github.com/gskumar1010/mule-rtf-openshift/tree/main/mule-examples, download the JAR file for this example.
- Go onto your Anypoint platform and navigate to the RTF instance you generated to run the application just as is. For the installation of RTF, see the section above.
- Make certain that an Active MQ Broker is active. Visit https://access.redhat.com/documentation/en-us/red hat amq/7.7/html/deploying amq broker on openshift/index for more information.
Once the above conditions are met, click “Deploy Application” in your Anypoint Runtime Manager’s “Applications” section and enter the information as shown below. Make sure to upload the already saved JAR from the previous step and to choose the RTF instance in the Destination area.
Fill out your broker’s Active MQ details in the properties area. Remember that you can conceal important data. When the application is deployed, it should look like the one below. Give RTF some time to establish a connection with the Openshift Instance and deploy the application.
Check the OpenShift project you built using RTF to make sure the application pod and any associated services or routes were successfully generated.
The HTTP endpoint is made accessible to the outside world using OpenShift routes, and we can test it using the CURL or Postman client.
Externalizing properties
In this example, configuration.xml has been modified as shown below in the Mule application to provide the above http and Active MQ connection properties.
On an OpenShift project, the above properties will appear as Config Map and Secrets.
Mule application testing
When the deployment is complete, we should be able to send a message to the HTTP endpoint that the OpenShift route exposes, and the message should successfully publish to the Active MQ “sales” queue.
On the “sales” queue in the Active MQ Admin panel, you should now be able to see the published message.
Conclusion
We spoke about the advantages of using OpenShift to run Mule workloads in this blog. We installed an example application while demonstrating how to install Anypoint Runtime Fabric on OpenShift.