MuleSoft installation guide — onPremises

  • June 27, 2022

In this article, we’ll learn how to add a Mule 4 standalone runtime as an additional server in Anypoint Platform.

Install AdoptOpen JDK

Before installing Mule, make sure you have a supported version of Java on your system. JDK 1.8.0 is recommended to successfully install Mule on your system. If you don’t have it installed, follow the steps below:

Step 1. Download Adopt OpenJDK from https://adoptopenjdk.net/; for this installation, we used OpenJDK 11

Step 2. Install the OpenJDK11; while installing, select the “Set JAVA_HOME” option

Step 3. Verify the installation is successful; in CMD the prompt, give the command “java-version”

Setup Mule Runtime

Download the Mule 4 binary file by following the steps below:

Step 1. Download Mule 4 standalone runtime from the support portal: https://help.mulesoft.com/s/downloads?tabset-169e6=2

Step 2. Select and download mule-ee-distribution-standalone-4.3.0-20210119.zip

Step 3. Extract the contents of the zip file to a location

Step 4. Create a system variable — MULE_HOME — for the extracted files location

Step 5. Carefully update the max memory size and metaspace size in the relevant sections in:

C:\MuleHome\conf\wrapper.conf file

wrapper.java.additional.7=-XX:MetaspaceSize=256m wrapper.java.additional.8=-XX:MaxMetaspaceSize=4096m

wrapper.java.initmemory=2048 wrapper.java.maxmemory=8192

3. Apply license

Acquire and install a non-trial Enterprise license before you use Mule runtime in a production environment by following the steps below:

Step 1. Go to the company support portal and download the relevant license file

Step 2. Copy the license.lic file to the C:\MuleHome\bin folder

Step 3. Go to C:\MuleHome\bin in the command prompt and install the license

4. Install Mule Runtime as a Windows Service

The main purpose of this section is to ease the process of execution. You can start, stop and restart without using the command prompt.

Step 1. Go to C:\MuleHome\bin in the command prompt and execute the command “mule install” to install Mule as service

Step 2. Type “services.msc” in the Windows Run dialog and verify Mule Enterprise is installed as a service; ensure the service is Automatic Type and then start the service

Step 3. Verify Mule Runtime has started by verifying the E:\MuleHome\logs\mule_ee.log file

5. Add the server to the Anypoint Platform Runtime Manager

This section guides you through adding a server to the Runtime Manager.

Step 1. Log in to Anypoint Platform; go to the Runtime Manager, click Servers and ensure the correct environment is set

Step 2. Click Add server; a popup window will appear; provide a relevant server name

Step 3. Go to the directory where you extracted your mule-runtime zip file; go to the bin directory and execute the command you copied from the prior popup window; remove ./ from the command before executing the command. The Mule runtime agent will install after executing this command.

Once the Mule Runtime Agent is installed, you’ll see that one server with your given name has been created in the Runtime Manager with status CREATED

Step 4. Add an encryption key in the wrapper.conf of Mule Runtime: MuleRuntime-Dev\mule\conf\wrapper.conf

This is the environment-specific encryption key. The command below is for the development environment. The same can be used in different environments, but the value must be changed.

wrapper.java.additional.24=-Dmule.env=******

wrapper.java.additional.25=-Dkey=******

Step 5. Restart Mule Runtime from services.msc in the server and note that the server is listed as Running in Anypoint Platform

6. Mitigate the Log4j2 vulnerability (for Mule Runtime 4.3.0)

Recently, we faced the log4j2 vulnerability. To mitigate that, follow the steps below:

Step 1. Stop your Mule Runtime

Step 2. Download the Log4j version 2.17.x libraries from the Apache website

Step 3. Remove and create a backup of the following jar files before replacing them in C:\ImportantBackup location:

${MULE_HOME}/lib/boot/log4j-1.2-api-2.x.x.jar

${MULE_HOME}/lib/boot/log4j-api-2.x.x.jar

${MULE_HOME}/lib/boot/log4j-core-2.x.x.jar

${MULE_HOME}/lib/boot/log4j-slf4j-impl-2.x.x.jar

Step 4. Remove and create a backup of the following jar files if no cumulative patches (provided by MuleSoft) are required before replacing them in C:\ImportantBackup location:

${MULE_HOME}/services/mule-service-weave-ee-2.x.x/lib/log4j-api-2.x.x.jar

${MULE_HOME}/services/mule-service-weave-ee-2.x.x/lib/log4j-core-2.x.x.jar

Step 5: Extract the downloaded Log4j version 2.17.x libraries. Copy the respective libraries from the downloaded 2.17 version.

apache-log4j-2.17.0-bin/log4j-1.2-api-2.17.x.jar to ${MULE_HOME}/lib/boot

apache-log4j-2.17.0-bin/log4j-api-2.17.x.jar to ${MULE_HOME}/lib/boot

apache-log4j-2.17.0-bin/log4j-core-2.17.x.jar to ${MULE_HOME}/lib/boot

apache-log4j-2.17.0-bin/log4j-slf4j-impl-2.17.x.jar to ${MULE_HOME}/lib/boot

Step 5. If no cumulative patches (provided by MuleSoft) are required, copy the respective libraries from the downloaded 2.17 version:

Copy apache-log4j-2.17.0-bin/log4j-api-2.17.0.jar to ${MULE_HOME}/services/mule-service-weave-ee-2.x.x/lib/

Copy apache-log4j-2.17.0-bin/log4j-core-2.17.0.jar to ${MULE_HOME}/services/mule-service-weave-ee-2.x.x/lib/

Step 6. Restart your Mule Runtime

7. Create a cluster

A cluster is a set of up to eight servers that act as a single deployment target and high-availability processing unit. There are two different types of clusters: Unicast and Multicast. For now, we’ll learn how to set up a Unicast cluster.

A Unicast cluster requires you to configure the IP addresses of the nodes in the cluster. If a server has multiple interfaces, use the internal IP address that allows the node to communicate directly with other nodes. Clustering across different subnets isn’t supported.

Because Mule relies on the IP address to identify the server, IP addresses can’t be dynamically assigned using DHCP for servers on a Unicast cluster. If a server is restarted and uses DHCP to get a new IP address, you must add the server to the cluster using its new IP address.

The server status must be Running to be added to a Unicast cluster.

Step 1. Ensure the ports are open in the firewall in the participating servers using Telnet; look for all three ports — 5701, 5702 and 5703 — for both servers. If the command prompt shows a blank screen after running the appropriate command, then the given port is open

Step 2. Go to the Runtime Manager and click Servers in the appropriate environment; add one more server by performing all the previous steps and configurations

Step 3. Click Create Cluster and provide the required values; at the bottom of the page, click Create Cluster

Step 4. Verify that the cluster has been created

8. Deploy POC

Now let’s try to deploy a simple project.

Step 1. Put the jar file of the Domain Project in the domains folder of any of the Mule Runtimes

Step 2. Deploy the application from Anypoint Platform

Step 3. Check the status of your application; it will be in a running state

9. Verify Mule Runtime Service

To verify the status of your Mule Runtime in RDP, open Windows Services and search for Mule Enterprise Edition. If in the Status section it shows as Running, then start/restart the Mule server. The same action can be performed for the other servers.

— By Anjali Kushwaha