Creating a Tomcat Application Using CodeArts Deploy and Deploying It on an ECS
CodeArts Deploy provides you with visualized, automated, and rich deployment actions, helping you 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 Configuring Permissions for Different Roles.
- 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. (If not, purchase one by referring to Purchasing an ECS. You may be charged in the process. For details, see Billing Overview).
Creating a Host Cluster and Adding Hosts to It
- Log in to the Huawei Cloud console and click Console.
- 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 (.).
Example: Host cluster A
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
An agent 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. Enter an 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 Adding a Target Host to a Host Cluster.
SSH Port
Yes
Port 22 is recommended. Custom ports are supported.
Correct port range: 1-65535.
- Click
in the Operation column of a host to start the connectivity verification for the host.
For details about connectivity verification, see Host Management.
- 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. For details, see Table 3 Parameter description.
Table 3 Parameter description Parameter
Mandatory
Description
Name
Yes
Enter an application name.
Enter 3 to 128 characters, including letters, digits, hyphens (-), and underscores (_).
Project
Yes
Retain the default value. Project to which an application belongs. If your account does not have a project, click Create Project and click Scrum to create one.
Description
No
Enter an application description with a maximum of 1,024 characters.
Execution Resource Pool
Yes
Official is selected by default. An agent pool is a collection of physical environments where commands are executed during software package deployment. You can use the official agent pool hosted by Huawei Cloud or host your own servers as a self-hosted agent pool on Huawei Cloud. For details about how to host your own servers, see Creating a Self-hosted Agent Pool.
If the tenant account has enabled Intranet Secure Access (only for whitelisted users), Self-hosted is selected by default and cannot be changed.
Deploy from pipeline
No
Toggling on the switch indicates that this application can be executed only in a pipeline. It cannot be executed independently.
- After editing the basic application information, click Next. The deployment template selection page is displayed.
Select Deploying a Tomcat Application and click OK.
- 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. For details, see Table 3 Parameter description.
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 Configuring Deployment Actions for a CodeArts Deploy Application.
- Configure deployment actions.
Switch to the Deployment Actions tab and click Edit to set parameters.
- Install JDK.
Table 4 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 5 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 6 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 7 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 8 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 may fail.
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 9 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 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:
- Check the automatic matching solution.
If the application 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.
For more deployment FAQs, see Application Deployment.
- Check the automatic matching solution.
(Optional) Verifying Deployment Results
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