Manage Services in Multi-Environments Using Gateway Group
Gateway groups are a logical grouping of one or more gateway instances that share the same configuration and behave consistently when handling API requests. Users can name the gateway groups and add labels to them to differentiate and manage different environments and clusters.
API7 Enterprise supports two types of gateway group management: API Gateway
and Ingress Controller
. This helps enterprises achieve environment and cluster isolation, multi-region and multi-cluster management, as well as service-level objective management based on projects.
This guide will show you how to manage service across the Test
, UAT
, and Prod
environments using gateway groups.
Background
To ensure service stability, compliance, and data security, the service goes through multiple environments, including test, UAT, and production environments. Without multi-environment management, developers need to deploy three sets of API7 Enterprise, and log in to the API7 Enterprise dashboard under different domains to develop, test, and deploy the same API. In the case of many business projects, this process will waste a lot of machine and management resources.
The gateway group feature of the API7 Enterprise provides developers with a unified entry point. It avoids switching between multiple dashboards, and enables simple and convenient deployment operations, thereby improving work efficiency and reducing operational errors.
Prerequisite(s)
- Install API7 Enterprise.
- Prepare different domain names for the service in the three environments:
test.acme.com
,uat.acme.com
, andprod.acme.com
.
Steps
Create Gateway Groups
Refer to adding a gateway group, and create three gateway groups:
Test
,UAT
, andProd
.In the organization section of the API7 Enterprise dashboard, assign clear roles to each developer user, and define fine-grained access permissions for each role by applying access control list (ACL).
Deploy Services to the Test Environment
Ensure that the test environment is configured, with the upstream address pointing to
http://test-backend-1
, which points to the backend service cluster in the test environment.Deploy the packaged
UserService
to the test environment servers using automated scripts or manual operations.Create
UserService
service within theTest
gateway group, and debug repeatedly on the same no-version service. Simulate real user scenarios to perform functional testing, performance testing, and security testing.Run the automated test suite, including unit tests and integration tests, in the test environment to verify that the
UserService
works as expected.
User Acceptance Testing (UAT)
Prepare the
UAT
environment, with the upstream address configured as the load balancer addresshttp://uat-backend-pool
, which connects to multiple backend servers in theUAT
environment.After the
UserService
in the UAT gateway group is debugged, synchronize it to theUAT
gateway group and change the host touat.acme.com
.In the
UAT
gateway group, configure the gateway group's security policies and compliance check functions, such as enabling log auditing.Invite business users or the QA team to conduct UAT testing to verify that the
UserService
service meets the business requirements.Collect user feedback and make necessary adjustments based on the feedback.
Deploy Services to the Production Environment
Ensure that the production environment is ready, with the upstream address configured as the production environment's virtual IP address
http://prod-backend-vip
, which connects to a high-performance server cluster.After the
UserService
is debugged, synchronize it to theProd
gateway group and change the host toprod.acme.com
.In the
Prod
gateway group, enable thePrometheus
plugin as a global rule to monitor API metrics, ensuring that all services and routes receive consistent monitoring and tracing, and real-time tracking of the performance and stability of theUserService
service.Develop a detailed rollback plan, including rollback steps, required time, and responsible personnel, and roll back the published services when necessary.
Regularly review and analyze the logs of the
UserService
, perform log management, and identify potential issues for improvement.
Conclusion
Without gateway groups, several sets of control planes and data planes needed to be deployed. Now, by creating gateway groups in the API7 Enterprise dashboard, physical and logical isolation can be achieved. It ensures the security, controllability, and efficiency of the service migration process, and reduces the risk of service interruption. Meanwhile, through flexible route rule adjustments, rapid service version switching and rollback can be achieved.