anypoint-cli runtime-mgr application list --environment Production

MuleSoft
Production Surface

anypoint-cli for interactive ops and environment promotion. Mule Maven Plugin for reproducible CI/CD deployments. Two tools, one pipeline.

20 entries
6 phases
anypoint-cli 3.x, Mule 4.x
Two tools, different jobs. anypoint-cli is for interactive ops: status checks, log retrieval, environment promotion, API management. It's what you reach for during an incident. Mule Maven Plugin (mvn mule:deploy) is for CI/CD: reproducible, parameterised, pipeline-driven deployments. Never deploy to production by hand when a Maven plugin can do it from a locked-down pipeline.

Auth: Always use Connected App credentials (client_credentials) in CI, not username/password, which is being deprecated. Username/password is acceptable for local anypoint-cli use only.
cross-cutting: know these before anything else
anypoint-cli auth
anypoint-cli --client_id $CLIENT_ID --client_secret $CLIENT_SECRET runtime-mgr application list anypoint-cli conf set username me@example.com anypoint-cli conf set environment Production anypoint-cli conf set organization MyOrg # conf stored in ~/.anypoint/credentials
Maven plugin auth (CI)
pom.xml deployment config: <connectedAppClientId>${client.id}</connectedAppClientId> <connectedAppClientSecret>${client.secret}</connectedAppClientSecret> <connectedAppGrantType>client_credentials</connectedAppGrantType> # pass via: mvn mule:deploy -Dclient.id=$ID -Dclient.secret=$SECRET # NEVER hardcode credentials in pom.xml
MuleSoft Exchange Maven repo
~/.m2/settings.xml: required for plugin + deps: <server> <id>anypoint-exchange-v3</id> <username>~~~Client~~~</username> <password>${client.id}~?~${client.secret}</password> </server> # plugin pulls from MuleSoft's private repo, not Maven Central
environments
anypoint-cli runtime-mgr application list --environment Sandbox anypoint-cli runtime-mgr application list --environment Production # --environment must match exactly (case-sensitive) # environments defined in Anypoint Platform Access Mgmt anypoint-cli account environment list
green = anypoint-cli shell command orange = Maven / mvn command yellow = pom.xml / config snippet
Phase 20 shown
Tool / ConceptPhaseKey commandsUse case
app list / status deploy
anypoint-cli runtime-mgr application list --environment Production --output table anypoint-cli runtime-mgr application describe --environment Production myapp anypoint-cli runtime-mgr application status --environment Production myapp anypoint-cli runtime-mgr application list --environment Production --output json | jq '.[] | select(.status != "STARTED") | {name,status}'
First commands during an incident: surfaces which apps are not STARTED. describe shows full deployment config including worker size, region, and environment variables (values masked). The jq filter on JSON output surfaces unhealthy apps across the entire environment in one call.
deploy + undeploy deploy
anypoint-cli runtime-mgr application deploy --environment Sandbox \ --runtime 4.6.0 \ --workers 1 \ --workerSize 0.1 \ myapp ./target/myapp-1.0.0-mule-application.jar anypoint-cli runtime-mgr application modify --environment Production \ --workers 2 myapp anypoint-cli runtime-mgr application stop --environment Production myapp anypoint-cli runtime-mgr application undeploy --environment Production myapp
Use modify to scale workers without redeploying: fastest response to a traffic event. stop halts the app but preserves the deployment config; undeploy removes it entirely. In practice, production deploys should go through the Maven plugin for reproducibility. Use anypoint-cli deploy for hotfixes only.
environment promotion deploy
anypoint-cli runtime-mgr application download-artifact --environment Staging myapp ./myapp-staging.jar anypoint-cli runtime-mgr application deploy --environment Production \ --runtime 4.6.0 \ --workers 2 \ --workerSize 0.2 \ --property env:production \ --property db.url:$PROD_DB_URL \ myapp ./myapp-staging.jar # promote the same artifact, not a rebuild # environment-specific config via --property, not embedded in jar
Promotion pattern: download the artifact that passed QA from Staging, deploy the same JAR to Production with production-specific properties. This guarantees the artifact tested is the one deployed. Never rebuild for promotion. Store environment-specific config as --property flags or in Anypoint Secrets Manager, never in the JAR.
pom.xml plugin config ci/cd
<plugin> <groupId>org.mule.tools.maven</groupId> <artifactId>mule-maven-plugin</artifactId> <version>4.2.0</version> <extensions>true</extensions> <configuration> <cloudHubDeployment> <uri>https://anypoint.mulesoft.com</uri> <muleVersion>4.6.0</muleVersion> <connectedAppClientId>${client.id}</connectedAppClientId> <connectedAppClientSecret>${client.secret}</connectedAppClientSecret> <connectedAppGrantType>client_credentials</connectedAppGrantType> <applicationName>${app.name}-${env}</applicationName> <environment>${env}</environment> <workerType>${worker.type}</workerType> <workers>${workers}</workers> </cloudHubDeployment> </configuration> </plugin>
Worker size and count as Maven properties enable environment-specific overrides from the pipeline without changing pom.xml. applicationName with ${env} suffix creates distinct app names per environment: prevents accidental cross-environment overwrites. Pin the plugin version explicitly: minor versions occasionally have breaking parameter changes.
mvn deploy commands ci/cd
# build + package (skip tests in CI via profile): mvn clean package -DskipTests # deploy to CloudHub: mvn mule:deploy -DmuleDeploy \ -Denv=Production \ -Dclient.id=$APP_CLIENT_ID \ -Dclient.secret=$APP_CLIENT_SECRET \ -Dworker.type=MICRO \ -Dworkers=2 # deploy + publish to Exchange in one step: mvn deploy -DmuleDeploy \ -Denv=Production \ -Dclient.id=$APP_CLIENT_ID \ -Dclient.secret=$APP_CLIENT_SECRET
mvn mule:deploy deploys only; mvn deploy also publishes the artifact to Exchange. Use the latter if you want Exchange as an artifact store. Pass credentials as -D flags from CI secrets, never from settings.xml in the repo. The -DmuleDeploy flag activates the deployment goal; without it, deploy only publishes to Exchange.
GitHub Actions pipeline ci/cd
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: { java-version: '17', distribution: 'temurin' } - name: Cache Maven uses: actions/cache@v4 with: { path: ~/.m2, key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} } - name: Deploy to CloudHub run: mvn mule:deploy -DmuleDeploy -Denv=Production -Dclient.id=${{ secrets.CLIENT_ID }} -Dclient.secret=${{ secrets.CLIENT_SECRET }}
Maven cache keyed on pom.xml hash dramatically reduces pipeline time: MuleSoft's Exchange repo downloads are the main bottleneck. Store CLIENT_ID and CLIENT_SECRET as GitHub Actions secrets. Gate the deploy step on github.ref == 'refs/heads/main' to prevent accidental deploys from feature branches.
settings.xml for Exchange ci/cd
<!-- ~/.m2/settings.xml or CI-generated settings --> <servers> <server> <id>anypoint-exchange-v3</id> <username>~~~Client~~~</username> <password>${CLIENT_ID}~?~${CLIENT_SECRET}</password> </server> <server> <id>MuleRepository</id> <username>~~~Client~~~</username> <password>${CLIENT_ID}~?~${CLIENT_SECRET}</password> </server> </servers>
This is the most common silent failure in MuleSoft CI: the plugin pulls dependencies from MuleSoft's private Exchange repository, not Maven Central, and the credentials format is non-standard (~~~Client~~~ prefix, ~?~ separator). Missing or malformed settings.xml produces misleading "artifact not found" errors. Generate this file in CI from secrets rather than committing it.
API Manager list / inspect api manager
anypoint-cli api-mgr api list --environment Production --output table anypoint-cli api-mgr api describe --environment Production <api-id> anypoint-cli api-mgr api list --environment Production --output json | jq '.[] | {id,assetId,status,autodiscoveryInstanceName}'
autodiscoveryInstanceName is the value you configure in your Mule app to link it to the API Manager instance: mismatches here cause policies not to apply. List all APIs to find the correct api-id before other API Manager operations. status=ACTIVE vs INACTIVE controls whether policies are enforced.
API policy management api manager
anypoint-cli api-mgr policy list --environment Production <api-id> anypoint-cli api-mgr policy apply --environment Production <api-id> \ --policyId rate-limiting-sla \ --config '{"rateLimits":[{"maximumRequests":100,"timePeriodInMilliseconds":60000}]}' anypoint-cli api-mgr policy disable --environment Production <api-id> <policy-id> anypoint-cli api-mgr policy remove --environment Production <api-id> <policy-id>
Policy application order matters: policies execute in the order applied. disable temporarily suspends a policy without removing it: useful for emergency debugging when a policy may be causing issues. List before applying to check existing policies and their ordering. Policy config JSON varies per policy type. Check Anypoint's policy documentation for schema.
SLA tiers + contracts api manager
anypoint-cli api-mgr tier list --environment Production <api-id> anypoint-cli api-mgr contract list --environment Production <api-id> anypoint-cli api-mgr contract revoke --environment Production <api-id> <contract-id> anypoint-cli api-mgr contract approve --environment Production <api-id> <contract-id>
Contracts link consumer apps to API SLA tiers: revoking a contract immediately stops the consumer's API key from working. Contract list shows pending approval requests: if clients report access issues, check for contracts stuck in PENDING state. Approval/revocation takes effect without redeployment.
worker sizing guide runtime
CloudHub 1.0 worker sizes: MICRO: 0.1 vCores, 500MB; dev/test, lightweight integrations SMALL: 0.2 vCores, 1GB; low traffic APIs MEDIUM: 1 vCores, 1.5GB; production standard LARGE: 2 vCores, 3.5GB; high throughput / heavy processing XLARGE: 4 vCores, 7.5GB; batch / DataWeave intensive # scale horizontally (more workers) before vertically (larger size) # persistent queues: required for horizontal scaling with guaranteed delivery
Horizontal scaling (multiple workers) requires Persistent Queues enabled, without it, only one worker processes VM queue messages and state is not shared. For stateless HTTP APIs, horizontal scaling works without Persistent Queues. MICRO workers are aggressively throttled on CPU. Use SMALL or above for any production workload with non-trivial DataWeave transforms.
app restart + modify runtime
anypoint-cli runtime-mgr application restart --environment Production myapp anypoint-cli runtime-mgr application start --environment Production myapp anypoint-cli runtime-mgr application stop --environment Production myapp anypoint-cli runtime-mgr application modify --environment Production \ --workers 3 myapp anypoint-cli runtime-mgr application modify --environment Production \ --property db.url:$NEW_URL myapp
modify --property updates a runtime property and triggers a restart: the correct way to update config without redeploying the JAR. modify --workers scales without a restart on CloudHub 2.0; on CloudHub 1.0 it triggers a brief restart. Use restart (not stop + start) to preserve deployment config.
Flex Gateway vs MuleSoft Gateway runtime
MuleSoft Gateway (embedded): runs inside Mule runtime - Mule 4.x runtime, CloudHub, on-prem Mule - policies applied via API Manager autodiscovery - limited to Mule-native policy types Flex Gateway: standalone sidecar/proxy - Docker/K8s/Linux, not tied to Mule runtime - Connected Mode: managed via API Manager - Local Mode: declarative YAML, no Anypoint needed flexctl apply -f api-policy.yaml flexctl get ApiInstance -n gateway
Flex Gateway is the future direction for non-Mule workloads. It can proxy any HTTP service, not just Mule apps. Local Mode is the most ops-friendly: declarative YAML, no Anypoint Platform dependency, git-managed config. Connected Mode integrates with API Manager for centralised policy management. Choose Flex Gateway for new non-Mule API proxy needs.
application logs observability
anypoint-cli runtime-mgr application tail-log --environment Production myapp anypoint-cli runtime-mgr application download-log --environment Production myapp ./myapp.log anypoint-cli runtime-mgr application list-log --environment Production myapp # filter downloaded log for errors: grep -E "ERROR|WARN|Exception" ./myapp.log | tail -50
tail-log streams live logs: the first step during an incident. download-log retrieves the full log file for offline analysis. Log retention on CloudHub is 30 days; download before investigating old incidents. For structured log analysis at scale, forward to an external log aggregator (Splunk, ELK) via the Cloudhub log appender.
alerts + monitoring observability
anypoint-cli runtime-mgr alert list --environment Production anypoint-cli runtime-mgr alert describe --environment Production <alert-id> anypoint-cli runtime-mgr alert create --environment Production \ --name "App down" \ --condition application-not-responding \ --application myapp \ --email ops@example.com
Alert conditions: application-not-responding, cpu-usage, memory-usage, worker-not-responding. List alerts to confirm monitoring is configured before taking an app to production. It's common to discover no alerts are set up until the first outage. Email is the minimum; hook into PagerDuty via webhook in the alert config.
Exchange asset management governance
anypoint-cli exchange asset list --output table anypoint-cli exchange asset describe <group-id>/<asset-id>/<version> anypoint-cli exchange asset upload --name "My API" \ --version 1.0.0 \ --type rest-api \ --file ./my-api.raml anypoint-cli exchange asset deprecate <group-id>/<asset-id>/<version> anypoint-cli exchange asset delete <group-id>/<asset-id>/<version>
Exchange is the internal API marketplace: the correct place to publish API specs before implementing them (API-first). deprecate flags a version as deprecated without removing it: consumers see the deprecation notice but can still use it. Delete only when all consumers have migrated; deletion is permanent and breaks any app depending on that version.
API versioning patterns governance
API versioning in anypoint-cli deploy: applicationName: myapi-v1 (CloudHub app per major version) environment: Production URI versioning: /api/v1/... /api/v2/... → route to different CloudHub apps via Flex Gateway anypoint-cli api-mgr api list --output json | jq '.[] | select(.assetVersion | startswith("2.")) | {id,assetId,assetVersion}' # manage v1 and v2 as separate API Manager instances
MuleSoft's recommended pattern: separate CloudHub application per major API version (myapi-v1, myapi-v2), separate API Manager instance per version, Flex Gateway or load balancer routes by URI prefix. This allows independent deployment cycles for v1 and v2. Avoid breaking changes within a major version: consumers expect stability within a version.
No entries match this filter.