Publish graph updates to GraphOS
Share your updated graph with your team for collaboration, insights, and safe delivery
To share your graph with your team, you need to publish it to GraphOS. Once you have, you can further explore your graph in Studio and share it with your team by inviting them to your organization.
Publish your subgraphs
To update a supergraph, you individually publish each subgraph schema to GraphOS. Whenever you publish a subgraph schema, GraphOS attempts to compose all the latest subgraph schemas into a single supergraph schema. If this composition succeeds, GraphOS updates your router with the result.
In this step, you'll publish subgraph schemas to the empty graph you created at the beginning of this set of guides.
Publish subgraph schemas
In your terminal:
Ensure your subgraphs are still running locally.
Take the multi-line command you copied from Studio at the beginning of this guide:
terminalAPOLLO_KEY=service:Federation-Quickstart:••••••••••••••••••••• \ rover subgraph publish Federation-Quickstart@current \ --schema ./products-schema.graphql \ --name your-subgraph-name \ --routing-url http://products.prod.svc.cluster.local:4001/graphql
and replace the last three lines with the following:
terminal--schema ./subgraphs/products/schema.graphql \ --name products \ --routing-url http://localhost:4001/products/graphql
It should now look something like this:
terminalAPOLLO_KEY=service:Federation-Quickstart:••••••••••••••••••••• \ rover subgraph publish Federation-Quickstart@current \ --schema ./subgraphs/products/schema.graphql \ --name products \ --routing-url http://localhost:4001/products/graphql
noteIn a production supergraph, a subgraph'srouting-url
is generally its public endpoint.While still in the retail demo's root directory, open a new terminal window. Paste and run your updated multi-line command.
Because the command provides a
localhost
address for therouting-url
, the terminal will confirm that you want to publish. EnterY
.If the command is successful, you'll see the following in your terminal:
terminalA new subgraph called 'products' was created in <GRAPH_REF> The supergraph schema for <GRAPH_REF> was updated, composed from the updated 'products' subgraph Monitor your schema delivery progression on studio: <STUDIO_URL>
Back in Studio, if you left the open when creating an empty supergraph, it will show Schema published on the bottom left and a button to See schema changes on the bottom right. You don't need to click it right now.
You can continue to publish new subgraphs to the same supergraph via Rover. There's no need to create or add new graphs in Studio.
Since you're publishing to the same supergraph, you no longer need to include the first line containing your graph API key in subsequent Rover commands. Run the
rover subgraph publish
command for theinventory
subgraph, substituting your graph ref:terminalrover subgraph publish <GRAPH_REF> \ --schema ./subgraphs/inventory/schema.graphql \ --name inventory \ --routing-url http://localhost:4001/inventory/graphql
Do the same for the
users
subgraph, substituting your graph ref:terminalrover subgraph publish <GRAPH_REF> \ --schema ./subgraphs/users/schema.graphql \ --name users \ --routing-url http://localhost:4001/users/graphql
Congrats! With these subgraphs published, you can explore and interact with them and the supergraph composed of them in GraphOS Studio.
reviews
and shipping
subgraphs.
The three you've just published are enough to understand what GraphOS Studio has to offer, but you can publish the others if you want to explore their schemas.Outside of a demo environment, different teams may independently manage and publish different subgraphs.Explore your supergraph
Once you've published subgraphs, open the Schema page from the left nav in Studio to explore the composed supergraph schema as well as individual subgraph schemas and the relationships between them.
The Reference tab lets you view and filter your schema's type and field definitions. For example, select Objects, then User, to see all of the
user
type's fields and which subgraphs provide them.The SDL tab displays your supergraph's API schema and supergraph schema, filterable by subgraph. Viewing the supergraph SDL (Schema Definition Language) allows developers to see exactly how subgraph schemas are composed together.
The Visualization tab provides a filterable, navigable, graphical representation of your supergraph schema. Once you start collecting metrics on your supergraph, you can use the visualization tool to create heatmaps to identify fields that are most frequently used, or have the highest latency or errors.
GraphOS also offers tools for managing your schema, including schema proposals, schema checks, and linting. Additionally, GraphOS schema delivery tools help you integrate schema publication into your DevOps workflows.
Once you deploy your router, either by self-hosting it or using the Apollo-managed cloud option, you can use it to collect and export telemetry to GraphOS Studio and other observability and application performance monitoring (APM) tools.
Next steps
Depending on your goals, you have several options for learning more about GraphOS' capabilities or moving your supergraph closer to production:
Learn about the different router types to decide which type best fits your use case.
Learn more about Studio features, including checks, linting, and proposals.
If you'd like a visual tour of some of these features, check out the video below.
Watch the video tour
Learn about GraphOS metrics and router telemetry.
Check out the
rover template
command to quickly start a new GraphQL project or explore implementations in different libraries and languages.Run with example supergraphs besides the retail demo supergraph: