When using Graphcool, you can configure different targets to which you can deploy your services.
A target is a deployed instance of a Graphcool service. It is composed of two major components:
Targets can be used to separate different environments (like
prod) for your service and are managed through the
All your targets and clusters are managed through
.graphcoolrc files. There are two versions of
.graphcoolrcthat's stored in your home directory. This is used for global Graphcool configurations, such as cluster definitions or storing your platform token.
.graphcoolrcin your service directories. These are used to specify and manage targets for the corresponding service.
.graphcoolrcis written in YAML.
.graphcoolrc lists a number of clusters that you can target with your deployments.
A cluster can be either:
A shared cluster hosted on the Graphcool Backend-as-a-Service. There are of these clusters available, one for each region:
A Docker container that's running the required environment for Graphool services. In this case, it needs to have the following properties:
host: The URL of the Docker container.
clusterSecret: Secret to authenticate against the deployed Graphcool instance.
Here's an example for what the global
.graphcoolrc might look like, when two clusters are configured:
1 2 3 4 5 6 7 8 9 10
clusters: # The `default` cluster is `shared-eu-west-1` from the Graphcool BaaS default: shared-eu-west-1 # The `local` cluster is a Docker container providing local: host: 'http://localhost:60001' clusterSecret: >- eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NjJ9.eyJpYXQiOjE1MDc3NDQyMDQsImNsaWVudElkIjoiY2o4bmJ5bjE3MDAwMDAxNzdmNHZzN3FxNCJ9.BFJX4w36ZNz-RVlExjA93qXDteEkP7fLgmw5OfFFPGY platformToken: >- eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NjJ9.eyJpYxQiOjE0OTcyNTgzMTIsImNsaWVud3lkIjoiY2l3ajBkc2V1MGY0bDAxMjJ1NDdzcXE1bSJ9.-JEH4TwIZCwJCUIq4Od-r-Xbuw6kkx3QKR5zcwHqmgI
A target effectively is a deployed instance of a Graphcool service.
Most of the CLI commands accept the
-t) option to specify the target against which the command will run, for example:
graphcool deploy --target prod
Targets are managed through local
.graphcool-files. Here is an example of what a local
.graphcoolrc for a specific service might look like:
1 2 3 4
targets: default: dev dev: shared-us-west-2/cj8n7vc0101ya01424ihgryke prod: shared-us-west-2/cj8n7um5800ox0167tzrqj5r9
--target option is not specified for a CLI command, the command will run against the
default target from
The CLI actually doesn't explicitly distinguish the local and global versions of
.graphcoolrc. When a command is invoked, the CLI will first load the global
.graphcoolrc and then load the local
.graphcoolrc for the specific service. Note that any name clashes will be overridden in favor of the local
So, it's potentially possible to specify targets in the global
.graphcoolrc or clusters in the local
.graphcoolrc. This might be helpful when configuring a CI setup for example, where you don't want to specficially access the home directory (which contains the global
.graphcoolrc) of the CI environment.
Was this page helpful?