MuleSoft from Start: A Beginner’s Guide — Session 7: Deploy the Mule App to CloudHub
In the last session, we reviewed how to implement the articles logic, created a Postman collection with its local+dev environments, and learned how to debug our Mule application.
In this week’s session, we confirmed the API works locally, so we deployed it to CloudHub (located in Runtime Manager) to test it in the dev environment.
Note: The links and notes from the session have been added to the GitHub repository for you to follow through with what I’m doing in the video. You can find both recordings (the complete and the shorter one) at the end of the post.
Homework from the last session
In the last session, we had started our Postman collection and we did the articles requests. Your homework was to finish creating the other requests to match our API specification. You should now have something similar to this:
You can also just import the Postman collection from the repo here.
Testing locally
You can download this Mule project if you want to follow along with what we did in this session. In summary, the API already works for the articles and categories resources. We can run this application locally and use our Postman collection with the local environment to verify it works.
Once we have verified we do have the functionality we need, we can move on to deploying this app to CloudHub.
Deploying to CloudHub
We’re going to deploy this application manually from Anypoint Studio. For this, you have to right-click on your project and select Anypoint Platform > Deploy to CloudHub.
If you haven’t signed in to your Anypoint Platform account, it will ask you to sign in at this point.
If you experience some issues at this point, you can also go to Anypoint Studio > Settings and navigate to Anypoint Studio > Authentication.
You can remove and re-add your Anypoint Platform credentials and try to deploy again. Any issues should be fixed with this.
Make sure you have selected the latest runtime version and check the Object Store v2 checkbox.
Because we have different properties per environment (local and dev) in our Mule application, we have to make sure our environment property is correctly updated. In our case, we have to set the env property to dev.
After confirming those changes, you can deploy your application.
You can confirm that your application is being deployed in Runtime Manager. Once it’s running, you can retrieve the Public Endpoint to replace the URL in your Postman environment to test.
You can also find this CloudHub URL from the Dashboard view.
Once you have copied the URL, you can go to Postman and replace it in the dev environment. Make sure you add /api at the end of the URL. For example https://maxines-blog-p9b1jf.5sc6y6-1.usa-e2.cloudhub.io/api
Now you just have to switch the environment from local to dev in Postman and you’ll be able to test the requests in CloudHub.
Recordings
Finally, here are the two recordings you can find about this session.
Here you can find the shorter version from YouTube:
And here you can find the complete video from Twitch (note that there are two videos this time because my internet was acting up so the live stream was split in two 🥹):
Please let me know if you have any comments, suggestions, or just general feedback for me!