Contact Us 1-800-596-4880

Application Deployment

Each Accelerator implementation template in Exchange includes Bash and Windows scripts for building and deploying the APIs to CloudHub. These scripts depend on repositories, global settings, deployment profiles, and associated properties configured in the Maven settings.xml file.

Many templates can also be run from Anypoint Studio without having to customize the Run/Debug profiles. However, some templates make use of hidden deployment properties to protect sensitive information such as passwords and secret keys. These properties must be supplied to the runtime by updating the configuration profile and adding them as VM arguments.

Running the Application from Anypoint Studio

The following instructions are for running applications from Studio but apply to debugging as well.

  1. Update the src/main/resources/config/config-local.yaml file and provide appropriate values for any mandatory property overrides listed for that application.

  2. Right-click the project and select Run As → Mule Application (configure)

  3. If hidden deployment properties are required (for example, Anypoint MQ credentials), select the Arguments tab and add the property definitions to the VM arguments section as shown in the following example.

     -M-Danypoint-mq.client-id=<client id> -M-Danypoint-mq.client-secret=<client secret>
    • Click Run to launch the application.

To debug an application, choose Debug As → Mule Application (configure) in the second step instead.

Deployment Instructions for CloudHub

The following instructions apply to CloudHub deployments only.

  1. Update the config-dev.yaml properties as described above. You can also choose to add them to your settings.xml file instead.

  2. Use one of the following scripts to deploy the application to CloudHub:

    • packageDeploy.sh (Mac/Linux) or packageDeploy.cmd (Windows) - clean, build, and deploy the application

    • deployOnly.sh (Mac/Linux) or deployOnly.cmd (Windows) - deploy a previously-built application

  3. Bring up the Runtime Manager console in Anypoint and monitor the application for proper startup.

See below for more detailed steps on configuring CloudHub deployments using Maven profiles.

Configuring the Deployment Profile

The default settings-accelerators.xml file, provided by the "Accelerator Common Resources - Source" asset, defines a single deployment profile called CloudHub-DEV. The key properties that can be configured are described in the following table:

Property Name Description Mandatory

cloudhub.mavenServerId

Maven server entry providing credentials for target Anypoint instance

yes

cloudhub.region

Target deployment region

yes

cloudhub.businessGroupId

ID (not name) of the target business group

yes

cloudhub.environment

Exact name of the target deployment environment (case-sensitive)

yes

cloudhub.applicationName

Constructs the deployed application name from app/env properties

yes

cloudhub.muleVersion

Target Mule runtime version

yes

cloudhub.applyLatestPatch

Set to true to automatically apply latest patches on deployment

no

cloudhub.workerType

Worker size (translates to vCores)

yes

cloudhub.workers

Number of workers

yes

cloudhub.objectStoreV2

Set to true to use ObjectStore V2

no

cloudhub.persistentQueues

Set true to use persistent queues

no

cloudhub.skipDeploymentVerification

Set to false to wait for application to be fully deployed before continuing

no

cloudhub.deploymentTimeout

Amount of time (in milliseconds) to wait for complete application deployment

no

mule.environment

Specifies the configuration properties files to use

yes

mule.encryptionKey

If secured properties are used an encryption key is required

no

anypoint.platform.clientId

Client ID of the target environment or business group

yes

anypoint.platform.clientSecret

Client secret of the target environment or business group

yes

anypoint.platform.enableMonitoring

Set to true to enable monitoring and visualization

no

The template described previously is generic. Many accelerators provide their own version of the common resources project, which contains a similar template specialized for that accelerator.

Application Naming

The default setting for the cloudhub.applicationName property constructs the application name base on the following segments:

  • Global Prefix (default is org-)

  • Maven artifact ID (from project pom.xml)

  • API compliance version (from project pom.xml)

  • Target environment name (hard-coded for profile)

An example of a deployed application name using the default settings is org-notifications-prc-api-v1-dev.

CloudHub application names must be globally unique. Therefore, we highly recommended you set the global.cloudhub.appPrefix property, which is defined in the global-settings profile, to a 2-4 character abbreviation unique to your organization. Exceeding four characters may cause deployments to fail when using the CloudHub 1.0 runtime (see below).

Deploying Applications Using Maven Profiles

Once appropriate values have been defined for the properties for the environment profile, individual applications can be deployed to that environment simply by specifying the profile name on the Maven command line. For example, the command mvn clean deploy -DskipTests -PCloudHub-DEV uses the settings in the CloudHub-DEV profile to build and deploy the application.

Troubleshooting

The following sections provide solutions to common deployment issues.

Error Deploying Project Imported into Anypoint Studio

If you choose to import accelerator projects into Anypoint Studio, be aware that Studio may automatically make modifications to the application pom.xml files, which could impact deployment. In particular, be sure to cancel the prompt to "Upgrade your workspace" when importing projects. If you run into trouble, check the pom.xml file and verify the configuration of the mule-maven-plugin looks something like the following:

<plugin>
    <groupId>org.mule.tools.maven</groupId>
    <artifactId>mule-maven-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <cloudHubDeployment>
        ...
        </cloudHubDeployment>
        <classifier>${mule.app.classifier}</classifier>
    </configuration>
</plugin>

Make sure there is no <version> element included and that the <classifier> element contains the property reference indicated above.

Unauthorized Error

If deployment fails due to an unauthorized error, it is possible that the complete application name exceeds the 42 character limit on CloudHub deployment names. Adjust the prefix, the artifactId value in the project pom.xml, or the deployment name pattern to ensure the complete application name does not exceed 42 characters in length.