DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Delivering Your Code to the Cloud With JFrog Artifactory and GitHub Actions
  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Java CI/CD: From Local Build to Jenkins Continuous Integration
  • Travis CI vs Jenkins: Which CI/CD Tool Is Right For You?

Trending

  • AI Meets Vector Databases: Redefining Data Retrieval in the Age of Intelligence
  • Unlocking AI Coding Assistants Part 4: Generate Spring Boot Application
  • Docker Base Images Demystified: A Practical Guide
  • How Large Tech Companies Architect Resilient Systems for Millions of Users
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. CI/CD: 5 Simple Steps To Deploy a Mule 4 Application in CloudHub Using Jenkins and GitHub

CI/CD: 5 Simple Steps To Deploy a Mule 4 Application in CloudHub Using Jenkins and GitHub

This article shows you how simple it is to deploy a MuleSoft Application on Cloudhub with the help of Jenkins. This process is something we call a CI/CD process.

By 
Sravan Lingam user avatar
Sravan Lingam
DZone Core CORE ·
Jan. 21, 21 · Tutorial
Likes (7)
Comment
Save
Tweet
Share
14.6K Views

Join the DZone community and get the full member experience.

Join For Free

This article will show you how simple it is to deploy a MuleSoft Application on Cloudhub with the help of Jenkins. This process is something we call a CI/CD process.

Before getting started, please watch the below video on how to commit our code in the GitHub repository.

 

Make sure that you add the below configuration details in your configuration tab in your pom.xml of the Mule app:

XML
 




x


 
1
<cloudHubDeployment>
2
                        <uri>https://anypoint.mulesoft.com</uri>
3
                        <muleVersion>${mule.version}</muleVersion>
4
                        <username>${anypoint.username}</username>
5
                        <password>${anypoint.password}</password>
6
                        <environment>${env}</environment>
7
                        <applicationName>${appname}</applicationName>
8
                        <businessGroup>${business}</businessGroup>
9
                        <workerType>${vCore}</workerType>
10
                        <workers>${workers}</workers>
11
                        <objectStoreV2>true</objectStoreV2>
12
</cloudHubDeployment>



Basically, the hero of this process is the mule maven plugin. This helps in establishing the process connection between Jenkins and Anypoint Runtime Manager. So let's get started.

Step 1 

Install Jenkins from https://www.jenkins.io/download/. Choose the correct OS and install accordingly. While installing Jenkins it may ask you to select the port for localhost. By default, it says 8080. If 8080 is available, test it and then proceed. Create a user when it prompts. Now your login page will have http://locahost:8080/ with a username and password.

Step 2

Install JAVA, Git, and Maven on your system. Add necessary system variables for installation. Make sure you know where Git and Maven are installed so that you can implement the Jenkins configuration. If it’s not installed in Program Files, then you might have to specify their installation paths (eg: /../Git/bin) in Global Jenkins Configuration.

Make sure you run the below commands on CMD (if windows) or Terminal (if Mac) to check the status of installations:

For Java:  java -version

For Maven: mvn –-version

For Git: git --version

Step 3

The reason why we require these installations is Anypoint Studio comes with Java and Maven built-in by default. So when you run your application, it will deploy successfully, but Jenkins is something we are executing out of Anypoint studio. So to run Mule App externally, we need Java and Maven to be installed on your local system wherever you are setting up Jenkins.

Step 4

After you log in to http://localhost:8081. Click on create Job --> Give a name (preferred project name) and select Freestyle Project.

Now you will find different sections. For simple deployment, use the below config details:

  • General Section: Add a description
  • Source Code Management: If you see "None," then please install the GitHub Plugin. To do so, go to the Jenkins home page and click Manage Jenkins, which is on the left side. Click on Manage Plugin and search for GitHub in Available Filter Mode.
    • Once you see the Git option, enter details like the Git repo link to your project. This will be your Clone URL.
    • Add Git Credentials

Source Code Management Screenshot

  • Build: Select Execute Windows batch command if you are using Windows OS or select Execute Shell command if using Mac or Linux OS

Use the below command:

Shell
 




xxxxxxxxxx
1


 
1
mvn clean deploy -DmuleDeploy -DskipTests -Dmule.version=4.3.0 
2
-Danypoint.username=yourusername -Danypoint.password=yourpassword
3
 -Denv=Sandbox -Dappname=myfirst -Dbusiness=MuleSoft -DvCore=Micro
4
 -Dworkers=1 -DaltDeploymentRepository=myinternalrepo::default::file:///C:/snapshots



Execute Windows batch command screenshot

Step 5 

Now save the config details and click on Apply. Then go to the project and click on the Build Now option to start deploying your application. You can see the logs in console output. You can observe that your application is automatically deployed in CloudHub without this manual process like logging in to an Anypoint platform, choosing env, and deploying the app.

This is a simple way to deploy an Application into Cloudhub using Jenkins. Hope you liked it!

Want a step-by-step? Watch the process from the below video:

Continuous Integration/Deployment Jenkins (software) application GitHub

Opinions expressed by DZone contributors are their own.

Related

  • Delivering Your Code to the Cloud With JFrog Artifactory and GitHub Actions
  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Java CI/CD: From Local Build to Jenkins Continuous Integration
  • Travis CI vs Jenkins: Which CI/CD Tool Is Right For You?

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!