Contact Us 1-800-596-4880

Deploy Applications to On-Premises Mule Instances

Standard Support for Mule 4.1 ended on November 2, 2020, and this version of Mule reached its End of Life on November 2, 2022, when Extended Support ended.

Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted.

MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements.

In addition to using Anypoint Studio, Anypoint Runtime Manager, or the Anypoint Platform CLI to deploy applications on-premises, you can also deploy Mule applications by using the Mule Maven plugin. To do so, you must meet certain prerequisites, and configure the desired deployment strategy in your project’s pom.xml file.

When you deploy applications on-premises using the Mule Maven plugin, you can select three different methods for deployment:

  • Standalone deployment
    By using this method you perform a manual deployment of your Mule application to your on-premises Mule instance.

  • Runtime Manager REST API deployment
    This method enables you to deploy an application using the Runtime Manager REST API, which links your on-premises Mule instance with your Anypoint Runtime Manager account, where you can do further management and monitoring of your deployed application.

  • Runtime Manager Agent deployment
    This method enables you to deploy an application using the Runtime Manager agent, which exposes a local API that you can call to manage and monitor your deployed application.

The Mule Maven plugin also supports deploying domains when using the standalone deployment strategy, or the Runtime Manager agent deployment strategy.

Additional operations enable you to deploy applications in parallel and update applications at runtime.

Prerequisites

Deploy a Mule Application to a Standalone Mule Runtime Engine

Inside the plugin element, add a configuration for your standalone deployment, replacing the placeholder values with your local Mule runtime engine information:

<plugin>
Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::example$mmp-concept-config.xml[]
  <configuration>
    <standaloneDeployment>
      <muleHome>${mule.home.test}</muleHome>
      <muleVersion>${app.runtime}</muleVersion>
    </standaloneDeployment>
  </configuration>
</plugin>

From the command line in your project’s folder, package the application and execute the deploy goal:

mvn clean package deploy -DmuleDeploy

Standalone Deployment Parameters Reference

Parameter Description Required

standaloneDeployment

Top-Level Element.

Yes Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

muleVersion

The Mule version running in your local machine instance.
If this value does not match the Mule version running in your deployment target, the plugin raises an exception.

The Mule Maven Plugin does not download a Mule runtime engine if these values don’t match.

Yes

muleHome

The location of the Mule instance in your local machine.

Yes Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

Deploy a Mule Application Using the Runtime Manager REST API

Mule Maven plugin enables you to deploy a Mule Application to a local Mule instance using the Runtime Manager REST API.

Prerequisites

Deploying Using the Runtime Manager REST API

Inside the plugin element, add a configuration for your Runtime Manager deployment, replacing the placeholder values with your Runtime Manager information:

<plugin>
Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::example$mmp-concept-config.xml[]
  <configuration>
    <armDeployment>
      <muleVersion>${app.runtime}</muleVersion>
      <uri>https://anypoint.mulesoft.com</uri>
      <target>${target}</target>
      <targetType>${target.type}</targetType>
      <username>${username}</username>
      <password>${password}</password>
      <environment>${environment}</environment>
      <properties>
        <key>value</key>
      </properties>
    </armDeployment>
  </configuration>
</plugin>

From the command line in your project’s folder, package the application and execute the deploy goal:

mvn clean package deploy -DmuleDeploy

Authentication Methods

Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

For a detailed description of the configuration parameters, see the Runtime Manager REST API Deployment Parameters Reference.

Runtime Manager REST API Deployment Parameters Reference

Parameter Description Required

armDeployment

Top-Level Element.

Yes Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

muleVersion

The Mule version required for your application to run in your deployment target.
If this value does not match the Mule version running in your deployment target, the plugin raises an exception.

The Mule Maven Plugin does not download a Mule runtime engine if these values don’t match.

Yes

uri

The Anypoint Platform URI. If you are using Anypoint Platform PCE, specify this parameter with your Anypoint Platform installation URI.
If not set, by default this value is set to https://anypoint.mulesoft.com.

No

target

The server name for the server where your Mule instances are installed.

Yes

targetType

The type of target to which you are deploying.

Valid values are:

  • server

  • serverGroup

  • cluster

Yes

username

Your username for the server where your Mule instances are installed.

Only when using Anypoint Platform credentials to login.

password

Your password for the server where your Mule instances are installed.

Only when using Anypoint Platform credentials to login.

environment

The environment name for the server where your Mule instances are installed. This value must match any environment configured in your Runtime Manager account.
For Example:

<environment>Sandbox</environment>

