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 CCE-based deployment details, see Step 6: Deploying an Application (CCE).
Purchasing and Configuring an ECS
Elastic Cloud Server (ECS) is used in this document. You can also use your own Linux host (running Ubuntu 16.04 OS).
- Buy an ECS.
The following table lists mandatory configurations. You can also select other configurations as you need.
Table 1 Configuring an ECS purchase Category
Configuration Item
Suggestion
Configure Basic Settings
Billing Mode
Select Pay-per-use.
CPU Architecture
Select x86. If this configuration item does not exist, ignore it.
Specifications
Select General computing with 2 vCPUs and 8 GiB memory or higher.
Image
Choose
.Configure Network
EIP
Select Auto assign.
Bandwidth Size
Select Bandwidth.
Configure Advanced Settings
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 to 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 Group tab and add an inbound rule in which Protocol is set to TCP and Port Range is 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, enter the name hosts, set the OS to Linux, and click Save.
- Click Add Target Host. In the dialog box that is displayed, configure the following information, agree to the statement, and click OK.
Table 2 Adding a host Configuration Item
Suggestion
Host Name
Enter a custom host name. For easy identification, use the name set when buying an ECS.
IP
Enter the EIP generated when buying the ECS.
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, enter the environment name phoenix-hostgroup, set Resource Type to Hosts and OS to Linux, and click Save.
- After a new environment record is added to the list, click the environment name. In the window that is displayed, click the Resources tab.
- Click Import Host. In the dialog box that is displayed, select the created host cluster from the drop-down list, select the host from the list, and click Import.
If you do not have permission to create environments, contact the administrator to grant you permissions on the permission management page of the application.
- On the Deployment Actions tab page, edit the actions of the application.
Click Install Docker and select phoenix-hostgroup from the Environment drop-down list. If a dialog box is displayed confirming whether you want to change the environment of the subsequent actions to phoenix-hostgroup, 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 run the following commands to check whether the dependency tools are successfully installed:
- Check the Docker image version.
docker -v
- Check the Docker-Compose version.
docker-compose -v
If information similar to that in Figure 1 is displayed, the installation is successful.
- Check the Docker image version.
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, enter the environment name phoenix-hostgroup, set Resource Type to Hosts and OS to Linux, and click Save.
- After a new environment record is added to the list, click the environment name. In the window that is displayed, click the Resources tab.
- Click Import Host. In the dialog box that is displayed, select the created host cluster from the drop-down list, select the host from the list, and click Import.
- Close the window after a message is displayed, indicating that the import is successful.
- On the Deployment Actions tab page, edit the actions of the application.
- Click Select Deployment Source. Set the deployment source by referring to Table 3.
- Retain the default settings in actions Decompress File and Run Shell Commands.
- 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 and 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 information and error information in logs.
- Verify the deployment result.
Open a browser, enter http://ECS IP address:5000 in the address box, and press Enter.
You can view the Store network menu in the navigation bar.
Enter http://ECS IP address:5001. The page displays a success message.
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