Step 6: Deploying an Application (ECS)
This section uses phoenix-sample-standalone as an example to describe how to deploy the release package to a host. For details about CCE-based deployment, see Step 6: Deploying an Application (CCE).
Purchasing and Configuring an ECS
This section uses Elastic Cloud Server (ECS). You can also use your own Linux host that runs Ubuntu 16.04 OS.
- Buy an ECS.
The following table lists mandatory configurations. You can also select other configurations as necessary.
Table 1 Configuring an ECS purchase Category
Configuration Item
Suggestion
Configure Basic Settings
Billing Mode
Select Pay-per-use.
Instance
CPU Architecture
Select x86.
Specifications
Select 2 vCPUs and 8 GiB memory or higher.
OS
Image
Choose Public image > Ubuntu > Ubuntu 16.04 server 64bit.
Public Network Access
EIP
Select Auto assign.
Billed By
Select Bandwidth.
Instance Management
Login Mode
Select Password.
Password
Enter a custom password.
- Configure security group rules.
Use ports 5000 and 5001 to verify the sample project. Therefore, add an inbound rule that allows access over ports 5000 and 5001.
The procedure is as follows:
- Log in to the ECS list page, locate the ECS purchased in step 1, and click the ECS name.
- Click the Security Groups tab, and add an inbound rule with Protocol set to TCP and Port Range set to 5000-5001 by referring to Configuring Security Group Rules.
Adding a Target Host to the Project
Before deploying applications to ECSs, add the target hosts to the basic resources of the project.
- Go to the Phoenix Mall project and choose from the navigation pane.
- Click Create Host Cluster, configure the following information, and click Save.
Table 2 Creating a host cluster Parameter
Suggestion
Cluster Name
Enter host-group.
OS
Select Linux.
Host Connection Mode
Select Direct Connection.
Execution Resource Pool
Select Official.
- Click Add Host, configure the following information, and click OK.
Table 3 Adding a host Configuration Item
Suggestion
Add Hosts by
Select Adding IP.
Host Name
Keep this name same as the name of the purchased ECS.
IP
Enter the EIP generated when buying the ECS.
Authorization
Select Password.
Username
Enter root.
Password
Enter the password set when buying the ECS.
SSH Port
Enter 22.
- A host record is displayed on the page. If Succeed is displayed in the Verification Result column, the host is added successfully.
If the host fails to be added, check the host configuration based on the failure details.
Installing Dependency Tools on ECS
The sample program depends on Docker and Docker-Compose, which must be installed on the target ECS.
- Go to the Phoenix Mall project, choose phoenix-sample-predeploy application in the list. , and find the
- Click and choose Edit from the drop-down list.
- Click the Environment Management tab and configure the host environment.
- Click Create Environment, configure the following information, and click Save.
Table 4 Creating an environment Parameter
Value
Environment
Enter phoenix-env.
Resource Type
Select Host.
OS
Select Linux.
If you do not have permission to create environments, contact the administrator to grant you permissions on the permission management page of the application.
- Click Import Host. In the displayed dialog box, select the configured host cluster and host and click Import.
- When a message indicating that the import is successful is displayed, close the window.
- Click Create Environment, configure the following information, and click Save.
- On the Deployment Actions tab page, edit the actions of the application.
In action Install Docker, select phoenix-env from the Environment drop-down list. If a dialog box is displayed, asking you to confirm whether you want to change the environment to phoenix-env for the subsequent actions, click OK.
- Click Save & Deploy to start the deployment task.
If a message is displayed indicating successful deployment, the task is successfully executed.
- Log in to the ECS and check whether the dependency tools are successfully installed:
- Run the docker -v command to check the Docker image version.
- Run the docker-compose -v command to check the Docker-Compose version.
If the command output similar to Figure 1 is displayed, the installation is successful.
Configuring and Executing an Application
During deployment, configure the ECS in the environment list of the application and set the build task phoenix-sample-ci as the deployment source.
- Go to the Phoenix Mall project, choose phoenix-sample-standalone application in the list. , and find the
- Click and choose Edit from the drop-down list.
- Click the Environment Management tab and configure the host environment.
- Click Create Environment, configure the following information, and click Save.
Table 5 Creating an environment Parameter
Value
Environment
Enter phoenix-env.
Resource Type
Select Host.
OS
Select Linux.
- Click Import Host. In the displayed dialog box, select the configured host cluster and host and click Import.
- When a message indicating that the import is successful is displayed, close the window.
- Click Create Environment, configure the following information, and click Save.
- On the Deployment Actions tab page, edit the actions of the application.
- Click Select a Deployment Source. Set the deployment source by referring to Table 6.
Table 6 Configuring the deployment source Configuration Item
Suggestion
Source
Select Build task.
Build Task
Select phoenix-sample-ci.
Environment
Select phoenix-env.
If a dialog box is displayed, asking you to confirm whether you want to change the environment to phoenix-env for the subsequent actions, click OK.
- Retain the default settings in actions Decompress Files and Run Shell Commands.
- Click Select a Deployment Source. Set the deployment source by referring to Table 6.
- Click the Parameters tab and set parameters based on the SWR login command.
You can obtain the login command from the console. For details, see Configuring SWR.
- Click Save & Deploy to start deployment.
If a message is displayed indicating that the deployment is successful, continue with the next step. If the deployment fails, rectify the fault based on the failed action and the error information in logs.
- Verify the deployment result.
- Open a browser, enter http://IP:5000 in the address box, and press Enter. IP indicates the elastic IP address of the ECS. The Phoenix Mall homepage is displayed.
- Enter http://IP:5001 and press Enter. IP indicates the elastic IP address of the ECS. The Phoenix Mall dashboard is displayed.
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