Contact Us 1-800-596-4880

Manage Properties for Applications on CloudHub

In a CloudHub deployment, you can add properties to an application by using either Anypoint Runtime Manager or a properties file.

If you set properties both in the properties file in your application and in Runtime Manager, the values set in Runtime Manager always override the values in the properties file when your application deploys.

Add Application Properties in Runtime Manager

The easiest way to load properties to applications deployed to CloudHub is to use the Properties tab in Anypoint Runtime Manager.

To add properties:

  1. From Anypoint Platform, select Runtime Manager.

  2. Click the Applications tab.

  3. Click the Status column to display the details pane.

  4. Click Manage Application.

  5. On the Settings page, click the Properties tab:

    *Properties* tab
    Figure 1. The screenshot shows (1) the Properties tab, (2) the List button, (3) the key and value fields, and (4) the X icon on the application Settings page.
  6. Click List.

    Alternatively, you can enter the key-value pair in the Text field in this format: key=value.

  7. Enter the property name in the key field.

  8. Enter the property value in the value field.

    If the save password feature of Chrome is enabled and includes a username for anypoint.mulesoft.com that matches the contents of the key field, Chrome overwrites the value field with the stored password associated with that username. To work around this limitation, use Chrome in incognito mode or use another browser.

  9. If you want to change a key or value, edit the text in the field.

  10. If you want to delete a property, click X.

  11. Click Apply Changes.

  12. Select Restart from the menu in the top right to restart the application.

Example: Using Properties to Set Environment Variables

You can specify Java system environment variables, which function the same as adding environment variables when you deploy to an on-premises server.

You can also configure environment variables for your application. Properties enable you to externalize settings that change depending on the environment you’re deploying to. For example, if you use a Mule application locally, you might configure your database host to be 0.0.0.0. If you deploy the same app to CloudHub, you might configure the database host to be an Amazon RDS server.

To create or set an environment variable using an application property:

  1. From Anypoint Platform, select Runtime Manager.

  2. Click the Applications tab.

  3. Click the Status column to display the details pane.

  4. Click Manage Application.

  5. On the Settings page, click the Properties tab:

  6. Define the variable by entering it in the Text view, in key=value format:

    *Properties* tab on the *Settings* page
    Figure 2. The arrow shows the variable on the Properties tab of the application Settings page.
    In the Text view, use the backslash character (\) as an escape character. For example, to use : in a key or value, use \: in the syntax. To use \ in a key or value, use \\ in the syntax. List view syntax requires no escape character.
  7. Use the environment variable in your Mule app configuration.

Add Application Properties Using a Properties File

You can add properties to an app by including a file in the deployable application archive file:

CloudHub then loads these properties into the application when the application starts.

Although this method is not the best practice on CloudHub (because CloudHub Properties tab values override any with the same name in the file), you can work around this by changing options in the Mule app.

To prevent CloudHub properties from overriding properties bundled with the deployable archive, change options in the property-placeholder element in the Mule application. For more information about nondefault property placeholder options, see the Spring documentation on Property Placeholder options.

CloudHub Reserved Properties

CloudHub reserves a set of properties and prevents apps from overwriting the values of those properties. If an application attempts to assign a value to a reserved property, CloudHub doesn’t use the assigned value. Instead, it returns the value as set internally, without throwing an error or exception, and adds a warning message to the log.

Applications can reference reserved properties, for example, to retrieve the application name or deployment region. Use the ${csorganization.id} and ${environment.id} properties to retrieve those values if your app makes Anypoint Platform API calls. Use ${worker.id} to identify each worker in a multiworker application.

Do not use the ${spring.profiles.active} and ${logging.*} properties.
Property Description Example

${java.vendor}

Vendor providing the JVM

Oracle Corporation

${java.runtime.name}

JVM name

Java™ SE Runtime Environment

${java.version}

JVM version, excluding the dot (point) release.

If a CloudHub runtime release upgrades the JDK, this value changes.

1.8.0_141

${csorganization.id}

Main or business group ID

09396371-2cd4-412e-8d08-4356dd3e7bfc

${environment.id}

Environment ID

52a69d49e4b0e3c7324ae5b6

${environment.type}

Environment type

production

${worker.id}

Worker ID (for multiworker apps)

0

${domain}

App name

ch-https-41-demo

${fullDomain}

Full domain name of app

ch-https-41-demo.au-s1.cloudhub.io

${application.aws.region}

App deployment region

ap-southeast-2

${http.port}

HTTP port

8081

${https.port}

HTTPS port

8082

${http.private.port}

HTTP private port

8091

${https.private.port}

HTTPS private port

8092

${mule.home}

Absolute path to Mule installation

/opt/mule/mule-4.1.1

${spring.profiles.active}

Used internally, do not use

***

${logging.*}

Used internally, do not use

***

${host}

Used internally for the local IP address of a worker

10.40.122.33

${anypoint.url}

Used internally as the base Anypoint Platform URL

US: https://anypoint.mulesoft.com

MuleSoft Government Cloud: https://gov.anypoint.mulesoft.com

For proprietary reasons, MuleSoft doesn’t make public all internal, reserved properties. CloudHub runtime release updates might change the reserved properties.

Non-reserved Pre-populated Properties

Mule runtime pre-populates the values for the following two properties. However, you have the option to overwrite these pre-filled values.

Property Description Example

${app.name}

The name of the application .jar file.

myApplication

${app.home}

The root directory of the application during run time.

/opt/mule/mule-4.3.0/apps/myApplication

Example: Retrieve the Values of Reserved Properties

<set-payload value="java.vendor=${java.vendor}, java.runtime.name=${java.runtime.name}, java.version=${java.version}, application.aws.region=${application.aws.region},
      http.port=${http.port}, http.ports=${http.port}, mule.home=${mule.home}, csorganization.id=${csorganization.id}, environment.id=${environment.id},
      environment.type=${environment.type}, worker.id=${worker.id}, domain=${domain}, fullDomain=${fullDomain}" doc:name="Set Payload"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>

Example output:

16:33:08.572     07/02/2020     Worker-0     [cloudhub-reserved-properties].HTTP_Listener_Configuration.worker.01     INFO
   java.vendor=Oracle Corporation, java.runtime.name=Java(TM) SE Runtime Environment, java.version=1.8.0_141, application.aws.region=ap-southeast-2,
   http.port=8081, http.ports=8081, mule.home=/opt/mule/mule-4.3.0, csorganization.id=09396371-2cd4-412e-8d08-4356dd3e7bfc, environment.id=52a69d49e4b0e3c7324ae5b6,
   environment.type=production, worker.id=0, domain=cloudhub-reserved-properties, fullDomain=cloudhub-reserved-properties.au-s1.cloudhub.io