Creating a Deployment Task
This section uses Deploying a Tomcat Application as an example to describe how to deploy an application on a host.
Preparations
- A project is available. If no project is available, create one first.
- You have permission to create applications. For details, see Permission Management.
- The related software package has been compiled.
You can set Source to Artifact or Build task. In this example, Artifact is selected. Therefore, you need to prepare the compiled software package in advance. If you select Build task, you do not need to prepare the software package.
Procedures
- Go to the CodeArts homepage and click the target project name to access the project.
- Create basic resources.
- Choose Settings > General > Basic Resources. The Host Clusters page is displayed by default.
- Click Create Host Cluster, enter the following information, and click Save.
Parameter
Mandatory
Description
Cluster Name.
Yes
Enter a custom name.
OS
Yes
Select Linux or Windows based on the OS of the host to be added.
Use Proxy
Yes
If the target host cannot connect to the public network, you need to select a host bound with an EIP as the proxy host to connect CodeArts to the target host. Example: disabled.
Execution Host
Yes
A resource pool is a collection of physical environments where commands are executed during software package deployment. In this scenario, select official.
Description
No
Enter a description.
- (The following uses a target host running Linux as an example.) Click Add Target Host, enter the following information, and click OK.
Table 1 Parameters of the target host (Linux) Parameter
Mandatory
Description
Host Name
Yes
Enter a custom name.
Proxy Host
Yes
Select a network proxy that cannot connect to the public network.
IP
Yes
Enter the private or public IP address of the target host.
OS
Yes
Keep the default value because it is the OS of your host cluster.
Authorization
Yes
Select a Password or Key for authentication as required.
- Password: The Username and Password are displayed on the page. Take ECS as an example. You need to enter the ECS username and password.
- Key: The Username and Key are displayed on the page. For details about how to generate and obtain a key, see Obtaining the Linux Key.
SSH Port
Yes
Port 22 is recommended. Custom ports are supported.
- Click in the Operation column of a host to start the host for connectivity verification.
- Choose CICD > Deploy.
- Create an application.
- Click Create Application. On the Set Basic Information page that is displayed, modify the basic information such as App Name, Description, and Execution Resource Pool as required.
- After editing the basic application information, click Next. The deployment template selection page is displayed.
Select Deploying a Tomcat Application and click OK.
The following describes the initialization procedure and parameters of the Tomcat application deployment template. For details, see Deployment Actions.
- Import basic resources.
- Switch to the Environment Management tab page and click Create Environment.
- Enter basic information, such as the Environment, OS, and Description, and click Save.
- Switch to the Resource tab page and click Import Host.
- The system automatically filters all clusters that meet the requirements of the current environment. In the dialog box that is displayed, select the target host cluster and click in the Operation column of a host to import the host to the environment.
- Edit an application.
- Install JDK
Table 2 Parameters for installing the JDK Parameter
Description
Action Name
Name of an added deployment action.
Environment
Target environment.
JDK Version
JDK version.
Installation Path
Installation path of JDK.
Action Control
- Whether to enable this action.
- Whether to continue the task even if this action fails.
- Whether to execute this action with the sudo permission.
- Install Tomcat
Table 3 Parameters for installing Tomcat Parameter
Description
Action Name
Name of an added deployment action.
Environment
Target environment.
Tomcat Version
Tomcat version.
Installation Path
Installation path of Tomcat.
HTTP Port
Default port: 8080
AJP Port
Default port: 8009
Service Shutdown Port
Default port: 8005
Action Control
- Whether to enable this action.
- Whether to continue the task even if this action fails.
- Whether to execute this action with the sudo permission.
- Stop Tomcat
Table 4 Parameters for stopping Tomcat Parameter
Description
Action Name
Name of an added deployment action.
Environment
Target environment.
Operation
Start and Stop are available.
Absolute Path
Absolute path of the Tomcat service.
Action Control
- Whether to enable this action.
- Whether to continue the task even if this action fails.
- Whether to execute this action with the sudo permission.
- Select Deployment Source
Table 5 Parameters for selecting a deployment source Parameter
Description
Action Name
Name of an added deployment action.
Source
Two types are available: Artifact and Build task.
Environment
Target environment.
Software package
You can select an existing software package in CodeArts Artifact or from a local host.
package_url indicates the path of the software package in CodeArts Artifact.
NOTE:Local software packages or files uploaded to CodeArts Artifact can be reused.
Download Path
Where the downloaded software package is stored.
Action Control
- Whether to enable this action.
- Whether to continue the task even if this action fails.
- Whether to execute this action with the sudo permission.
In this example, Artifact is selected as the deployment source. If you select Build task, see in the User GuideSelecting a Deployment Source.
- Start Tomcat
Table 6 Parameters for starting Tomcat Parameter
Description
Action Name
Name of an added deployment action.
Environment
Target environment.
Operation
Start and Stop are available.
Absolute Path
Absolute path of the Tomcat service.
HTTP Port
HTTP port of the Tomcat service.
AJP Port
AJP port of the Tomcat service.
Service Shutdown Port
Shutdown port monitored by the Tomcat service.
Waiting Time
The time required for starting the service. If you set Operation to Start, the system checks the process during startup to determine whether the service is started successfully. You can adjust the time based on the actual time required for starting the service. If the time is improper, the check fails.
Action Control
- Whether to enable this action.
- Whether to continue the task even if this action fails.
- Whether to execute this action with the sudo permission.
- Health test via URLs
Table 7 Parameters for health test via URLs Parameter
Description
Action Name
Name of an added deployment action.
Environment
Target environment.
Retries
The number of times you want the system to retry the health test before the test is considered to have failed.
Interval (s)
Test interval.
Test Path
Path of the service to be tested. You can add multiple paths.
Action Control
- Whether to enable this action.
- Whether to continue the task even if this action fails.
After the Health Test via URLs parameter is set, all parameters are completed. For more configuration details, see "Managing Applications" > "Editing an Application"Editing an Application.
- Install JDK
- Deploy an application.
After setting the preceding parameters, click Save and Deploy to deploy an application.
- Application deployed.
- If an application fails to be deployed, perform the following steps to locate the fault:
- View the automatic matching solution.
If the deployment fails, click View Solution under deployment actions to go to the corresponding help center page.
- Search for a solution manually.
If the issue persists, paste the error information (content in the red box) to the search box of the help center and manually search for the solution.
- View the automatic matching solution.
(Optional) Verifying the Deployment Result
The Deploying a Tomcat Application template supports deployment result verification. This section describes how to verify the deployment result. After the application is successfully deployed, enter the following information in the address box of the browser:
<Public IP address of the target host>:8080/tomcat-demo
Press Enter. If the following information is displayed, the application is successfully deployed.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.