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:

  1. Ensure your subgraphs are still running locally.

  2. Take the multi-line command you copied from Studio at the beginning of this guide:

    terminal
    APOLLO_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:

    terminal
    APOLLO_KEY=service:Federation-Quickstart:••••••••••••••••••••• \
    rover subgraph publish Federation-Quickstart@current \
    --schema ./subgraphs/products/schema.graphql \
    --name products \
    --routing-url http://localhost:4001/products/graphql
    note
    In a production supergraph, a subgraph's routing-url is generally its public endpoint.
  3. 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 the routing-url, the terminal will confirm that you want to publish. Enter Y.

    • If the command is successful, you'll see the following in your terminal:

      terminal
      A 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.

      A dialog from GraphOS Studio updates to show a schema has been published.

      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.

  4. 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 the inventory subgraph, substituting your graph ref:

    terminal
    rover subgraph publish <GRAPH_REF> \
    --schema ./subgraphs/inventory/schema.graphql \
    --name inventory \
    --routing-url http://localhost:4001/inventory/graphql
    
  5. Do the same for the users subgraph, substituting your graph ref:

    terminal
    rover 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.

note
The retail demo contains other subgraphs—for example, the 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 GraphOS Studio Schema Reference page shows filterable list of types and fields.
  • 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 GraphOS Studio Schema SDL page has a left nav listing all subgraphs.
  • 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.

The GraphOS Studio Schema Visualization page shows an interactive representation of an e-commerce supergraph schema including Orders, Users, Variants, Products, etc.

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:

Feedback

Forums