> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# deploy(Mule)

> The deploy operation deploys a Mule Application. It should be used in deploy workflows. Properties Management It is always recommended to externalize

The deploy operation deploys a Mule Application. It should be used in deploy workflows.

**Properties Management**

It is always recommended to externalize any configuration parameters (usernames, passwords, URLs etc.). Instead of hard coding these values inside application code, we recommend creating a properties file for your mule application. Please follow these steps to achieve property replacement in FlexDeploy.

1. Create a properties file in your Mule application (eg: orderapi.properties)

2. Place values for all the properties for Anypoint Studio local testing. 

3. Use these property keys in your Mule Application instead of hard coding (eg: \$\{DB\_USERNAME})

4. In FlexDeploy create these properties in your Workflow with the MULE\_ prefix (eg: MULE\_DB\_USERNAME)

5. Provide values to these properties on the Target page.

6. Specify the Property file name in the Project Properties page (Property File Name to Create)

7. FlexDeploy replaces/creates the property file with the values for the environment it is deploying to.

Deploy operation is compatible with the following types of servers:

<table><colgroup><col /><col /></colgroup><tbody><tr><th>**FDMULE\_TYPE**</th><th>**Notes Specific to the Mule Type**</th></tr><tr><td>Standalone</td><td>This operation runs on the Mule server endpoint(s).In order to deploy an application to an entire cluster, set up multiple instances or endpoints.The deployment will be run on all of them so the application will be deployed to all of the cluster members.</td></tr></tbody></table>

#  Target Properties

> [!NOTE]
>
> In 9.0.0.3, the cloud-related properties were moved into cloud accounts. This process happens automatically during server startup / migration. If you running on a version of FlexDeploy prior to 9.0.0.2, please refer to the 8.0 documentation instead of this page.

