ARM REST Services

(8 reviews)

Application Deployment Examples

Deploy From File

Anypoint Runtime Manager supports deployment of an application using .zip or .jar files, depending on whether or not you are deploying to a Mule 3 or Mule 4 version.

To deploy an application using the API, you must use Content-Type: multipart/form-data and provide a file, for example using curl.

curl -X POST \
  https://anypoint.mulesoft.com/hybrid/api/v1/applications \
  -H 'authorization: Bearer <TOKEN>' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -H 'x-anypnt-env-id: <<ENV\_ID>>' \
  -H 'x-anypnt-org-id: <<ORG\_ID>>' \
  -F file=@application-file.zip \
  -F artifactName=application-name \
  -F targetId=1

If you are using a Mule Runtime v3.9 and later, you can also specify the configuration to be applied to the deployment at deployment time. That configuration is a JSON format configuration in an extra configuration field.

Example:

curl -X POST \
  https://anypoint.mulesoft.com/hybrid/api/v1/applications \
  -H 'authorization: Bearer <TOKEN>' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -H 'x-anypnt-env-id: <<ENV\_ID>>' \
  -H 'x-anypnt-org-id: <<ORG\_ID>>' \
  -F file=@application-file.zip \
  -F artifactName=application-name \
  -F targetId=1 \
  -F 'configuration={
 "mule.agent.application.properties.service": {
   "properties": {
 "remove\_payments": "true",
 "allow\_empty\_cases": "false",
         "encryption\_certificate": "cert.jks"
       }
     },
     "mule.agent.logging.service": {
       "packages": [
         {
           "com.fdss.payment.\*": "DEBUG"
         }
       ]
     }
  }'

The configuration field schema must contain as a root property the component to be configured. For example:

  • application-properties-service: This component allows under the field properties a list of properties to be passed as application properties to the application at deployment time.
  • agent-logging-service: This component allows under the field packages a list of packages and log levels to use in the application.

Deploy From Sandbox

If you want to deploy an application that is already deployed in another environment of your organization, you can easily deploy it using the Content-Type: application/json by providing just the ID of your application.

For example to deploy in the current environment the application with id=47194:

    curl -X POST \
  https://anypoint.mulesoft.com/hybrid/api/v1/applications \
  -H 'authorization: Bearer <<TOKEN>>' \
  -H 'content-type: application/json' \
  -H 'x-anypnt-env-id: <<ENV\_ID>>' \
  -H 'x-anypnt-org-id: <<ORG\_ID>>' \
  -d '{
  "applicationSource": {
    "source": "HYBRID",
    "id": 47194
  },
  "targetId": 45030,
  "artifactName": "myApp"
}
'

If you are using a Mule Runtime v3.9 and later, you can also specify the configuration to be applied to the given deployment at deployment time. That configuration is a new field in the request, for example:

    curl -X POST \
  https://anypoint.mulesoft.com/hybrid/api/v1/applications \
  -H 'authorization: Bearer <<TOKEN>>' \
  -H 'content-type: application/json' \
  -H 'x-anypnt-env-id: <<ENV\_ID>>' \
  -H 'x-anypnt-org-id: <<ORG\_ID>>' \
  -d '{
  "applicationSource": {
    "source": "HYBRID",
    "id": 47194
  },
  "targetId": 45030,
  "artifactName": "myApp",
  "configuration": {
     "mule.agent.application.properties.service": {
       "properties": {
         "remove\_payments": "true",
         "allow\_empty\_cases": "false",
         "encryption\_certificate": "cert.jks"
       }
     },
     "mule.agent.logging.service": {
       "packages": [
         {
           "com.fdss.payment.\*": "DEBUG"
         }
       ]
     }
  }
}
'

The configuration field schema must contain as a root property the component to be configured. In this example we configure:

  • application-properties-service: This component in the field properties, provides a list of properties to be passed as application properties to the application at deployment time.
  • agent-logging-service: This component in the field packages, is a list of packages and log levels to use in the application.

Deploy From Exchange

If you want to deploy an asset that exists on Anypoint Exchange you should have at hand the following properties of the asset:

  • groupId: The group ID of the asset in exchange.
  • artifactId: The artifact ID of the asset.
  • version: The version of the asset.
  • organizationId: The organization ID owner of the asset.

You can find this information in the Dependency Snippets section, ( OrganizationId).

For example to deploy the asset:

"groupId": "com.mulesoft.hybrid",
"artifactId": "testApp",
"version": "0.0.2",
"organizationId": "9b615bbe-df43-4b89-81ec-5166c8419ff6"
    curl -X POST \
  https://anypoint.mulesoft.com/hybrid/api/v1/applications \
  -H 'authorization: Bearer <<TOKEN>>' \
  -H 'content-type: application/json' \
  -H 'x-anypnt-env-id: <<ENV\_ID>>' \
  -H 'x-anypnt-org-id: <<ORG\_ID>>' \
  -d '{
  "applicationSource": {
    "source": "EXCHANGE",
    "groupId": "com.mulesoft.hybrid",
    "artifactId": "testApp",
    "version": "0.0.2",
    "organizationId": "9b615bbe-df43-4b89-81ec-5166c8419ff6"
  },
  "targetId": 45030,
  "artifactName": "myApp"
}
'

If you are using a Mule Runtime v3.9 and later, you can also specify the configuration to be applied to the deployment at deployment time. This configuration is a new field in the request. For example:

    curl -X POST \
  https://anypoint.mulesoft.com/hybrid/api/v1/applications \
  -H 'authorization: Bearer <<TOKEN>>' \
  -H 'content-type: application/json' \
  -H 'x-anypnt-env-id: <<ENV\_ID>>' \
  -H 'x-anypnt-org-id: <<ORG\_ID>>' \
  -d '{
  "applicationSource": {
    "source": "EXCHANGE",
    "groupId": "com.mulesoft.hybrid",
    "artifactId": "testApp",
    "version": "0.0.2",
    "organizationId": "9b615bbe-df43-4b89-81ec-5166c8419ff6"
  },
  "targetId": 45030,
  "artifactName": "myApp",
  "configuration": {
     "mule.agent.application.properties.service": {
       "properties": {
         "remove\_payments": "true",
         "allow\_empty\_cases": "false",
         "encryption\_certificate": "cert.jks"
       }
     },
     "mule.agent.logging.service": {
       "packages": [
         {
           "com.fdss.payment.\*": "DEBUG"
         }
       ]
     }
  }
}
'

The configuration field schema must contain as a root property the component to be configured, in this example we are configuring 2 components:

  • application-properties-service: This component allows under the field properties a list of properties to be passed as Application Properties to the application at deployment time.
  • agent-logging-service: This component allows under the field packages a list of packages and log levels to use on the application.

Reviews