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.
Sync Single Service to Other Gateway Group
- 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
- 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
. - If the service is in the "No Version" state, enter a version number (e.g., "2.0.0") in the Version field. Otherwise, the existing version number will be automatically copied and cannot be edited.
- Click Sync.
:::Note
When synchronizing a service for the first time, configure the necessary service runtime configurations and enable the service to activate your APIs. For subsequent synchronization and publications, the service status and runtime configurations will be inherited from the previous version.
:::
To sync the configuration to Production Group
with ADC, run:
adc sync -f adc.yaml --gateway-group "Production Group"
Configure Service Runtime Configurations
- After synchronization, you will be redirected to the published service
httpbin 1.0.0
on theProduction Group
. - Select the Upstreams from the side navigation bar.
- Click Add Node.
- From the Add Node dialog box, do the following:
- In the Host field, enter
httpbin.org
. - In the Port field, enter
80
. - In the Weight field, enter
100
. - Click Add.
- Click Enable from the top header of the published service and confirm.
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/ip"
You should see the following response:
{
"origin": "127.0.0.1"
}
Additional Resources
- Key Concepts
- Getting Started
- Best Practices