Quick Experience
Cloud Application Engine (CAE) simplifies hosting for serverless applications. With CAE, applications can be deployed within minutes using source code, software packages, or container images. CAE supports mainstream languages such as Java, Go, and Tomcat and multiple runtime systems. It provides seamless hosting of multiple types of applications, including web applications, microservices, and APIs. Also, it supports auto scaling based on resources or custom service metrics to cope with unexpected user access traffic. Related resources are billed on the pay-per-use basis. In addition, CAE enables zero infrastructure O&M, so that users can focus more on application service development.
In this example, CAE is bound to the GitHub source code repository, and a frontend and a backend component are deployed to build and archive source code and create applications.
The following figure shows the demo logical networking and calling relationship.
- Component CAE-frontend: Frontend GUI developed using the Vue framework. It functions as the application entry and can send requests to the backend.
- Component CAE-backend: Backend service developed using Spring Boot. It processes requests sent by the demo-frontend component.
Prerequisites
- You have signed up for a HUAWEI ID and enabled Huawei Cloud services and logged in.
- You have registered a GitHub account and created a private token for subsequent authorization.
GitHub addresses:
- demo-frontend: https://github.com/servicestage-demo/cae-frontend
- demo-backend: https://github.com/servicestage-demo/cae-backend
Creating an Environment
- Log in to the CAE console. If you use CAE for the first time, a message is displayed indicating that no environment has been created.
- Click Create Now. On the displayed page, set parameters by referring to Table 1.
Table 1 Creating an environment Parameter
Description
Environment
Enter an environment name.
Enterprise Project
Select an enterprise project.
An enterprise project facilitates project-level management and grouping of cloud resources and users. The default project is default.
It is available after the enterprise project function is enabled.
Virtual Private Cloud
Select the VPC to which the environment resource belongs from the drop-down list.
To create a VPC, click Create VPC. For details, see Creating a VPC.
NOTE:The VPC cannot be modified after the environment is created.
Subnet
Select a subnet from the drop-down list.
If no subnet is available, click Create Subnet to access the network console and create a subnet. For details, see Creating a Subnet for the VPC.
NOTE:Keep at least two available network IP addresses for CAE configuration and optimization.
Security Group
Select Automatically generated.
NOTE:This group must allow access from the selected subnet to both the subnet gateway address and the access addresses and ports of middleware such as RDS and CSE instances.
Organization
If you use CAE for the first time, select Create Organization from the drop-down list and enter an organization name.
- Click OK. The creation progress is displayed in the Creating environment window. Then the environment is successfully created.
Creating an Application
- Choose Components.
- Click on the right of Application on the top to create an application.
- Enter an application name, for example, cae_test.
- Click OK.
Creating a Component
Create a frontend component.
- In the created application, click Create Component.
You can also click Try Now under the Getting Started template on the overview page. Select the corresponding environment and application, and click Deploy to create components demo-backend and demo-frontend.
- Configure the component.
- Component: Enter cae-frontend.
- Version: The default value is 1.0.0.
- Specifications: Retain the default value. Change it if necessary.
- Instances: Retain the default value. Change it if necessary.
- Code Source: Select GitHub, and set Authorization, Username/Organization, Repository, and Branch.
- If you use CAE for the first time, create an authorization first. Click Create Authorization and set Authorization and Mode.
- Authorization: Retain the default value. Change it if necessary.
- Mode: Select Token.
- Token: Obtain a token from the GitHub website. You can click to view details.
- Click OK. After the authorization is created, enter Username/Organization, Repository, and Branch.
- Username/Organization: Select the username/organization created for GitHub.
- Repository: Select cae-frontend.
- Branch: Select master.
- If you use CAE for the first time, create an authorization first. Click Create Authorization and set Authorization and Mode.
- Language/Runtime System: Select Nodejs8.
- Custom Build: Select Default.
- Click Create and Deploy Component. In the displayed dialog box, click Deploy Now. Wait until the component is deployed.
- Configure Component: Click Configure Component to go to the component configuration page. After configuring the component by referring to Configuring a Component, click Set and Deploy Component.
- Create and Deploy Component: Directly create and deploy a component. Select this mode if components do not need to be configured individually.
- Cancel: Cancel the creation. The component information will not be saved.
Create a backend component.
- In the created application, click Create Component.
- Configure the component.
- Component: Enter cae-backend.
- Version: The default value is 1.0.0.
- Specifications: Retain the default value. Change it if necessary.
- Instances: Retain the default value. Change it if necessary.
- Code Source: Select GitHub, and set Authorization, Username/Organization, Repository, and Branch.
- If you use CAE for the first time, create an authorization first. Click Create Authorization and set Authorization and Mode.
- Authorization: Retain the default value. Change it if necessary.
- Mode: Select Token.
- Token: Obtain a token from the GitHub website. You can click to view details.
- Click OK. After the authorization is created, enter Username/Organization, Repository, and Branch.
- Username/Organization: Select the username/organization created for GitHub.
- Repository: Select cae-backend.
- Branch: Select master.
- If you use CAE for the first time, create an authorization first. Click Create Authorization and set Authorization and Mode.
- Language/Runtime System: Select java8.
- Custom Build: Select Default.
- Click Create and Deploy Component. In the displayed dialog box, click Deploy Now. Wait until the component is deployed.
Configuring a Component
Configure a frontend component.
- Choose Component Configurations.
- Select cae-frontend from the drop-down list in the upper part of the page.
- Click Edit in the Access Mode module.
- In the Access Component from Another Environment area, click Load Balancing > Add Load Balancer.
- Configure the parameters based on Table 2.
Table 2 Configuring external network access for load balancing Parameter
Description
Load Balancer
Select Built-in load balancer.
Access Control
Select Allow all IP addresses.
If you have configured an access control whitelist or blocklist, only IP addresses in the whitelist or not in the blocklist can access the component.
Health Check
Use the default value Start.
Port Settings
- Protocol: Select TCP.
- Listening Port: Enter 8080.
- Access Port: Select a valid port ranging from 0 to 65,535, for example, 20,004.
The port number must be unique.
- Click OK.
- Click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.
Configure a backend component.
- Select cae-backend from the drop-down list in the upper part of the page.
- Click Edit in the Access Mode module.
- Select Load Balancing, click Add Load Balancer, and set parameters by referring to Table 3.
Table 3 Configuring external network access for load balancing Parameter
Description
Load Balancer
Select Built-in load balancer.
Access Control
Select Allow all IP addresses.
If you have configured an access control whitelist or blocklist, only IP addresses in the whitelist or not in the blocklist can access the component.
Health Check
Use the default value Start.
Port Settings
- Protocol: Select TCP.
- Listening Port: Enter 9090.
- Access Port: Select a valid port ranging from 0 to 65,535, for example, 20,001.
The port number must be unique.
- Click OK.
- Click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.
Configure environment variables for a frontend component.
- Select cae-frontend from the drop-down list in the upper part of the page.
- Click Edit in the Environment Variables module.
- Click Add Environment Variable and configure the environment variable by referring to Table 4.
Table 4 Environment variable parameters Parameter
Description
Name
Enter VUE_APP_BASE_URL.
Variable/Variable Reference
Enter the backend access address, which can be obtained from Components, as shown in Figure 1.
Figure 2 Configuring frontend environment variables
- Click Save and then click OK to complete the configuration.
- Click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.
Accessing an Application
- Choose Components.
- Click the public network address in the Access Address column of the cae-frontend component to view the application page.
Figure 3 Application page
If you select the private network access mode, log in to the cluster node and run the curl command. For details, see Private Network Access.
Application O&M
- On the Overview page, you can view the component health status and resource usage.
- Select the environment, application, and component to be viewed.
- Click Component Events to display the entire running process of the component.
- Click Component Monitoring. The number of running instances of the current component and the CPU and memory usage of each instance are displayed.
- Click Component Logs. The logs of each instance are 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