Skip to main content
Version: v3.x

Deploy your Supergraph

What's about to happen?

You're about to deploy your supergraph to Hasura DDN, our globally-distributed, highly-available, lightning-fast hosted service!

Steps

Required

Step 1. Build and deploy your supergraph

From the root of your project, run:
ddn supergraph build create \
--supergraph supergraph.cloud.yaml \
--subgraph-env-file my_subgraph:my_subgraph/.env.my_subgraph.cloud
Project set in context

Remember that because we set the project context, we don't need to pass the project name as a flag in the command.

Step 2. Explore your supergraph in the Hasura Console

The CLI will respond with a build version and build Console URL. Click on it!

You can go ahead and explore the API for this build in the Hasura Console!

Step 3. Apply your supergraph as your project's endpoint.

An applied build is the default one that is served by your Hasura DDN project endpoint.

To apply a build, run:
ddn supergraph build apply <supergraph-build-version>

What did this do?

When you ran the command above, the CLI used the configuration you provided to create an immutable build of your supergraph on Hasura DDN. This build is now accessible via the build's GraphQL endpoint and in the Hasura Console for exploration.

Teammates can explore the API, interact with it, and provide feedback before you iterate and create a new build for testing. Or, if you're ready, you can apply the build so that it's served by the project's endpoint. And, should you realize you applied it a little early, you can easily roll it back by applying an older build.

Next steps

At this point, you have all the ingredients and knowledge to create a robust supergraph that composes data across various sources and aggregates them into a single, reliable, performant API. Before moving to production, consider the resources below:

Migrations

Hasura recommends a number of third-party solutions for managing database migrations. Commonly, users implement migrations via CI/CD with Flyway or similar resources.

Doesn't Hasura manage migrations?

In v2, Hasura provided a built-in migration tool. However, as v3 metadata is decoupled from the underlying data source, you are free to manage your migrations however you wish.

Performance optimizations

Hasura provides a suite of observability tools directly in a project's DDN console. You can view traces, query plans, and general usage statistics. These are helpful for diagnosing common bottlenecks and problems with your application's performance. You can read more about these here.

CI/CD

You can create a pipeline for deployments using any tools you wish. As we recommend initializing a git repository early in the project creation process, and provide operability with environment variables, you can follow any git-workflow best practices for moving between development, staging, and production environments. Additionally, we provide a configurable GitHub Action for automatically managing your deployments.

Loading...