Hot potato is a simple game inpsired (or cloned to be exact) by Google internal tool. Players simply can create and pass potato to anyone for a limited time, otherwise they will drop it.
Database is configured by Graphcool Framework by default
If any version of graphcool
is installed on your machine, uninstall it using npm uninstall -g graphcool
. It's package name is now changed to graphcool-framework
.
- Install graphcool-cli with
npm install -g graphcool-framework
. - It is suggested to make an alias of
graphcool-framework
command togc
. For MacOS, can configure it in~/.bash_profile
.
From here, every command of gc
refers to graphcool-framework
.
- Set
server
as current working directory. - Ensure docker is installed on the machine. Run it.
- Run
gc local up --name <any_name_for_cluster>
. It will create three docker containers, including MySQL database. - Run
gc deploy
. - If
.graphcoolrc
file is not yet there, it will ask you to choose a cluster, and automatically create the file. Else, delete.graphcoolrc
file as it may fail the setup
- Make sure you have set up the server
- Set
server
as current working directory. - Get the server api url by running
gc info
, it will print out list of API and Endpoints. Copy the endpoint withSimple
API. - Go to
client/config
as working directory. - Duplicate file
apollo.config.template.js
and change the name intoapollo.config.js
- Set the
uri
to the endpoint just copied. - Run dev server with
npm run dev
.
Some changes in graphql type schema may break something and difficult to fix. You can create a fresh cluster by deleting the old and create the new one.
To delete the containers, run:
# stop all running containers
docker stop $(docker ps -a -q)
# remove all running containers
docker rm $(docker ps -a -q)
But, you may encounter this error when deploying with the same project name: project <project_name> already exists
. It was caused by dangling volume in docker.
Thus, to clear them, lastly run: warning: it will also clear other docker containers
# remove all dangling volumes
docker volume rm `docker volume ls -q -f dangling=true`
# or for Graphcool 1.0
gc local nuke
It is not recommended since graphcool uses its own hashing for its database implementation, thus it's not readable.
However you do so by:
- List running docker container
docker ps
. Check for the mysql container ID. - Run
docker exec -it <CONTAINER_ID> sh
. Then domysql -u root -p
. - Type
graphcool
when prompted for password. - That's it!