This topic describes how to use the command-line interface (CLI) of Web App Service (Web+) to deploy a Node.js application in the R&D Collaboration (RDC) console.

Step 1: Use RDC to create a pipeline

  1. Log on to the RDC console.
  2. In the top navigation bar, choose Development > Pipeline. In the upper-right corner of the page that appears, click New pipeline.
  3. In the New pipeline dialog box, configure basic information about the pipeline and click Create.
    Parameter Description
    Name The name of the pipeline.
    Admin The administrator of the pipeline.
    Related projects The project to which the pipeline belongs. This parameter is optional.
    Related applications The application with which the pipeline is associated. This parameter is optional.
    Forbidden Multi Instance If you turn on the switch, the previous pipeline instance is canceled when a new pipeline instance starts.
    Execute permission You can select Pipeline administrator or All business members.

Step 2: Add a code repository

  1. In the Input source section of the Edit pipeline page, click Add input.
  2. In the New input source pane, configure the repository information based on your business needs. After the configuration is complete, click Save.
    Parameter Description
    Input source The input source in which your code is stored.
    Repository The URL of the code repository. If you do not have a code repository, click Create new git repo and create a code repository as prompted.
    Branch The branch of the code repository.
    Dynamic Branch If you turn on the switch, you can reassign a branch when you run the pipeline.
    Credential type You can select Enterprise Key or Personal Certificate and configure the key or certificate as prompted.
    Source alias The alias of the input source.

Step 3: Edit the pipeline

  1. On the Edit pipeline page, click build in the Stage section. The Stage: build pane appears.
  2. Enter Upload package in the Stage Name field, click Add task, and then select Build from the task list.
    Edit stage information
    In the task list of the stage editing pane, the task1-Build task appears.
  3. Click task 1-Build. In the task editing pane, set Task Name to Build, click Add Step, and then select Build Node.js from the step list.
  4. In the Build Step section, set Name to Build Node.js, select an appropriate Node.js version, and then enter the build script in the Build Command field.
  5. In the task editing pane, click Add Step and select Upload Build Output from the step list. Modify Build Output Name and Packaging Path based on your business needs. Then click Save in the upper-right corner to save the modification.
    Note The final output of this step is Build output name.default, which will be used later.
  6. Click the Add icon on the right side of the package upload stage to add a stage. In the stage editing pane, set Stage Name to Deployment, click New Task, and then select Build from the task list.
  7. Click task 1-Build. In the task editing pane, set Task Name to Deploy an application in Web+. Click Add Step and select Run Command from the step list.
  8. In the Build Step section, set Step Name to Deployment. In the Run Command field, enter the following script:
    # Download the deployment package.
    mkdir -p dist
    curl -L $PACKAGE -o dist/webplus-node-demo.tgz
    
    # Install and configure the Web+ CLI.
    curl -s -L https://webplus-cn-shenzhen.oss-cn-shenzhen.aliyuncs.com/cli/install.sh | sudo sh
    wpctl configure --access-key-id $ACCESS_KEY_ID --access-key-secret $ACCESS_KEY_SECRET --region $REGION --profile webplus
    
    # Use the Web+ CLI to deploy the application.
    wpctl env:apply -y --package dist/webplus-node-demo.tgz --category "Node.js" --app webplus-node-demo --env test-env --create-on-absent
  9. In the Build Step section, click Add Parameter and add the parameters described in the following table. After the parameters are added, click Save in the upper-right corner and close the Edit pane.
    Source Parameter Description
    Output parameter PACKAGE The build output generated in the package upload stage. The build output is named in the format of Build output name.default.
    Custom ACCESS_KEY_ID The AccessKey ID of the Alibaba Cloud account used to deploy the application in Web+. For more information, see Create an AccessKey.
    Custom ACCESS_KEY_SECRET The AccessKey secret of the Alibaba Cloud account used to deploy the application in Web+. For more information, see Create an AccessKey.
    Custom REGION Make sure that the region you entered is the same as the region where you want to deploy the application. For more information about regions supported by Web+, see Supported regions.

Step 4: Run the pipeline

  1. In the upper-right corner of the pipeline page, click Run to start the pipeline.
  2. Wait until the pipeline execution is complete. To view the deployed application and environment, log on to the Web+ console and select the region where the deployed application resides in the upper-left corner.

References

For more information about Apsara DevOps, see What is Apsara DevOps?.