Local Development
We will enable a local development workflow using docker under the hood.
The topic this proposal is shedding light on is how that exactly looks like in the CLI.
Commands
gc local up: Pull & Start a local Graphcool instance
gc local start: Start an already intialized local Graphcool instance
gc local pull: Pull the latest Graphcool version
gc local stop: Stop the currently running local Graphcool instance
gc local reset: Reset the local Project
.graphcoolrc
The .graphcoolrc would get a new "kind" of environment, called local:
default: dev
environments:
prod: cj7zy085306i50193k7ox16z4
dev: local
~/.graphcool
{
"token": "...",
"local_token": "...",
"local_host": "localhost:60000"
}
So additionaly to token, there will also be local_token and local_host.
These values all can be overwritten by environment variables:
export GRAPHCOOL_TOKEN=...
export GRAPHCOOL_LOCAL_TOKEN=...
export GRAPHCOOL_LOCAL_HOST=...
There can be one local environment at the same time. When multiple local environments are needed, that orchestration can be achieved with managing the environment variables.
Update:
Add gc local restart command.
Update 2:
As @kbrandwijk suggested, it makes more sense for the local docker environment information to live in the .graphcoolrc file and not the .graphcool file as .graphcool is global and the local docker env information is project related.
With this change the files look as follows:
.graphcoolrc
default: dev
environments:
prod: cj7zy085306i50193k7ox16z4
dev:
token: "..."
host: "localhost:60000"
projectId: c27zs08d30ai52683k7mx26a5 # temporary, will be removed soon
~/.graphcool
Local Development
We will enable a local development workflow using docker under the hood.
The topic this proposal is shedding light on is how that exactly looks like in the CLI.
Commands
gc local up: Pull & Start a local Graphcool instancegc local start: Start an already intialized local Graphcool instancegc local pull: Pull the latest Graphcool versiongc local stop: Stop the currently running local Graphcool instancegc local reset: Reset the local Project.graphcoolrcThe
.graphcoolrcwould get a new "kind" of environment, calledlocal:~/.graphcool{ "token": "...", "local_token": "...", "local_host": "localhost:60000" }So additionaly to
token, there will also belocal_tokenandlocal_host.These values all can be overwritten by environment variables:
There can be one local environment at the same time. When multiple local environments are needed, that orchestration can be achieved with managing the environment variables.
Update:
Add
gc local restartcommand.Update 2:
As @kbrandwijk suggested, it makes more sense for the local docker environment information to live in the
.graphcoolrcfile and not the.graphcoolfile as.graphcoolis global and the local docker env information is project related.With this change the files look as follows:
.graphcoolrc~/.graphcool{ "token": "..." }