Upgrading to project config v2
What has happened?
A new revision (2024.06.06) of the DDN CLI has been released. With this release, local project directory structures created by CLI versions <= 2024.06.05 are now out-of-date and deprecated.
This page contains some information on what has changed and instructions to migrate your existing local projects. However, for users to most efficiently familiarize themselves with the new CLI and project structure, we recommend setting up a new project from scratch by following the new getting started guide.
What has changed?
- The project config version defined in
hasura.yaml
is bumped fromv1
tov2
. - Local dev workflows using Docker have been introduced.
- The DDN CLI commands. See details on the new commands here.
- The local project directory structure.
SupergraphManifest
andConnectorManifest
objects are now calledSupergraph
andConnector
respectively.- The
source
field forRelationship
objects has been deprecated in favour of thesourceType
field. ThoughRelationship
objects with thesource
field will continue to be supported.
We strongly recommend you go through our new getting started guide to learn about all the changes and experience the new workflow to develop your API with DDN.
Note that this a CLI only change and does not impact Hasura DDN projects. You can continue using existing DDN projects and builds and also be able to create new builds using the new CLI revision (with the new local project structure).
Migrate an existing local project
Below are steps to convert a local project created with the DDN CLI versions <= v2024.06.05
to the new project
structure.
Step 1: Get the new CLI
You can download the CLI binary below. Please follow the instructions for your system.
- macOS and Linux
- Windows
Simply run the installer script in your terminal:
curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v2/get.sh | bash
Download the latest cli-ddn-windows-amd64.exe
binary and run it.
curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v2/latest/cli-ddn-windows-amd64.exe -o ddn.exe
In Windows, if you get an "Unrecognized application" warning, click "Run anyway".
Additionally, you'll need to add this executable to your system's PATH:
Step 1: Locate the and rename the executable: Find the full path to the directory containing the executable. For
example, if the executable is located in C:\Program Files\cli-ddn-windows-amd64.exe
, note this path. Also, rename it
to ddn
for ease when writing commands later on.
Step 2: Open System Properties:
- Press
Win + X
and select System. - Click on Advanced system settings on the left side.
- In the System Properties window, click on the Environment Variables button.
Step 3: Edit the PATH Variable:
- In the Environment Variables window, find the System variables section.
- Scroll down and select the Path variable, then click Edit.
- In the Edit Environment Variable window, click New and paste the path to the directory containing your executable
(e.g.,
C:\Program Files\ddn.exe
).
Step 4: Save Your Changes:
- Click OK to close the Edit Environment Variable window.
- Click OK to close the Environment Variables window.
- Click OK to close the System Properties window.
Step 5: Verify the Changes: Open a new Command Prompt or PowerShell window and type the following.
ddn
Also, update your Hasura VS Code extension to v0.6.x
if not done automatically.
Note that the above will overwrite your current DDN CLI revision. You can re-install the previous revision by replacing
/ddn/cli/v2/
with /ddn/cli/v1/
in the above download command.
Step 2: Set up a fresh local project
Step 2.1: Initialize a new supergraph
Run:
ddn supergraph init --dir <new-proj-dir>
Set the default supergraph config file to the CLI context to avoid having to repeat it in future commands. This file
contains the Supergraph
object similar to the SupergraphManifest
object in your existing project directory.
cd <new-proj-dir> && ddn context set supergraph ./supergraph.local.yaml
Step 2.2: Copy over supergraph global objects
Copy the files containing the supergraph global objects CompatibilityConfig
, GraphqlConfig
and AuthConfig
from
your existing project directory to the supergraph_globals
directory in the new project directory. These should
typically be in the supergraph
directory in your existing project directory.
Note that these objects are already created in the supergraph_globals
directory of your new project directory. The
AuthConfig
object created here is to be used for local development. To avoid overwriting it, while copying your
auth-config.hml
file from the existing project directory rename it to auth-config.cloud.hml
instead. The
graphql-config.hml
and compatibility-config.hml
files on the other hand should be overwritten.
Step 3: Add your subgraphs
For each subgraph in your project:
Follow the below steps:
Step 3.1: Initialize the subgraph
Run:
ddn subgraph init <subgraph-name>