All Products
Search
Document Center

CloudOps Orchestration Service:Command-only Deployment Package

Last Updated:Feb 07, 2026

Use this deployment package type when you do not need to specify application source files and publish your application entirely through scripts.

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 for task publishing.

    1. Retrieve deployment package details, including the application startup and shutdown scripts.

    2. Run the shutdown script: Stop the previous version of the application.

    3. Run the startup script: 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

Java application example

  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 a deployment package.

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

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

    3. On the Create Deployment Package page, set Deployment Package Type to Command-only. Configure the parameters. Click OK to save.

      • Working directory: Set the directory where the startup and shutdown scripts run. Example: /root/deploy.

      • Application startup script:

        Alibaba Cloud Linux

        start_application() {
          set -e
          curl -O https://oos-public-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/code-deploy/sample-spring-1.0-SNAPSHOT.jar
          yum install -y maven-3.5.4
          java -jar ./sample-spring-1.0-SNAPSHOT.jar &
        }
        
        start_application

        Ubuntu

        start_application() {
          set -e
          curl -O https://oos-public-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/code-deploy/sample-spring-1.0-SNAPSHOT.jar
          apt update
          apt install -y maven
          java -jar ./sample-spring-1.0-SNAPSHOT.jar &
        }
        
        start_application
      • Application shutdown script:

        ### Stop the application (if any)
        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.

Docker application example

  1. Prepare your application, group, and ECS instances.

    Before deploying, create your application and application group in ECS Application Management. Then add your prepared ECS instances to the group.

    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.

    3. Install Docker on the ECS instances in your group. On the Operations Management tab of your application group, select Install or uninstall extensions to install Docker in batch.

      If your ECS instances were created from a custom image, you cannot install extensions this way. Instead, log on to the instance remotely and install Docker manually.
  2. Create a deployment package.

    1. Pull the sample image locally. Then push the image to your personal ACR instance repository.

      docker pull aliyun-computenest-opensource-registry.cn-hangzhou.cr.aliyuncs.com/default/aliyun-code-deploy:latest
    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 details page, select the Parameters tab. Click Create Parameter. Create two parameters: username and password. These correspond to your personal ACR username and password. For security, create the password parameter as an encrypted parameter.

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

    5. On the Create Deployment Package page, set Deployment Package Type to Command-only. Configure the parameters. Click OK to save.

      • Working directory: Set the directory where the startup and shutdown scripts run. Example: /root/deploy.

      • Application startup script: Replace <repo> and <image> with your personal ACR information.

        In the figure below, the first field is repo. The second field is image. Replace these values in the corresponding positions of the startup script.image
        ### Start the current version of the application            
        start_application() {
           repo="<repo>"
           image="<image>"
           container_name="my-container"
           docker login --username=${username} --password=${password} $repo
           docker pull $image
           docker run -d -p 8080:8080 --name $container_name $image
        }
        
        start_application
      • Application shutdown script:

        ### Stop the container (if any)
        
        stop_application() {
          # Query whether the container exists by the container name, and delete the container if it exists
          container_name="my-container"
          container_id=$(docker ps -aq -f name=${container_name}) 
          if [ -n "$container_id" ]; then
            docker rm -f $container_id
          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.

Key fields

Field

Description

Working directory

The working directory for the application startup and shutdown scripts.

  • Enter an absolute path.

  • You can enter a non-existent directory. It will be created automatically during execution.

Application startup script

A Shell script that starts the application.

Application shutdown 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