Synchronize Services between Gateway Groups
Synchronizing published service versions between gateway groups is a helpful part of API version control. For example:
- When using gateway groups to isolate environments, such as test and production, you can synchronize a service version from test to production, after all tests are passed.
- If you are using gateway groups to separate business segments, such as regions or teams, synchronizing a service can help distribute the service across multiple gateway groups.
note
- Synchronizing keeps the service version the same between gateway groups, while publishing creates a new service version each time.
Prerequisites
- Install API7 Enterprise.
- Configure two gateway groups - one for the initial test environment and another as the final destination (e.g., production environment) - each with at least one gateway instance.
- Publish a service version in the initial gateway group for test environment.
Steps
- When publishing or synchronizing the same service version to different gateway groups, you can use different upstream addresses to correspond to the backend services in different environments.
- Service in "No Version" state can also be synchronized to other gateway groups. After synchronization, both gateway groups will have a same version number for the service.
- You can only synchronize the currently running service versions, not the older ones.
- Dashboard
- ADC
Using Upstream Nodes
- Select Published Services of your initial gateway group from the side navigation bar, then click the service version you want to synchronize, for example,
httpbin
with version1.0.0
. - Click the button next to Enable/Disable at the page header, then select Sync to Other Gateway Group.
- From the dialog box, do the following:
- In the Gateway Group field, choose your destination gateway group, for example,
Production Group
, and then click Next.
- From the dialog box, do the following:
- In the How to find the upstream field, choose
Use Nodes
. - Click Add Node. From the dialog box, do the following:
- In the Host and Port fields, enter
httpbin.org
as the host and80
as the port. - In the Weight field, use the default value
100
. - Click Add.
- In the Host and Port fields, enter
- Confirm the service information and then click Sync.
Using Service Discovery
- Select Published Services of your initial gateway group from the side navigation bar, then click the service version you want to synchronize, for example,
httpbin
with version1.0.0
. - Click the button next to Enable/Disable at the page header, then select Sync to Other Gateway Group.
- From the dialog box, do the following:
- In the Gateway Group field, choose your destination gateway group, for example,
Production Group
, and then click Next.
- From the dialog box, do the following:
- In the How to find the upstream field, choose
Use Service Discovery
. - In the Service Registry field, choose
Registry for Production
, as well as the Namespace and service name in the Registry. - Confirm the service information and then click Sync.
To sync the configuration to Production Group
with ADC, run:
adc sync -f adc.yaml --gateway-group "Production Group"
Validate the APIs in Production Group
Send a request to validate the API:
# Replace with your production group address.
curl "http://127.0.0.1:9080/headers"
You should see the following response:
{
"headers": {
"Accept": "*/*",
"Host": "httpbin.org",
"User-Agent": "curl/7.74.0",
"X-Amzn-Trace-Id": "Root=1-6650ab7e-32c90eba787abbeb4e3dbb0c",
"X-Forwarded-Host": "127.0.0.1"
}
}
Additional Resources
- Key Concepts
- Getting Started
- Best Practices