Creating a Tomcat Application Using CodeArts Deploy and Deploying It on an ECS
CodeArts Deploy provides users with visualized, automatic, and rich deployment actions, helping them establish a standard deployment process, reducing deployment costs, and enhancing release efficiency.
This section uses Deploy a Tomcat Application as an example to describe how to deploy a Tomcat application on a host. The following describes how to quickly deploy an application.
Prerequisites
- A project is available. If there is no project, create one.
- You have permissions to create applications. For details, see Editing Permissions.
- 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.
Creating a Host Cluster and Adding Hosts to It
- Go to the CodeArts homepage and click the target project name to access the project.
- Go to the Basic Resources page.
Choose Settings > General > Basic Resources. The Host Clusters page is displayed by default.
Choose CICD > Deploy. Click Basic Resources. The Host Clusters page is displayed by default.
- Create a host cluster and add hosts to it.
- 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.
Enter 3 to 128 characters. Use digits, letters, hyphens (-), underscores (_), and periods (.).
OS
Yes
Select Linux or Windows based on the OS of the host to be added.
In this example, select Linux.
Host Connection Mode
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 Deploy to the target host.
Direct connection: Select a host bound with an EIP as the target host to connect to CodeArts.
Proxy: Select a host bound with an EIP as the proxy host to connect to CodeArts.
Execution Resource Pool
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.
Max. 500 characters.
- (The following uses a Linux-based target host as an example.) Click Add Host, select Adding IP for Add hosts by, enter the following information, and click OK. The target host is created.
Table 1 Parameters of the target host (Linux) Parameter
Mandatory
Description
Host Name
Yes
Enter a custom name.
Enter 3 to 128 characters. Use digits, letters, hyphens (-), underscores (_), and periods (.).
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.
Correct port format: 1-65535.
- Click in the Operation column of a host to start the host for connectivity verification.
Creating an Application
- Choose CICD > Deploy.
- Create an application.
- Click Create Application. On the Basic Information page that is displayed, modify the basic information such as 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.
Creating an Environment and Importing Hosts
- Create a deployment environment and import hosts from the host cluster.
- 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.
Configuring Deployment Actions and Deploying the Application
- Configure deployment actions.
Switch to the Deployment Actions tab page and click Edit to set parameters.
- Install JDK
Table 2 Parameters for installing the JDK Parameter
Mandatory
Description
Action Name
Yes
Name of an added deployment action.
Max 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./().
Environment
Yes
Select a host cluster as the deployment object.
JDK Version
Yes
Select the JDK version to be installed.
Installation Path
Yes
Installation path of JDK.
Action Control
No
Whether to enable this action.
- Whether to keep running on failure.
- Whether to execute this action with the sudo permission.
- Install Tomcat
Table 3 Parameters for installing Tomcat Parameter
Mandatory
Description
Action Name
Yes
Name of an added deployment action.
Max 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./().
Environment
Yes
Select a host cluster as the deployment object.
Tomcat Version
Yes
Version of Tomcat to be installed.
Installation Path
Yes
Installation path of Tomcat.
HTTP Port
Yes
Default port: 8080
AJP Port
Yes
Default port: 8009
Service Shutdown Port
Yes
Default port: 8005
Action Control
No
Whether to enable this action.
- Whether to keep running on failure.
- Whether to execute this action with the sudo permission.
- Stop Tomcat
Table 4 Parameters for stopping Tomcat Parameter
Mandatory
Description
Action Name
Yes
Name of an added deployment action.
Max 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./().
Environment
Yes
Select a host cluster as the deployment object.
Operation
Yes
Start and Stop are available.
Absolute Path
Yes
Absolute path of the Tomcat service.
Action Control
No
Whether to enable this action.
- Whether to keep running on failure.
- Whether to execute this action with the sudo permission.
- Select Deployment Source
Table 5 Parameters for selecting a deployment source Parameter
Mandatory
Description
Action Name
Yes
Name of an added deployment action.
Max 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./().
Source
Yes
Two types are available: Artifact and Build task.
Environment
Yes
Select a host cluster as the deployment object.
Software Package
Yes
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
Yes
Where the downloaded software package is stored.
Action Control
No
Whether to enable this action.
- Whether to keep running on failure.
- 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 Selecting a Deployment Source.
- Start Tomcat
Table 6 Parameters for starting Tomcat Parameter
Mandatory
Description
Action Name
Yes
Name of an added deployment action.
Max 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./().
Environment
Yes
Select a host cluster as the deployment object.
Operation
Yes
Start and Stop are available.
Absolute Path
Yes
Absolute path of the Tomcat service.
HTTP Port
Yes
HTTP port of the Tomcat service.
AJP Port
Yes
AJP port of the Tomcat service.
Service Shutdown Port
Yes
Shutdown port monitored by the Tomcat service.
Waiting Time
Yes
After the specified duration, the system checks the service status. You can adjust the time based on the actual time required for starting the service. If the time is improper, the detection fails.
Enter a time (Max. 300s)
Action Control
No
Whether to enable this action.
- Whether to keep running on failure.
- Whether to execute this action with the sudo permission.
- Health Test Through URLs
Table 7 Parameters for health test through URLs Parameter
Mandatory
Description
Action Name
Yes
Name of an added deployment action.
Max 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./().
Environment
Yes
Select a host cluster as the deployment object.
Retries
Yes
The number of times you want the system to retry the health test before the test is considered failed.
Interval (s)
Yes
Interval between two retries,
in seconds (0–60).
Test Path
Yes
Path of the service to be tested. You can add multiple paths.
Action Control
No
Whether to enable this action.
- Whether to keep running on failure.
After the Health Test Through URLs parameter is set, all parameters are completed. For details about application configuration, see Configuring Parameters of an Application.
- Install JDK
- Deploy an application.
After setting the preceding parameters, click Save & 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.
For more information, see User Guide.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot