MuleSoft Technical Guides

Deploy Applications to Runtime Manager using Anypoint CLI

User MuleSoft Integration Team
Calendar April 08, 2021

MuleSoft Anypoint Platform provides a command-line tool to work with the Anypoint platform and Anypoint Platform Private Cloud Edition. We can deploy applications to Runtime Manager using Anypoint CLI tool.

 

Setting up Anypoint CLI

  1. Download and install NodeJS, if not installed already
  2. Once installed, run the following command to install Anypoint CLI, npm install -g anypoint-cli@latest

Deploying Application

First, log in to the Anypoint Platform Account from CLI using the following command, anypoint-cli –username=”user”

CLI login

If a production environment is available, CLI will connect to that; otherwise, it will connect to the Design environment. To switch the environment, use the below command

use environment Sandbox

cli-switch-env.

Run the following command to deploy the Application to CloudHub.

runtime-mgr cloudhub-application deploy “app-name” “JAR or ZIP location”

cli-arm-deploy-app

Options available for deployment command

The deployment command lets us manage all the aspects of deployment via CloudHub. Following are the options provided-

  1. –runtime: Option to specify the Mule Runtime. Default is the latest one.
  2. –workers: Number of workers. 1 by default.
  3. –workerSize: Worker Size in vCores. 1 by default.
  4. –region: Region where Application will be deployed. us-east-2 is default.
  5. –property: Specify a property in key-value pair. E.g. –property “password=1234” or –property “password:1234”. To pass more than one, specify –property option for each one. The document specifies that only “:” can be used for key-value pairs but “=” also works.
  6. –propertiesFile: If provided, values from the file will overwrite all the properties, even those which are not in the file. Syntax: –propertiesFile “D:\file\prop.txt”
  7. –persistentQueues: Enable or disable persistent Queues. Value can be True or False. False by default.
  8. –persistentQueuesEncrypted: Enable or disable persistent queue encryption. Value can be True or False. False by default
  9. –staticIPsEnabled: Enable or disable static IPs. Value can be True or False. False by default
  10. –objectStoreV1: Enable or disable object store v1. Value can be True or False. False by default
  11. –autoRestart: Automatically restart app when not responding. Value can be True or
  12. –o/–output: Specifies the output format for deployment summary. Supported values are table, text and JSON. For interactive mode ‘table’ is default whereas for non-interactive, text is default.
  13. –f/–fields: Specifies the fields in the output. Multiple fields can be provided using comma separated values to limit the output. E.g -f “File Name,Region”
  14. –help: Outputs usage information

cli-rm-deploy-help

Managing the deployed Application

Below are a few CLI commands to manage deployed applications.

#To Stop Application

runtime-mgr cloudhub-application stop “app-name”

#To Start Application

runtime-mgr cloudhub-application start “app-name”

#To restart Application

runtime-mgr cloudhub-application restart “app-name”

#To Delete Application

runtime-mgr cloudhub-application delete “app-name”

#To Modify the existing Application. This command takes all the options as a deploy command.

runtime-mgr cloudhub-application modify “app-name” [options]

 

By following these steps developers can Deploy Applications to Runtime Manager using Anypoint CLI.

Find more MuleSoft Anypoint solutions at Caelius Consulting Resource Center. 

 

Leave a comment

Your email address will not be published. Required fields are marked *