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, Project Managers: Creating and Configuring Projects.
- You have permissions to create applications. For details, see Editing Permissions.
- The related software package has been compiled.
- There are two options in the Select Deployment Source action: Artifact and Build task. In this example, Artifact is selected. Therefore, prepare a compiled software package in advance. If you select Build task, you do not need to prepare the software package.
- You have an ECS.
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.
- Click Create Host Cluster, enter the following information, and click Save.
Table 1 Parameters for creating a host cluster 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.
Enter 0 to 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.
Table 2 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 connectivity verification for the host.
For details about connectivity verification, see Hosts.
- Click Create Host Cluster, enter the following information, and click Save.
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.
Creating an Environment and Importing Hosts
Create a deployment environment and import hosts from the host cluster.
- Click the Environment Management tab.
- Create an environment.
- Click Create Environment, set the following parameters, and click Save.
Parameter
Mandatory
Description
Environment
Yes
Enter a user-defined environment name.
Enter 3 to 128 characters. Use digits, letters, hyphens (-), underscores (_), and periods (.).
Resource Type
Yes
You can choose Host based on the environment requirements.
OS
Yes
Choose Linux or Windows as the operating system for the host.
Description
No
Enter a description of the environment.
Max. 500 characters.
- Click Import Host. The system automatically filters all clusters that meet the requirements of the current environment. Select a target host cluster and import a host to the environment in either of the following ways:
Import separately: Click
in the Operation column of a host to import the host to the environment.
Import in batches: Select multiple hosts and click Import.
If you import a target host bound to a proxy host, the proxy host will be imported to the environment automatically.
- (Optional) After the host is imported, click
on the page to verify the connectivity.
- Click Create Environment, set the following parameters, and click Save.
Configuring Deployment Actions and Deploying the Application
The following describes the initialization procedure and parameters of the Tomcat application deployment template. For details, see Deployment Actions.
- Configure deployment actions.
Switch to the Deployment Actions tab and click Edit to set parameters.
- Install JDK
Table 3 Parameters for installing JDK Parameter
Mandatory
Description
Action Name
Yes
Customized action name displayed in the deployment actions Enter 1 to 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
JDK version.
Installation Path
Yes
Installation path of JDK.
Action Control
No
You can configure whether to enable this setting.
- Keep running on failure: whether to continue the task even if this action fails.
- Execute this action with the sudo permission: whether to use the sudo permission to deploy this action.
- Install Tomcat
Table 4 Parameters for installing Tomcat Parameter
Mandatory
Description
Action Name
Yes
Customized action name displayed in the deployment actions
Enter 1 to 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
You can configure whether to enable this setting.
- Keep running on failure: whether to continue the task even if this action fails.
- Execute this action with the sudo permission: whether to use the sudo permission to deploy this action.
- Stop Tomcat
Table 5 Parameters for stopping Tomcat Parameter
Mandatory
Description
Action Name
Yes
Customized action name displayed in the deployment actions.
Enter 1 to 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
Set parameters for Stop Service.
Absolute Path
Yes
Absolute path of the Tomcat service.
Action Control
No
Whether to enable this action.
- Keep running on failure: whether to continue the task even if this action fails.
- Execute this action with the sudo permission: whether to use the sudo permission to deploy this action.
- Select a deployment source
Table 6 Parameters for selecting a deployment source Parameter
Mandatory
Description
Action Name
Yes
Customized action name displayed in the deployment actions.
Enter 1 to 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
Select an existing software package in Artifact or upload a software package or file from your local PC. (The software package or file uploaded can be reused.)
package_url indicates the path of the software package in CodeArts Artifact.
Download Path
Yes
Where the downloaded software package is stored.
Action Control
No
Whether to enable this action.
- Keep running on failure: whether to continue the task even if this action fails.
- Execute this action with the sudo permission: whether to use the sudo permission to deploy this action.
In this example, Artifact is selected as the deployment source. If you select Build task, see Selecting a Deployment Source in the User Guide.
- Start Tomcat
Table 7 Parameters for starting Tomcat Parameter
Mandatory
Description
Action Name
Yes
Customized action name displayed in the deployment actions.
Enter 1 to 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
Set parameters for Start Service.
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
Set the waiting time. After the waiting time ends, check whether the monitoring 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 detection fails.
Enter a time (0–300s)
Action Control
No
Whether to enable this action.
- Keep running on failure: whether to continue the task even if this action fails.
- Execute this action with the sudo permission: whether to use the sudo permission to deploy this action.
- Health test through URLs
Table 8 Parameters for health test through URLs Parameter
Mandatory
Description
Action Name
Yes
Customized action name displayed in the deployment actions.
Enter 1 to 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.
Keep running on failure: whether to continue the task even if this action fails.
After the Health Test Through URLs parameter is set, all parameters are completed. For more details about application configuration, see Managing Parameters.
- 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.
For more information, see .
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.