What problem does it solve?
The first step to migrate from Apollo GraphOS is to move the graphs from GraphOS to WunderGraph Cosmo. Once this is done, migration from the Apollo Router/Gateway to the Cosmo router can be done gradually using the Apollo compatibility mode.
Steps to migrate
Migrate your graphs from Apollo GraphOS to WunderGraph Cosmo. It can be done in 2 ways.
- Use the Migrate from Apollo button.
- It can be done manually using the subgraph create, subgraph publish and federated-graph create commands.
Once the graphs are completely migrated, we have to implement a webhook which runs the fetch command to generate the supergraph schema, which can be used to update the router/gateway.
Now, we can set a webhook alert on Cosmo.
Demo project with step-by-step instructions
Now, let’s walk through the steps with the help of a demo projectCreate an API key on Cosmo.
Populate the Cosmo API key and the webhook secret as environment variables in the Webhook-app folder.
Set up the webhook alert on Cosmo, by providing the endpoint, and the secret and then select the FEDERATED_GRAPH_SCHEMA_UPDATED event with the above-created graph.
Now, let’s make a small change in one of the subgraphs and publish that subgraph.
On publish, the webhook would be triggered and the supergraph schema from Apollo would be generated.