A starting point for deploying the Router via a Dockerfile using GraphOS Enterprise.
⚠️ This template requires GraphOS Enterprise, if you'd like a similar template that does not require an enterprise plan, please open a discussion and describe your use-case and requirements.
router.yaml—configuration for the routerDockerfile—used to build the router for deployment.apollo—contains some JSON schemas for the config files (to make IDE experience better).github/workflows/update-router-config.yaml—auto-update JSON schemas when the router version changes.vscode—contains recommended VS Code settings.idea—contains recommended Jetbrains editor settingsrenovate.json—configured to keep Router up to date- A sample
supergraph.yamlfile for testing Router viarover dev. You'll need to update this file to point at the local versions of your subgraphs.
- Deploy to your environment of choice and set up CI/CD to deploy newer versions.
- Set
APOLLO_KEYandAPOLLO_GRAPH_REFsecrets in deploy - (Optional) - Delete irrelevant cloud provider config files (i.e. if deploying to Railway, you can delete the
render.yamlfile)
- Set
- Enable Renovate on this repo to keep Router up to date
- Set up a deployment preview for PRs to changes which you can run integration tests against
- Set up secrets for each of your subgraphs so that only the routers can access them
- Disable subgraph error inclusion, sandbox, and introspection in
router.yamlonce you have everything working (you probably don't want those enabled in production)
docker build -t router .builds the router image with the tagrouterfor local testing.rover dev --supergraph-config supergraph.yaml --router-config router.yamlto run the Router locally without Docker (using Rover). You'll need to update thesupergraph.yamlfile to point at the local versions of your subgraphs. Make sure to set the required environment variables ahead of time!- You can add the
--graph-refoption to yourrover devcommand if you want to develop off of your current variant's state in GraphOS
- You can add the
docker run -it --env APOLLO_KEY --env APOLLO_GRAPH_REF -p4000:4000 routerruns the same router image you'll run in production. You can now query the router athttp://localhost:4000.- Make sure to set the env vars
APOLLO_KEYandAPOLLO_GRAPH_REFfirst - You can alternatively create a file (e.g.,
.env) and rundocker run -it --env-file .env -p4000:4000 router. Make sure not to check this file into source control! - Your local router will need network access to the subgraphs
- Make sure to set the env vars