All Products
Search
Document Center

CloudOps Orchestration Service:OSS deployment

Last Updated:Dec 15, 2025

Use this deployment type to publish an application when its source files are stored in Object Storage Service (OSS).

How it works

Important
  • If you deploy to an application group that is an Auto Scaling (ESS) group, scaling activities are paused during the deployment. They automatically resume after the deployment finishes, whether it succeeds or fails.

  • The deployment process follows a stop-then-start principle. Each deployment first runs the stop script and then runs the start script.

  1. Create and publish the deployment.

    Configure the application source file, start script, and stop script for the deployment.

    Create a release task, select a release mode, and publish the deployment to the target application group.

  2. Automated deployment flow.

    1. Retrieve deployment information, including OSS file details and the application's start and stop scripts.

    2. Download file: The OSS file is automatically downloaded to the working directory.

    3. Run stop script: Run the stop script to stop the old version of the application.

    4. Run start script: Run the start script to start the new version of the application.

Scope

  • Deployments are supported only on Linux instances.

  • The start and stop scripts must be Shell scripts.

Procedure

  1. Create an application and import Elastic Compute Service (ECS) instances.

    1. If you do not have an ECS instance, create one that runs a Linux operating system from the ECS console - Custom Launch page.

      We recommend using an ECS image of Alibaba Cloud Linux 3.2104 LTS 64-bit or Ubuntu 22.04 64-bit. The scripts in the following examples are based on these two images. If you use a different image, modify the scripts as needed.
    2. Go to the ECS console - Application Management page, click Create from Existing Resources, create an application and an application group, and import the ECS instance into the application group.

  2. Create an OSS deployment.

    1. Download the official sample JAR package and upload it to OSS.

    2. Go to the ECS console - Application Management page. On the My Applications tab, click the name of the target application.

    3. On the application product page, select the Deployment tab, and then click Create Deployment.

    4. On the Create Deployment page, set RevisionType to OSS File. Configure the parameters and click OK.

      • OSS file information: Specify the OSS Bucket and the path to the file.

        If the ECS instance and the OSS Bucket are in the same region, you can select Internal Network Download to improve the download speed.
      • Working directory: The directory where the start and stop scripts run. The OSS file is automatically downloaded to this directory. Example: /root/deploy.

      • Application start script:

        Alibaba Cloud Linux

        function start_application() {
          set -e
          yum install -y maven-3.5.4
          java -jar ./sample-spring-1.0-SNAPSHOT.jar &
        }
        
        start_application

        Ubuntu

        function start_application() {
          set -e
          apt update
          apt install -y maven
          java -jar ./sample-spring-1.0-SNAPSHOT.jar &
        }
        
        start_application
      • Application stop script:

        ### Stop the application (if any)
        function stop_application() {
          PID=$(ps -ef | grep "sample-spring-1.0-SNAPSHOT.jar" | grep -v "grep" | awk '{print $2}')
          if [ -n "$PID" ]; then
            kill -9 $PID
          fi
        }
        
        stop_application
  3. Return to the deployment list. Find the deployment that you created and click Publish. Select the target group and click OK to start the deployment.

  4. Verify the result.

    1. Go to the details page of the target instance. Click Connect and select Workbench. Follow the prompts on the page to log on to the terminal.

    2. Run the curl http://localhost:8080/hello command. A return value of Alibaba Spring Sample! indicates that the deployment was successful.

Important fields

Field

Description

OSS Region

The region of the OSS Bucket that contains the source file.

OSS Bucket

The OSS Bucket that contains the source file.

OSS File

The source file object in the OSS Bucket.

OSS File Version

The specific version ID of the file. This is required only if versioning is enabled for the Bucket. If versioning is not enabled, leave this field empty.

Internal Network Download

Select this option when the ECS instance and the OSS Bucket are in the same region.

Working directory

The download path for the application source file. This is also the execution directory for the start and stop scripts.

  • This must be an absolute path.

  • The OSS file is automatically downloaded to this directory, where scripts can directly access and operate on it.

  • If the directory does not exist, it is automatically created during deployment.

Application start script

The Shell script to start the application.

Application stop script

The Shell script to stop the application.
The script must correctly stop the current and previous versions of the application. When no application is running, the script must also exit normally without errors.

For example, the following script stops a container named my-container. This script assumes that every version of the container has the same name. The script does not report an error if the container does not exist:

container_name="my-container"
container_id=$(docker ps -aq -f name=${container_name}) 
if [ -n "$container_id" ]; then
  docker rm -f $container_id
fi