GraphcoolDocs
FAQ

Commands

Last updated a day ago Edit this page

An overview and explanation of all the commands of the Graphcool CLI. Learn about different options, workflows and examples.

#Service management

#graphcool init

Creates the local file structure for a new Graphcool service:

  • graphcool.yml which contains the service definition
  • types.graphql for your data model and other type definitions
  • src (directory) with a default "Hello World" function

If you provide a directory to the command, all these files will be places inside that directory.

Usage

graphcool init DIRNAME

Examples

Create file structure for Graphcool service in current directory.
graphcool init
Create file structure for Graphcool service in directory called server.
graphcool init server

#graphcool deploy

Deploys service definition changes. Every time you're making a local change to any file in the service definition on your machine, you need to synchronize these changes with the remote service with this command.

Usage

graphcool deploy [flags]

Flags

 -a, --alias ALIAS                                Service alias
 -d, --default                                    Set specified target as default
 -D, --dry-run                                    Perform dry-run of deployment to view changes
 -f, --force                                      Accept data loss caused by schema changes
 -i, --interactive                                Force interactive mode to select the cluster
 -n, --new-service NEW-SERVICE                    Name of the new Service
 -c, --new-service-cluster NEW-SERVICE-CLUSTER    Name of the Cluster to deploy to
 -t, --target TARGET                              Target name
 -w, --watch                                      Watch for changes

Examples

Deploy local service definition changes to the default target.
graphcool deploy
Deploy local changes to a specific target called prod.
graphcool deploy --target prod

Note that in case your .graphcoolrc did not yet contain a target called prod, a new target with that name will be created.

Deploy local changes from default service file accepting potential data loss caused by schema changes.
graphcool deploy --force

#graphcool info

Prints meta-data about a specific service. The information contains:

  • All clusters to which the service is currently deployed
  • API endpoints

Usage

graphcool info

Examples

Print info of current service.
graphcool info

#graphcool playground

Open a Playground for the current service. The current service is determined by the default environment that's specified in the .graphcoolrc of the directory in which you're executing the command.

Usage

graphcool playground [flags]

Flags

-t, --target TARGET      Target name
-w, --web                Open browser-based Playground

#graphcool delete

Delete an existing target from the cluster its deployed to.

Usage

graphcool delete [flags]

Flags

 -f, --force               Force delete, without confirmation
 -t, --target TARGET       Target name

#graphcool add-template

Add new template to current Graphcool service. After invoking this command, you still need to uncomment the added lines in graphcool.yml and types.graphql and then run graphcool deploy.

Usage

graphcool add-template TEMPLATE

Examples

Pull in the officially supported email-password authentication template
graphcool add-template graphcool/templates/auth/email-password

Examples

Pull in the officially supported mailgun messaging template
graphcool add-template graphcool/templates/messaging/mailgun

#graphcool root-token

Print the root token of a specific service. If no concrete token is specified as an option, the command will only list the names of the available tokens.

Usage

graphcool root-token [flags]

Flags

-t, --token TOKEN        Name of the token
-t, --target TARGET      Target name

Examples

List which root tokens are setup for the current service.
graphcool root-token
Fetch a concrete root token.
graphcool root-token --token my-token

Assuming the service has a root token that's called my-token.

To add a new root token to your service, add the name of the new token to the rootTokens section in graphcool.yml and run graphcool deploy.

#graphcool logs

Print the logs of the functions that are setup in the current service.

Usage

graphcool logs [flags]

Flags

-f, --function FUNCTION    (required) Name of the function to get the logs from
-t, --target TARGET      Target name
--tail                   Tail function logs in realtime

#Data workflows

#graphcool export

Exports your service data by generating a URL from which you can download a .zip-file that contains all the data from your service.

Usage

graphcool export [flags]

Flags

-t, --target TARGET      Target name

Examples

Export data from default service environment.
graphcool export
Export data from a specific service environment.
graphcool export --target prod

Assuming you're executing the command in a directory that contains a .graphcoolrc looking similar to this:

1
2
3
4
targets:
  default: dev
  dev: cj7pyduqj0qyb0136kgf63887
  prod: th4pydulr0vjb049lkgf63951

#Local development (Docker)

#graphcool local pull

Download latest (or specific) framework cluster version.

Usage

graphcool local pull [flags]

Flags

 -n, --name NAME    Name of the cluster instance

#graphcool local stop

Stop local development cluster.

Usage

graphcool local pull [flags]

Flags

 -n, --name NAME    Name of the cluster instance

#graphcool local up

Start local development cluster (Docker required).

Usage

graphcool local up [flags]

Flags

 -n, --name NAME    Name of the cluster instance

#graphcool local restart

Restart local development cluster.

Usage

graphcool local restart [flags]

Flags

 -n, --name NAME    Name of the cluster instance

#graphcool local ps

List Docker containers.

Usage

graphcool local ps

#graphcool local eject

Eject from the managed docker runtime.

Usage

graphcool local eject

#Platform

#graphcool login

Sign up or login (opens your browser for authentication). The platform token that's received after successful login will be stored in ~/.graphcoolrc.

Usage

graphcool login [flags]

Flags

-t, --token TOKEN    System token

Examples

Authenticate using the browser.
graphcool login
Authenticate using an existing authentication token.
graphcool auth -t <token>

#graphcool console

Open the console for the current service. The current service is determined by the default environment that's specified in the .graphcoolrc of the directory in which you're executing the command.

Usage

graphcool console [flags]

Flags

-t, --target TARGET      Target name

Examples

Open the console for the current service.
graphcool console
Open the console for the prod environment.
graphcool console [flags]

Assuming you're executing the command in a directory that contains a .graphcoolrc looking similar to this:

1
2
3
4
default: dev
environments:
  dev: cj7pyduqj0qyb0136kgf63887
  prod: th4pydulr0vjb049lkgf63951

#Other

#graphcool help

Prints instructions and examples for the usage of a specific command.

Usage

graphcool help COMMAND

Examples

Instructions and examples for the init command.
graphcool help init
Overview of all commands.
graphcool help

Was this page helpful?