reym
Deployments

CLI

Documentation of the Deployments CLI

The Deployments CLI is a powerful tool for managing schema changes. To provide the flexibility needed in complex deployment scenarios, the CLI provides a set of commands.

Have a look at the Blue / Green Deployments chapter for a more detailed description of the deployment process.

Install the CLI

The Deployments CLI is a Node.js script. Please make sure you have Node.js (>=22) installed on your system.

Configuration

The commands require a little configuration. This is done in a .env file:

DEPLOYMENTS_SERVER_ADDRESS=https://demo.demo.freym.io/deployments
DEPLOYMENTS_SCHEMA_GLOB=./**/*.graphql
DEPLOYMENTS_API_TOKEN=
VariableDescription
DEPLOYMENTS_SERVER_ADDRESSThe address of the Freym Deployments service (the http has to be removed due to some reason, this will change in the future).
DEPLOYMENTS_SCHEMA_GLOBA glob pattern to find the schema files in your project.
DEPLOYMENTS_API_TOKENThe API token to authenticate against the Deployments service.

Deployment Process

The deployment process is as follows:

Create a deployment

npx @freym/deployments create blue

This command creates a new deplyoment for the blue stage. If you want to create a deployment for the green stage, just replace the word blue with green.

The output of this command will look similar to this:

creating deployment ...
created deployment 123

The number 123 is the ID of the deployment. You can use this ID to refer to the deployment in other commands.

Get the status of a deployment

npx @freym/deployments status 123

This command will show you the status of the deployment with the ID 123. The output will look similar to this:

get deployment status ...
{ auth: 100, crud: 100, projections: 85 }

The output shows the status of the deployment. The numbers are the percentage of the deployment that is done. Evenry Freym componsnt has its own status. The status of the deployment is a number between 0 and 100 where 100 means that the deployment is ready to be activated.

Wait for the deployment to be ready

npx @freym/deployments wait 123

This command will wait until all components are ready. The output will look similar to this:

waiting for deployment to be ready...
current progress: 99%
deployment is ready

Activate the deployment

npx @freym/deployments activate 123

This command will activate the deployment with the ID 123. The output will look similar to this:

activating deployment ...
activated deployment

You can only activate a deployment if the status is 100 for all components.

Confirm the deployment

npx @freym/deployments confirm 123

This command will confirm the deployment with the ID 123. The output will look similar to this:

confirming deployment ...
confirmed deployment

Why do we need to confirm a deployment? The confirmation step is important because it allows you to roll back the deployment if something goes wrong. If you don't confirm the deployment, you can still roll back to the previous version.

Ensure evenrything is good with your deployment before confirming it. After a deployment has been confirmed, you can no longer use the rollback command to roll back to the previous version.

Rollback the deployment

npx @freym/deployments rollback 123

This command will roll back the deployment with the ID 123. The output will look similar to this:

rolling back deployment ...
rolled back deployment

You can roll back a deployment at anytime (until it is confirmed).