Yes Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

Encrypt Credentials

Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

+

<plugin>
  ...
  <configuration>
    ...
    <armDeployment>
      ...
      <server>my.anypoint.credentials</server>
      ...
    </armDeployment>
    ...
  </configuration>
  ...
<plugin>

+ NOTE: Make sure that the username and password are not set in the deployment configuration, or they will overwrite the defined server ID.

Troubleshoot TLS Errors in Anypoint Private Cloud Edition

When trying to connect to an instance of Runtime Manager that’s on an Anypoint Platform Private Cloud Edition installation, the plugin validates certificates for that server. If you haven’t installed the server certificates in your truststore, an SSL error occurs. To avoid this problem, you can run the plugin in an insecure mode, which skips the security validations. You can use the armInsecure tag or the arm.insecure system property.

Enabling an insecure connection is a dangerous practice. Don’t use this unless you know what you are doing and your On-Premises installation is isolated in a local network.

See the configuration example below:

<plugin>
Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::example$mmp-concept-config.xml[]
  <configuration>
    <armDeployment>
        <target>${target}</target>
        <targetType>${target.type}</targetType>
        <username>${username}</username>
        <password>${password}</password>
        <environment>${environment}</environment>
        <armInsecure>true</armInsecure>
    </armDeployment>
  </configuration>
</plugin>

Deploy a Mule Application Using the Runtime Manager Agent

Inside the plugin element, add a configuration for your Runtime Manager agent deployment, replacing the URI value with your remote server information:

<plugin>
Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::example$mmp-concept-config.xml[]
  <configuration>
    <agentDeployment>
      <uri>http://localhost:9999/</uri>
    </agentDeployment>
  </configuration>
</plugin>

From the command line in your project’s folder, package the application and execute the deploy goal:

mvn clean package deploy -DmuleDeploy

Runtime Manager Agent Deployment Parameters Reference

Parameter Description Required

agentDeployment

Top-Level Element.

Yes Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

muleVersion

The Mule version required for your application to run in your deployment target.
If this value does not match the Mule version running in your deployment target, the plugin raises an exception.

The Mule Maven Plugin does not download a Mule runtime engine if these values don’t match.

Yes

uri

The server URI where your Mule instances are installed.

Yes Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[] Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::partial$mmp-concept.adoc[]

Deploy a Domain

The Mule Maven plugin supports deploying domains only when using the standalone deployment strategy, or the Runtime Manager agent deployment strategy.

To deploy a domain, use the same configuration and deployment steps you use when deploying an application. For example, to deploy a domain to a standalone instance:

  1. Inside the plugin element, add a configuration for your standalone deployment, replacing the placeholder values with your local Mule runtime engine information:

    <plugin>
    Unresolved include directive in modules/ROOT/pages/deploy-on-premises.adoc - include::mule-runtime::example$mmp-concept-config.xml[]
      <configuration>
        <standaloneDeployment>
          <muleHome>${mule.home.test}</muleHome>
          <muleVersion>${app.runtime}</muleVersion>
        </standaloneDeployment>
      </configuration>
    </plugin>
  2. From the command line in your project’s folder, package the domain and execute the deploy goal:

    mvn clean package deploy -DmuleDeploy

Deploy Applications in Parallel

You can deploy applications in parallel to on-premises Mule instances. Deploying applications in parallel reduces the startup time when you deploy a large number of apps. To prevent deployment failure, ensure that applications are not dependent on each other because a particular start order cannot be guaranteed.

To enable parallel deployment:

  1. Package or export your Mule applications to the /apps directory of your Mule runtime engine instance.

  2. Start Mule using the -M-Dmule.deployment.parallel option:

    mule -M-Dmule.deployment.parallel

After performing these steps, Mule deploys in parallel all applications in the /apps directory.

Update Applications at Runtime

Updating a Mule application at runtime can be a complex change involving class modifications, endpoint modifications (for example, changing ports), and reconfiguring flows. An application update first performs a graceful app shutdown and then reconfigures itself in the background within seconds. This process is transparent for the users.

There are two ways you can update an application:

  • By adding the modifications over an existing unpacked app folder and touching the main configuration file (mule-config.xml located in the app’s root directory by default).

  • By adding a new jar with an updated version of the app into the $MULE_HOME/apps directory. Mule detects the jar as an updated version of an existing application and ensures the update by a clean redeployment of the app.
    Note that Mule discards any modifications to the old application folder. The new app folder is a clean unpacked application from a jar.

Either method integrates well with existing build tools.