Mule Application Build & Deployment Phase

Automating the Mule Application Build & Deployment Phase

MuleSoft provides Maven plugins that can automate the creation of a new build triggered on every project change on different run-time environments. 

There are various ways to install Mule Runtime: 

  • Standalone Server
  • Cluster
  • CloudHub
  • Server Group

This article will outline a detailed step-by-step guide on configuring a Jenkins and Mule Maven project for continuous integration and delivery. We will also demonstrate two deployment process scenarios, one for a standalone Mule runtime server and another on CloudHub.

Installation Prerequisites

  1. Jenkins 2.190.2
  2. Mule Runtime 3.9.3
  3. Maven 3.6.2
  4. Java 1.8
  5. Git 2.23.0
  6. Bitbucket for code repository
  7. Source tree to commit the code 
  8. Postman

Important Note: In order to connect and fetch resources from the Enterprise Maven Repository, you should contact the mule support center to receive your Enterprise Maven credentials and that will need to be entered into your settings.xml file (usually present within the $USER_HOME/.m2/ directory on your machine).

Procedure:

1. Configure maven:

  • Download maven and set the environment variable

2. Configure settings.xml:

  • Go to your $USER_HOME/.m2/ directory.
  • Open settings XML adds the following section within the <servers> tag and replace YOUR_ID and YOUR_PASSWORD with the credentials provided to you by MuleSoft Support.
  • Add the following section within the <profiles> tag to point to the location of the Enterprise Repository, referencing the same name above “Any Name”:

3. Download Git and set the environment variable

4. Install and Configure Jenkins:

  • Download and Install the Jenkins
  • Login into Jenkins
  • Create Jenkins credentials
  • Installed maven, git, and pipeline plugin
  • Go to Global Tool configuration and add the maven, JDK, and git path
  • Create a Jenkins Item with the necessary details
5. Create Mule-Maven Application

  • Add the below plugin to the pom.xml file
  • In the property file, add the Anypoint username, password, and environment.

CloudHub

Mule Standalone Server

6. Commit Code: Make some changes in the code and commit the code into the Bitbucket repository through SourceTree. The Jenkins job will start automatically, and the mule application will be deployed/redeployed in the Cloudhub and Standalone Mule runtime.

7. Check the Jenkins Deployment Result

8. Application Testing: Test the application through postman.

Conclusion

There are many advantages of automated deployment to different environments triggered by changes:

  • Increase the chances of Go-to-market faster
  • Release more often
  • Configure it once
  • Developers can develop
  • Anyone can deploy
  • Chances of error are reduced
  • Immediate feedback