To isolate development, testing, and production environments for your applications, create a namespace for each environment. Applications in the same namespace can invoke methods from each other over the internal network. Applications in different namespaces are isolated from each other.
Solution overview
This topic describes how to create three namespaces for your development, testing, and production environments: dev, test, and prod. After you deploy an application to one namespace, you can copy it to other namespaces and change its configuration as needed. You can also start and stop applications in your development, testing, or production environments in batches to improve operations and maintenance (O&M) efficiency.
Procedure
1. Create a namespace
Log on to the SAE console. In the top menu bar, select the region where you want to deploy your application. This topic uses China 1 (Hangzhou) as an example.
You can create multiple namespaces in the same region. First, create the
devnamespace. In the navigation pane on the left, choose , and then click Create Namespace. Set Namespace Name and Namespace ID todev.Create and associate a virtual private cloud (VPC) with the
devnamespace. Click Create VPC to go to the VPC Management Console. Make sure that the Region is the same as your application's deployment region. Set Name todev-vpc. Configure the IPv4 CIDR block of the VPC as needed. For more information, see Create and manage a VPC.A VPC is the private network where your applications reside. A namespace can be associated with only one VPC. This means that applications in the same namespace are in the same VPC.
Applications must be deployed in a vSwitch. To improve application availability, create two vSwitches in different zones within
dev-vpc. Set the Name, Zone, and IPv4 CIDR Block for the vSwitches as needed. For more information, see Create and manage a vSwitch. Then, click +Add to configure the other vSwitch and click OK.vSwitches within the same VPC can communicate with each other over the internal network.
Return to the Create Namespace panel in the SAE Console. Set Virtual Private Cloud to the VPC that you created in the previous step and click OK.
The dev namespace is now created. Repeat these steps to create the test and prod namespaces.
To isolate applications in different namespaces, create and associate a different VPC with each namespace. Otherwise, applications in different namespaces can communicate over the VPC internal network and may interfere with each other.
2. Deploy applications
First, deploy your application to the dev namespace. Then, copy the application to the test and prod namespaces.
In the navigation pane on the left, choose . Set Namespace to
dev, and then click Create Application. Deploy your applications one by one to thedevnamespace. For each application, specify the VPC and vSwitches that you created in the previous step. For more information, see Deploy an application.In the Applications list, select the application that you created. In the Actions column, click Copy. Set Namespace to
testorprodto copy the application to the corresponding namespace. You can also change the application's configuration for different environments.
3. Start and stop applications in batches
You can start and stop applications in the development, testing, or production environments in batches. You can manually start and stop applications in batches or create rules to start and stop them on a schedule.