MuleSoft offers several deployment options. They can be broadly categorized into three groups - CloudHub,
hybrid, and on-prem.
Irrespective of the option chosen, the Mule runtime server is at the core of the infrastructure and is
responsible
for executing the Mule flows, making the endpoints available, running other supporting Mule components,
connecting
to the control plane, etc.
If an application is deployed into CloudHub, the Mule application is containerized with the Mule runtime and
then deployed
to the cluster. However, if one has their bare metal servers and wants to run the Mule application, the Mule
runtime server needs to be installed, configured, and activated with the Mule license key.
In this blog, we will focus on how to install a Mule runtime server on a system and then deploy applications
to it. We won’t
be covering the DNS part or the load balancer. At the end of the article, you should be able to configure
your
single instance of the Mule runtime, deploy applications to it, and access the endpoints at localhost.
Advantages of Mule on-premise
Mule on-premise provides complete control over the Mule instance when applications are deployed on-premise,
enabling the
user to take advantage of the following features:
-
Creating a common domain to define configurations that can be referenced by multiple applications, and
all applications are
deployed together within that domain. By default, the application references the default domain unless
defined
as a common domain. It enables exposure to different services in different projects through the
configured
HTTP host and port without causing conflicts.
- A Mule instance can run different versions of an application.
- Mule runtime engine reloads the application’s configuration changes automatically without
stopping the
service.
- In an on-premise environment, enterprises maintain all their data and are in full control. Companies in
highly
regulated industries with extra privacy concerns can go with an on-premise deployment.
- In an on-premise environment, there is an additional cost for the load balancers, firewalls, and all the
other
network components that might be necessary to make your application compliant with your company and
client
standards, in addition to the MuleSoft license price.
- Furthermore, the installation will take place in the organization’s data center; one would be
responsible
for ensuring that it’s done correctly and properly maintained for the entire lifetime of the
enterprise’s
Enterprise Server Bus (ESB) needs.
In the below sections, we will focus on three aspects:
- Installation
- Deployment
- Connecting the on-prem runtime plane to the CloudHub control plane
Setting up the Mule 4 on-premise server
Steps:
-
Download mule 4 standalone setup, as
shown in the below image
- After downloading the set-up, unzip the downloaded file.
- Set up the environment variable, create a new environment variable, and set the location of the
downloaded on-premise
setup file.
- To start the standalone runtime, navigate to the
{mule-enterprise-standalone-version}/bin folder. Open and run the command
‘mule.bat’ in the command prompt (this will run the Mule runtime in console
mode; there
are options to run the Mule runtime as a Windows service too).
- Once it is deployed, your Mule on-premise server is set up.
Deploying an application in the Mule standalone runtime
Steps:
- Export the project from Anypoint Studio as a Mule application deployable archive and create a jar.
- Copy the jar file to the
{mule-enterprise-standalone-version}/apps folder.
- As you can see, your Mule standalone runtime is running and the application is deployed with Mule
standalone
runtime. You can use and test the application.
Connecting the Mule standalone runtime to the Anypoint Platform runtime manager:
Steps:
- A prerequisite for this is valid Anypoint Platform credentials.
- Go to the
Runtime Manager > Servers.
- Click on
Add Server. Define a unique name for your server, and click on the
Copy command.
Note: Remove ./ (As we are executing in Windows not in Linux machine) from the command line and execute
in command prompt
- Navigate to the
{mule-enterprise-standalone-version}/bin folder and in the command prompt, run the
command copied
from the runtime manager.
- This command will install the Mule agent. Create the $MULE_HOME/conf/mule-agent.yml with the
configuration options
you specified, and establish the communication between Anypoint Platform control plane on-prem Mule 4
runtime.
- An on-prem server is added to the runtime manager but is not running.
- To start the server, navigate to the
{mule-enterprise-standalone-version}/bin folder, and in the command prompt, run the
command
‘mule.bat’
- Go to
Runtime Manager > Servers. The status of the on-prem server is running
Deploying application on the standalone server using Runtime Manager:
- If you go to
Runtime Manager and click on
Deploy Application, there is one more option available in the
Deployment Target, i.e., the on-prem server
- Select that server as the deployment target, add the jar of your application, and the application will
be deployed
successfully
- If you go to
{mule-enterprise-standalone-version}/apps folder, , you can see the new folder is
created with the
application’s name, which is deployed on an on-prem server using runtime manager and also an
anchor
file for that application.
- To stop the standalone runtime, press
Ctrl + c.
Conclusion
Deciding on using an on-prem deployment model at times is an unavoidable necessity. But maintaining your
infrastructure can
present a lot of maintenance challenges. Patches, upgrades, DMZ, load balancers, DNS - all become your
responsibility.
Nevertheless, at times it makes better sense when data security and sensitive APIs are involved. Mule
runtime
server is at the heart of the Mule operations and this presents only an overview of things. You can refer to
MuleSoft documentation for extensive information.