<table><colgroup><col /><col /><col /><col /></colgroup><tbody><tr><th>**Property Name**</th><th>**Property Code**</th><th>**Required for which Mule Type**</th><th>**Description**</th></tr><tr><td>Mule Account</td><td>`FDMULE_CLOUD_ACCOUNT_CODE`</td><td>CloudHub, Anypoint Runtime Manager</td><td>The Mule Integration AccountSee [Configuring a Mule Cloud Account](https://docs.flexagon.com/flexdeploy-10-0-documentation/flexdeploy-plugin-guides/flexdeploy-mule-plugin-guide/appendix-mule/configuring-a-mule-cloud-account.md) for help creating a Mule Cloud Account.</td></tr><tr><td>Mule Home</td><td>`FDMULE_HOME`</td><td>Standalone</td><td>Path to the Mule Standalone Install</td></tr><tr><td>Timeout in Milliseconds</td><td>`FDMULE_TIMEOUT`</td><td>None</td><td>Timeout for deployment and utility operations such as start and stop application.Defaults to 600000 which is 10 minutes.</td></tr><tr><td>Runtime Agent URL</td><td>`FDMULE_AGENT_URL`</td><td>Runtime Agent</td><td>The URL of Runtime Agent</td></tr><tr><td>Mule Region Code</td><td>`FDMULE_REGION`</td><td>None. Used for CloudHub, but optional.</td><td>Region Code for Mule</td></tr><tr><td>AnyPoint CLI Path</td><td>`FDMULE_CH2_ANYPOINT_CLI_PATH`</td><td>For CloudHub 2.0</td><td>Provide the absolute path where the Anypoint CLI is installed.(/u01/sqlcl/anycli/bin/)</td></tr><tr><td>Runtime Properties File</td><td>`FDMULE_CH2_PROPERTIES_FILE_PATH`</td><td>For CloudHub 2.0</td><td>Provide the path to the properties file containing runtime configuration for CloudHub 2.0. Relative paths will be resolved against FD\_ARTIFACTS\_DIR.</td></tr><tr><td>CloudHub 2.0 Secure Property Name</td><td>`FDMULE_CH2_SECURE_PROPERTY_NAME`</td><td>For CloudHub 2.0</td><td>Name of the secure property defined in the Mule configuration (for example,secure.key:). This must match the property name referenced in the secure-properties configuration in the Mule XML.</td></tr><tr><td>CloudHub 2.0 Secure Property Key</td><td>`FDMULE_CH2_ENCRYPTION_KEY`</td><td>For CloudHub 2.0</td><td>Key used to decrypt secure values in configuration files (e.g., sandbox.yaml). This must be the same key that was used to encrypt values using the Secure Properties Tool.</td></tr><tr><td>CloudHub 2.0 Secure Property Key</td><td>`FDMULE_RELEASE_CHANNEL`</td><td>For CloudHub 2.0</td><td>Specifies the Mule runtime release channel for CloudHub 2.0 deployment. EDGE selects the latest runtime, LTS selects the long-term support version. If left blank, CloudHub uses the default channel (EDGE).</td></tr></tbody></table>

# Project Properties

<table><colgroup><col /><col /><col /><col /></colgroup><tbody><tr><th>**Property Name**</th><th>**Property Code**</th><th>**Required for which Mule Type**</th><th>**Description**</th></tr><tr><td>Mule Application Name</td><td>`FDMULE_APP_NAME`</td><td>All</td><td>Name of the Mule Application(The Mule Application Name is automatically suffixed with the Anypoint Environment name by FlexDeploy during deployment. This is required for deployments to CloudHub 2.0 to ensure that each application name is unique across all deployment targets in Anypoint Platform. For example appname-dev, appname-test depending on the environment.)</td></tr><tr><td>Target Server Type</td><td>`FDMULE_TARGET_TYPE`</td><td>Anypoint Runtime Manager</td><td>Mule Target Server Type(Server, Cluster, ServerGroup)If necessary, this property can be overridden at the property/Target level.</td></tr><tr><td>Target Name</td><td>`FDMULE_TARGET_NAME`</td><td>Anypoint Runtime Manager</td><td>Name for the Target Server, Cluster or GroupIf necessary, this property can be overridden at the project/Target level.</td></tr><tr><td>Static IP Address</td><td>`FDMULE_STATIC_IPADDRESS`</td><td>None. Used for CloudHub, but optional</td><td>Static IP Address for the ApplicationIf necessary, this property can be overridden at the project/Target level.</td></tr><tr><td>Number of Workers</td><td>`FDMULE_WORKERS_COUNT`</td><td>None. Used for CloudHub, but optional.</td><td>Workers Count</td></tr><tr><td>Worker Size Type</td><td>`FDMULE_WORKER_TYPE`</td><td>None. Used for CloudHub, but optional.</td><td>Type of the Worker Size(Micro,Small,Medium,Large,xLarge,xxLarge)Defaults to Small</td></tr><tr><td>Persistent Queues</td><td>`FDMULE_PERSISTENT_QUEUES`</td><td>None. Used for CloudHub, but optional.</td><td>Enable Persistent QueuesDefaults to false</td></tr><tr><td>Property File Name to Create</td><td>`FDMULE_PROPERTY_FILE`</td><td>None. Used for CloudHub, but optional.</td><td>Name of the property file to create with Mule Properties</td></tr><tr><td>Auto Start</td><td>`FDMULE_AUTO_START`</td><td>None. Used for CloudHub, but optional.</td><td>Defaults to true</td></tr><tr><td>Enable Monitoring</td><td>`FDMULE_MONITORING_ENABLED`</td><td>None. Used for CloudHub, but optional.</td><td>Defaults to true</td></tr><tr><td>Replica Size Type</td><td>`FDMULE_CH2_REPLICA_SIZE`</td><td>Select the vCore size for the replica.</td><td /></tr></tbody></table>

## CloudHub 2.0 Deployement Process

In CloudHub 2.0 (From 10.0.0.2), due to architecture changes, the artifact does not need to be uploaded during deployment. Instead, the deployment process retrieves the artifact directly from MuleSoft Exchange. During the build phase, Maven packages the application and the POM file is updated with the artifact name and version using properties from FlexDeploy. The same artifact name and version are then used during deployment to locate and retrieve the artifact from MuleSoft Exchange and deploy it to CloudHub 2.0.

## CloudHub 2.0 Properties Management

In Mule applications, we often need to pass dynamic data (such as URLs, usernames, passwords, and other configuration settings) that may vary across environments (e.g., dev, test, prod). CloudHub 2.0 makes it easy to manage these properties dynamically during deployment, allowing you to handle different environments smoothly.

### Mule's Recommended Approach for Property Management

1. Organize Properties into Environment-Specific YAML Files

   * It is recommended to store environment-specific configurations in separate YAML files within the `src/main/resources/config` directory. This way, you can easily separate the configurations for different environments such as development, testing, and production.

   * These YAML files contain properties like:

     * URLs

     * API keys

     * Username/Password (secure values)

     * Example : dev.yaml

     * ```
       # dev.yaml
       db:
         username: devUser
         password: ![encryptedPassword]
       api:
         url: "https://dev-api.example.com"
       ```

2. Use the `FDMULE_CH2_PROPERTIES_FILE_PATH` to Select the Environment-Specific YAML

   * During the deployment of the Mule application, CloudHub uses the `CH2_PROPERTIES_FILE_PATH` property to specify which environment-specific YAML file to use. This allows you to dynamically select the correct environment file based on your deployment context (e.g., development, testing, production).Example Properies File

   * Example File

   * ```
     # properties file used during deployment
     username=chandhu
     mule.env=dev
     ```

# Artifacts

This operation consumes Mule Application and Domain artifacts from the artifacts repository.

# Endpoint Selection

This operation will select all available endpoints associated to the Target.

# Endpoint Execution

This operation will execute on all of the selected endpoints.
