description | icon |
---|---|
The easiest way to migrate away from Apollo GraphOS |
newspaper |
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.
Apollo compatibility mode
As the router/gateway can be migrated gradually, this method becomes the fastest way to initially migrate from Apollo to WunderGraph Cosmo.
- 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.
Now, let's walk through the steps with the help of a demo project
- Create an API key on Cosmo.
- Let's set up the graphs on Cosmo by running the command
make setup-cosmo COSMO_API_KEY=<api-key>
. - Populate the Cosmo API key and the webhook secret as environment variables in the Webhook-app folder.
- Start the webhook server by running the command
make run-webhook-app
from the root. - 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.
- Start the subgraphs by running the command
make run-subgraphs
. - Now we can run the Apollo Gateway using the command
make run-apollo-gateway
or run the Apollo Router using the commandmake run-apollo-router
.