An artifact is a deployable unit that is supported by a specific cartridge type (e.g., a PHP file in a PHP Cartridge, a web app (.war ) in an Application Server Cartridge etc.). Artifact Distribution Coordinator (ADC) is responsible for distributing artifacts among the cartridge instances. The artifact distribution process is referred to as Deployment synchronization.

Deployment synchronization

Users in the Stratos environment typically upload their artifacts to a remote Git repository, which is specified at the time of application deployment. The deployed artifact must be synchronized from the Git repository across the relevant cartridge instance nodes, to deploy the relevant artifact in the relevant cartridge instance node. Deployment Synchronization refers to the latter mentioned synchronization process. Initially, the deployment synchronization process will take place automatically at the time of application deployment. However, after application deployment there may be situations where the artifacts in the Git repository and the cartridge differ due to one of the following reasons:

  • Artifacts being updated due to a one-off reason in the Git repository.
  • Artifacts being continuously updated in the Git repository.
  • Artifacts in a instance being updated and Auto Commit being enabled. 

In such instances it is important that all the changes made in the Git repository are propagated into the respective cartridge. Therefore, it is recommended to setup the automatic deployment synchronization process for this purpose.

Automated artifact update

The diagram above explains the process involved in uploading an artifact to a cartridge instance automatically. A webhook needs to be added to the remote Git repository for the deployment synchronization process to take place automatically.

When a tenant user needs to upload an artifact, they will push the artifact into their remote Git repository by issuing a git push. This will make the GitRepo send a push event to Stratos Manager. When a git push triggers the ADC, it will publish a Artifact Update event to the Instance Notifier topic, which is within the Message Broker. Thereafter, the relevant cartridge instances will subscribe to the Artifact Update message and update its artifacts by issuing a git pull to the tenant user's remote Git repository. 

Auto Commit

Generally, up stream commits from the instance to the Git repository will not take place. However, if Auto Commit is enabled the instance will automatically push commits to the respective remote Git repository. Auto Commit is an optional feature.

Single tenant and multi-tenant cartridges can be present in any of the following cartridge types: data cartridge, framework cartridge and load balancer cartridge. If required, Auto Commit can only be enabled for single tenant framework cartridges or multi-tenant framework cartridges, as data cartridges and load balancer cartridges do not use Git repositories. Auto Commit is enabled at the time of deploying the application. Therefore, Auto Commit needs to be enabled by sending a payload parameter in the application definition JSON as follows: 

    {
     "name": "payload_parameter.COMMIT_ENABLED",
     "value": "true"
    }

For example:

 {
 "applicationId": "single-cartridge-app",
 ...
 "components": {
   "cartridges": [
     {
       "type": "php",
       ...
       "subscribableInfo": {
         "alias": "my-php",
         ...
         "properties" : [
           {
             "name": "payload_parameter.COMMIT_ENABLED",
             "value": "true"
           }
         ]
       }
     }
   ]
 }
}
  • No labels