Deploy Applications to Runtime Manager using Anypoint CLI
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
- Download and install NodeJS, if not installed already
- Once installed, run the following command to install Anypoint CLI, npm install -g anypoint-cli@latest
First, log in to the Anypoint Platform Account from CLI using the following command, anypoint-cli –username=”user”
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
Run the following command to deploy the Application to CloudHub.
runtime-mgr cloudhub-application deploy “app-name” “JAR or ZIP location”
Options available for deployment command
The deployment command lets us manage all the aspects of deployment via CloudHub. Following are the options provided-
- –runtime: Option to specify the Mule Runtime. Default is the latest one.
- –workers: Number of workers. 1 by default.
- –workerSize: Worker Size in vCores. 1 by default.
- –region: Region where Application will be deployed. us-east-2 is default.
- –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.
- –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”
- –persistentQueues: Enable or disable persistent Queues. Value can be True or False. False by default.
- –persistentQueuesEncrypted: Enable or disable persistent queue encryption. Value can be True or False. False by default
- –staticIPsEnabled: Enable or disable static IPs. Value can be True or False. False by default
- –objectStoreV1: Enable or disable object store v1. Value can be True or False. False by default
- –autoRestart: Automatically restart app when not responding. Value can be True or
- –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.
- –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”
- –help: Outputs usage information
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.