Web App Service (Web+) enables you to build an exclusive environment based on an application configuration template. In the application configuration template, you can customize basic information used by applications, such as the resources, network environment, and program path. This topic describes how to use the command-line interface (CLI) to build a deployment environment based on a Jenkins template.

Prerequisites

Activate related services and authorize roles

Step 1: Download and install the command-line tool

In Linux or macOS, run the following command to download and install the CLI:

eval "$(curl -s -L https://webplus-cn-shenzhen.oss-cn-shenzhen.aliyuncs.com/cli/install.sh)"

Step 2: Configure the command-line tool

Run the following command to use the AccessKey ID and AccessKey secret of your account to register and configure the CLI, select the region where the environment resides, and then create a folder, for example, named demo:

wpctl configure --access-key-id "$ALICLOUD_ACCESS_KEY" --access-key-secret "$ALICLOUD_SECRET_KEY" --region "$ALICLOUD_REGION"  --profile demo
Note For more information about the valid values of the ALICLOUD_REGION parameter, see the Region ID column in Supported regions.

Step 3: Download a Jenkins template

The Wpfile file stores the configuration information used to create or update a deployment environment. Web+ creates a Jenkins template. You can run the following command to download the template and save the template in the Wpfile file:

wget http://aliwebx-sz.oss-cn-shenzhen.aliyuncs.com/docs/course/Jenkins5Wpfile -O Wpfile
Note When the Jenkins template is used, Web+ purchases an Elastic Compute Service (ECS) instance in Pay-As-You-Go mode under the default Virtual Private Cloud (VPC) and VSwitch. The type of the purchased ECS instance is ecs.g5.large (2 vCPUs and 8 GiB memory). Then, Web+ installs the AliyunLinux operating system and deploys the Jenkins.war file on the purchased ECS instance.

Step 4: Create a deployment environment based on the Jenkins template

Run the following command to create a Web+ application and a deployment environment. After you run the following command, Web+ automatically reads the configuration template in the Wpfile file, and creates a deployment environment based on the Jenkins template.

wpctl env:apply --app WebPlusJenkins --env WebPlusJenkinsDemoEnv --create-on-absent
Note It takes about 5 minutes to create the application and deployment environment. Wait with patience.

Step 5: Access the deployment environment

After the application and deployment environment are created, Web+ purchases the configuration resources in the template for you. It takes about 2 minutes to purchase the resources. Then, you can run the following commands to access the deployment environment:

  1. Run the following command to switch to the created application and deployment environment:
    wpctl env:use WebPlusJenkinsDemoEnv --app WebPlusJenkins
  2. Run the following command to view the event list:
    wpctl env:events
  3. Run the following command to view the environment information and obtain the application URL:
    wpctl env:info

Step 6: Install the Jenkins template environment

After accessing the deployment environment configured in the preceding steps in a browser, you can install the Jenkins template environment. During the installation, Jenkins will prompt you to enter the administrator password, which can be obtained from the file /Home/admin/. jenkins/secrets/initialAdminPassword. You can use the CLI to run the following command to query the password:

wpctl env:exec WebPlusJenkinsDemoEnv "cat /home/admin/.jenkins/secrets/initialAdminPassword"

References