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 separate environments, like test and production, you can synchronize a service version to production from test after running tests.
- Otherwise, if you are using gateway groups to segment regions or teams, synchronizing a service can help distribute it across them.
note
Synchronizing keeps the service version the same between gateway groups, while publishing creates a new service version each time.
You can only synchronize the currently running service versions, not the older ones.
Prerequisites
- Have two gateway groups for test and production environments with at least one gateway instance in each group.
- Publish a service version in the test environment.
Synchronize Service to Production Group
- Dashboard
- ADC
You can publish a service by either configuring upstream nodes or by using service discovery mechanisms.
Using Upstream Nodes
- Select Published Services from the side navigation bar, then click version
1.0.0
under servicehttpbin API
. - Click
Sync to Other Gateway Group
from the Actions list. - In the Gateway Group field, choose
Production Group
, and then click Next. - In the How to find the upstream field, choose
Use Nodes
. - From the Nodes table, edit the Host and Port fields, enter your backend node address in the production environment or the mock server address.
- Click Sync.
Using Service Discovery
- Select Services from the side navigation bar, then click version
1.0.0
under servicehttpbin API
. - Click
Sync to Other Gateway Group
from the Actions list. - In the Gateway Group field, choose
Production Group
, and then click Next. - In the How to find the upstream field, choose
Use Service Discovery
. - In the Service Registry field, choose
Registry for Test
, as well as the Namespace and service name in the Registry. - 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"
}
}