{"id":21663923,"url":"https://github.com/tobkle/setup-graphcool-framework","last_synced_at":"2026-04-21T05:32:35.711Z","repository":{"id":119550119,"uuid":"114414206","full_name":"tobkle/setup-graphcool-framework","owner":"tobkle","description":"Setup graphcool framework in docker on aws ec2 instance","archived":false,"fork":false,"pushed_at":"2017-12-15T22:09:54.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-01T22:50:43.508Z","etag":null,"topics":["aws-ec2","aws-rds","backend","crud","docker","faas","framework","graphql","guide","server","serverless","traefik"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobkle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-15T21:54:35.000Z","updated_at":"2019-11-18T19:11:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"93c68415-9a3a-4717-a51f-e5725b3f7dff","html_url":"https://github.com/tobkle/setup-graphcool-framework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tobkle/setup-graphcool-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobkle%2Fsetup-graphcool-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobkle%2Fsetup-graphcool-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobkle%2Fsetup-graphcool-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobkle%2Fsetup-graphcool-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobkle","download_url":"https://codeload.github.com/tobkle/setup-graphcool-framework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobkle%2Fsetup-graphcool-framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32078820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-ec2","aws-rds","backend","crud","docker","faas","framework","graphql","guide","server","serverless","traefik"],"created_at":"2024-11-25T10:29:27.736Z","updated_at":"2026-04-21T05:32:35.694Z","avatar_url":"https://github.com/tobkle.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Guide to Setup a GraphQL Server Backend with graphcool/framework in Docker on an AWS EC2 instance\nThe GraphQL Server Backend https://www.graph.cool was open-sourced most recently. You can find it here: https://github.com/graphcool/framework\n\nThis is a step-by-step guide to setup a Graphcool Server on Amazon AWS Web services. Here, we deploy the graphcool full-example in Docker on our own EC2 instance. This example includes a webshop backend with signup, login, product, order and stripe payments.\n\n## Steps\n* setup AWS EC2 with docker-machine\n* setup AWS RDS as our mysql endpoint\n* setup Traefik as our reverse proxy and load balancer\n* setup Letsencrypt to secure endpoints with SSL certificates\n* setup Graphcool as docker containers\n\n## Prepare aws\n* Create an AWS account and create IAM credentials for the usage of an AWS EC2 administrator.\n* Install the aws-cli command line programs.\n* Configure aws on your pc/notebook with the provided credentials.\n\n## Prepare stripe\n* Create an account on https://www.stripe.com Dashboard\n* Switch on \"View test data\"\n* Go to API\n* Get Publishable key \"pk_test_....\"\n* Get Secret key \"sk_test_...\"\n\n## Prepare docker-machine\nAs a preparation for the docker-machine usage, we need some command files in order to...\n\n* create and start a docker-machine\n* connect to the new docker-machine\n* inspect the docker-machine (getting the public ip)\n* ssh to log into the docker-machine (prepare filesystem)\n* remove to kill the docker-machine if no longer required\n\nRun in terminal:\n```bash\nmkdir aws-box\ncd aws-box\ntouch start.sh\ntouch connect.sh\ntouch inspect.sh\ntouch ssh.sh\ntouch remove.sh\nchmod +x start.sh\ncmmod +x connect.sh\nchmod +x ssh.sh\nchmod +x inspect.sh\nchmod +x remove.sh\n```\n\nCreate file start.sh with `vi start.sh`:\n```bash\n#!/bin/bash\ndocker-machine create \\\n        --driver amazonec2 \\\n        --amazonec2-open-port 80 \\\n        --amazonec2-open-port 443 \\\n        --amazonec2-open-port 22 \\\n        --amazonec2-open-port 8080 \\\n        --amazonec2-open-port 2376 \\\n        --amazonec2-region eu-central-1 \\\n        --amazonec2-zone=b \\\n        aws-box\n```\nHere we use the docker-machine command, to create a new EC2 micro instance in the Frankfurt datacenter (eu-central-1) and availability \"zone-1b\" by using the amazonec2 driver. We open the following ports to the public for later usage:\n* http port: 80\n* https port: 443\n* ssh port: 22\n* admin port: 8080 (for Traefik load balancer)\n* docker port: 2376\n\nThe name of or EC2 instance and docker-machine name will become \"aws-box\".\n\nCreate file connect.sh with `vi connect.sh`:\n```bash\n#!/bin/bash\n#\n# We will copy the ouput of the \"start.sh\" run\n# into this file later.\n# Example:\n#\n# export DOCKER_TLS_VERIFY=\"1\"\n# export DOCKER_HOST=\"tcp://18.192.200.34:2376\"\n# export DOCKER_CERT_PATH=\"/Users/toby/.docker/machine/machines/aws-box\"\n# export DOCKER_MACHINE_NAME=\"aws-box\"\n#\n## Run this command to configure your shell:\n# eval $(docker-machine env aws-box)\n#\n# Add this to your ~/.bashrc or ~/.zshrc:\n# source ~/aws-box/connect.sh\n# If you want to have this machine as your default docker-machine\n```\nHere with set some environment variables and with eval we start docker-machine aws-box as our active docker environment.\n\nCreate file inspect.sh with `vi inspect.sh`:\n```bash\n#!/bin/bash\ndocker-machine inspect aws-box\n```\nThis is only to get information about our docker-machine instance, such as the public and private IPAddress.\n\nCreate file ssh.sh with `vi ssh.sh`:\n```bash\n#!/bin/bash\ndocker-machine ssh aws-box\n```\nAs docker-machine already provisioned a ssh certificate, we can login to our aws-box easily with this command. With that, we get into a command shell on our box. So we are able to prepare the file system.\n\nCreate file remove.sh `vi remove.sh`:\n```bash\n#!/bin/bash\ndocker-machine rm aws-box\n```\nIf we don't need our aws-box any more, we can remove it with that command.\n\n## Create docker-machine\nIn your terminal run...\n```bash\n./start.sh\n```\n\nCopy the output and add this into your `vi connect.sh`.\nIt should be something like:\n```bash\nexport DOCKER_TLS_VERIFY=\"1\"\nexport DOCKER_HOST=\"tcp://18.193.211.53:2376\"\nexport DOCKER_CERT_PATH=\"~/.docker/machine/machines/aws-box\"\nexport DOCKER_MACHINE_NAME=\"aws-box\"\n# Run this command to configure your shell:\neval $(docker-machine env aws-box)\n```\nIf there is a comment # in front of the eval line, remove it, as it has to run to make your new docker-machine as your default machine.\n\nRun it once in your terminal with...\n```bash\nsource ./connect.sh\n```\n\nAnd/or add it to your default environment by adding this line at the end of your ~/.bashrc or ~/.zshrc. Do a \n```bash\nsource ~/.bashrc\n```\nor for zsh shell a \n```bash\nsource ~/.zshrc\n```\n\nTo test if your machine was created and connected successfully, run \n```bash\ndocker-machine ls\n```\nIn the output your new aws-box should be marked * active in there.\n\nTo get your public ip address of your new EC2 machine, run in terminal \n```bash\n./inspect.sh | grep 'IPAddress'\n```\n\nYou should get something like:\n```bash\n❯ ./inspect.sh | grep 'IPAddress'\n        \"IPAddress\": \"18.199.200.53\",\n        \"PrivateIPAddress\": \"172.31.25.92\",\n```\n\n## Prepare docker-compose\nLogin to our aws-box via ssh by running our new command\n```bash\n./ssh.sh\n```\nNow we should see the command shell of our newly created EC2 instance (Ubuntu 16.04 LTS).\n\nFirst we should update the machine image by:\n```bash\nsudo apt-get update\nsudo apt-get upgrade\n```\n\nWe will need later docker-compose, which isn't installed automatically:\n```bash\nsudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose\nsudo chmod +x /usr/local/bin/docker-compose\n```\n\nAdd the following line to the end of your ~/.bashrc or ~/.zshrc\n```bash\nexport PATH=$PATH:/usr/local/bin\n```\n\nThen reload your shell environment by running:\n```bash\nsource ~/.bashrc\n```\nNow you should get the version number of docker-compose by running:\n```bash\ndocker-compose --version\n```\n\n## Prepare Reverse Proxy\nIn your aws-box-1 enter in terminal:\n```bash\nsudo su\nmkdir -p /opt/traefik\ncd /opt/traefik\ntouch docker.sh\ntouch traefik.toml\ntouch acme.json\nchmod 0600 acme.json\nchmod +x docker.sh\nsudo apt-get install apache2-utils\nhtpasswd -nb admin secure_password\n```\nThe output from the program will look for example like this:\n```bash\nadmin:$apr1$ruca84Hq$mbjdMZBAG.KWn7vfN/SNK/\n```\n\nCopy the line with your user and encrypted password into your clipboard and add it into the following file at the apporpriate position in the [web] section.\n\nAdd the following lines to /opt/traefik/traefik.toml\n```bash\ndebug = false\ncheckNewVersion = true\nlogLevel = \"ERROR\"\ndefaultEntryPoints = [\"https\",\"http\"]\n\n[entryPoints]\n  [entryPoints.http]\n  address = \":80\"\n    [entryPoints.http.redirect]\n    entryPoint = \"https\"\n  [entryPoints.https]\n  address = \":443\"\n  [entryPoints.https.tls]\n\n[retry]\n\n[web]\naddress = \":8080\"\n  [web.auth.basic]\n  users = [\"admin:$apr1$ruca84Hq$mbjdMZBAG.KWn7vfN/SNK/\"]\n\n[docker]\nendpoint = \"unix:///var/run/docker.sock\"\ndomain = \"aws-box.example.com\"\nwatch = true\nexposedbydefault = true\n\n[acme]\nemail = \"me@example.com\"\nstorage = \"acme.json\"\nentryPoint = \"https\"\nonHostRule = true\nonDemand = false\n```\nSee the documention of https://traefik.io\n\nWith the following example I figured out, how it really works:\nhttps://www.digitalocean.com/community/tutorials/how-to-use-traefik-as-a-reverse-proxy-for-docker-containers-on-ubuntu-16-04\n\nAdd the following lines to /opt/traefik/docker.sh\n```bash\n#!/bin/bash\ndocker run -d \\\n  -v /var/run/docker.sock:/var/run/docker.sock \\\n  -v $PWD/traefik.toml:/traefik.toml \\\n  -v $PWD/acme.json:/acme.json \\\n  -p 80:80 \\\n  -p 443:443 \\\n  -l traefik.frontend.rule=Host:monitor.aws-box.example.com \\\n  -l traefik.port=8080 \\\n  --network proxy \\\n  --name traefik \\\n  traefik:1.3.6-alpine --docker\n```\n## Start Reverse Proxy\nRun in your terminal sudo /opt/traefik/docker.sh \n\nCheck if your traefik docker container has started successfully by running:\n\n```bash\nsudo docker ps\nsudo docker logs traefik\n```\n\nGot to your web browser and enter URL:\n```bash\nhttps://monitor.aws-box.example.com\n```\n\nIt asks you to enter your user and password for the basic authentication. You can store in your browser cache for later revisits.\n\nYou should see the traefik monitor now.\n\n## Prepare Graphcool\nNow we start with Graphcool. Therefore go into your aws-box and add in the terminal:\n```bash\nsudo su\nmkdir -p /opt/graphcool\nmkdir -p /opt/graphcool/faas\ntouch docker-compose.yml\ndocker network create proxy\n```\n\nAdd the following lines to the /opt/graphcool/docker-compose.yml file:\n```bash\nversion: \"3.1\"\n\nservices:\n\n  localfaas:\n    image: graphcool/localfaas:0.9.0\n    restart: always\n    ports:\n      - \"0.0.0.0:60050:60050\"\n    volumes:\n      - /opt/graphcool/faas:/var/faas\n    environment:\n      FUNCTIONS_PORT: 60050\n    labels:\n      traefik.backend: \"localfaas\"\n      traefik.frontend.rule: \"Host:localfaas.aws-box.example.com\"\n      traefik.docker.network: \"proxy\"\n      traefik.port: \"60050\"\n    networks:\n      - internal\n      - proxy\n\n  graphcool:\n    image: graphcool/graphcool-dev:0.9.0\n    restart: always\n    ports:\n      - \"0.0.0.0:60000:60000\"\n    labels:\n      traefik.backend: \"graphcool\"\n      # change to your domain:\n      traefik.frontend.rule: \"Host:graphcool.aws-box.example.com\"\n      traefik.docker.network: \"proxy\"\n      traefik.port: \"60000\"\n    networks:\n      - internal\n      - proxy\n    environment:\n      PORT: \"60000\"\n      FUNCTION_ENDPOINT_INTERNAL: \"http://localfaas:60050\"\n      \n    # the important lines, add your domain here:\n      FUNCTION_ENDPOINT_EXTERNAL: \"https://localfaas.aws-box.example.com\"\n      CLIENT_API_ADDRESS: \"https://graphcool.aws-box.example.com/\"\n      API_ENDPOINT_EU_WEST_1: \"https://graphcool.aws-box.example.com/simple/v1\"\n      API_ENDPOINT_US_WEST_2: \"https://graphcool.aws-box.example.com/simple/v1\"\n      API_ENDPOINT_AP_NORTHEAST_1: \"https://graphcool.aws-box.example.com/simple/v1\"\n      SCHEMA_MANAGER_ENDPOINT: \"https://graphcool.aws-box.example.com/schema-manager\"\n      BACKEND_API_SIMPLE_V1_ADDR: \"https://graphcool.aws-box.example.com/system\"\n            \n    # replace them with your own secrets:\n      MASTER_TOKEN: \"my-master-token\"\n      SYSTEM_API_SECRET: \"system-api-secret\"\n      JWT_SECRET: \"my-jwt-secret\"\n      PRIVATE_CLIENT_API_SECRET: \"my-client-api-secret\"\n      SCHEMA_MANAGER_SECRET: \"evenmoresecretwow\"\n      \n    # replace with your mysql client host connection here\n    # for example from AWS RDS mysql database\n    # replace also with your own database user and password\n      SQL_CLIENT_HOST_CLIENT1: \"mysqldb.casdfbasdf.eu-central-1.rds.amazonaws.com\"\n      SQL_CLIENT_HOST_READONLY_CLIENT1: \"mysqldb.casdfbasdf.eu-central-1.rds.amazonaws.com\"\n      SQL_CLIENT_HOST: \"mysqldb.casdfbasdf.eu-central-1.rds.amazonaws.com\"\n      SQL_CLIENT_PORT: \"3306\"\n      SQL_CLIENT_USER: \"graphcool\"\n      SQL_CLIENT_PASSWORD: \"graphcool\"\n      SQL_CLIENT_CONNECTION_LIMIT: \"10\"\n      \n      SQL_INTERNAL_DATABASE: \"graphcool\"\n      SQL_INTERNAL_HOST: \"mysqldb.casdfbasdf.eu-central-1.rds.amazonaws.com\"\n      SQL_INTERNAL_PORT: \"3306\"\n      SQL_INTERNAL_USER: \"graphcool\"\n      SQL_INTERNAL_PASSWORD: \"graphcool\"\n      SQL_INTERNAL_CONNECTION_LIMIT: \"10\"\n      \n      SQL_LOGS_DATABASE: \"logs\"\n      SQL_LOGS_HOST: \"mysqldb.casdfbasdf.eu-central-1.rds.amazonaws.com\"\n      SQL_LOGS_PORT: \"3306\"\n      SQL_LOGS_USER: \"graphcool\"\n      SQL_LOGS_PASSWORD: \"graphcool\"\n      SQL_LOGS_CONNECTION_LIMIT: \"10\"\n      \n      SQL_CLIENT_HOST_EU_WEST_1_CLIENT1: \"mysqldb.casdfbasdf.eu-central-1.rds.amazonaws.com\"\n      SQL_CLIENT_PORT_EU_WEST_1: \"3306\"\n      SQL_CLIENT_USER_EU_WEST_1: \"graphcool\"\n      SQL_CLIENT_PASSWORD_EU_WEST_1: \"graphcool\"\n      \n      SQL_CLIENT_HOST_US_WEST_2_CLIENT1: \"mysqldb.casdfbasdf.eu-central-1.rds.amazonaws.com\"\n      SQL_CLIENT_PORT_US_WEST_2: \"3306\"\n      SQL_CLIENT_USER_US_WEST_2: \"graphcool\"\n      SQL_CLIENT_PASSWORD_US_WEST_2: \"graphcool\"\n      \n      SQL_CLIENT_HOST_AP_NORTHEAST_1_CLIENT1: \"mysqldb.casdfbasdf.eu-central-1.rds.amazonaws.com\"\n      SQL_CLIENT_PORT_AP_NORTHEAST_1: \"3306\"\n      SQL_CLIENT_USER_AP_NORTHEAST_1: \"graphcool\"\n      SQL_CLIENT_PASSWORD_AP_NORTHEAST_1: \"graphcool\"\n\n      # for compatibility reasons, will be removed in later releases:\n      AWS_REGION: \"eu-west-1\"\n      FILEUPLOAD_S3_AWS_ACCESS_KEY_ID: \"notchecked\"\n      FILEUPLOAD_S3_AWS_SECRET_ACCESS_KEY: \"notchecked\"\n      FILEUPLOAD_S3_ENDPOINT: \"http://graphcool-aws-services:4572\"\n      FILEUPLOAD_S3_BUCKET: \"files.graph.cool\"\n      FILEUPLOAD_AWS_REGION: \"local\"\n      REDIS_HOST: \"graphcool-redis-host\"\n      REDIS_PORT: \"6379\"\n      KINESIS_ENDPOINT: \"http://graphcool-aws-services:4568\"\n      KINESIS_STREAM_API_METRICS: \"graphcool-aws-services\"\n      KINESIS_STREAM_ALGOLIA_SYNC_QUERY: \"graphcool-aws-services\"\n      AWS_CBOR_DISABLE: \"true\"\n      CLOUDWATCH_ENDPOINT: \"http://graphcool-aws-services:4582\"\n      BUGSNAG_API_KEY: \"\"\n      AWS_ACCESS_KEY_ID: \"notchecked\"\n      AWS_SECRET_ACCESS_KEY: \"notchecked\"\n      SNS_ENDPOINT_SYSTEM: \"http://graphcool-aws-services:4572\"\n      SNS_FUNCTION_LOGS: \"\"\n      AUTH0_DOMAIN: \"\"\n      AUTH0_CLIENT_SECRET: \"\"\n      AUTH0_API_TOKEN: \"\"\n      DATA_EXPORT_S3_ENDPOINT: \"http://graphcool-aws-services:4572\"\n      DATA_EXPORT_S3_ENDPOINT: \"http://graphcool-aws-services:4572\"\n      DATA_EXPORT_S3_BUCKET: \"graphcool-data-export\"\n      STRIPE_API_KEY: \"\"\n      INITIAL_PRICING_PLAN: \"2017-02-free\"\n      SNS_SEAT: \"arn:aws:sns:local:123456789012:crm-loal-Infrastructure-sns-collaborator-signup\"\n      SNS_ENDPOINT: \"http://graphcool-aws-services:4575\"\n\nnetworks:\n  proxy:\n    external: true\n  internal:\n    external: false\n```\n\n## Start Graphcool\nRun in aws-box terminal:\n```bash\nsudo docker-compose up -d\nsudo docker-compose logs -f\n```\n...and wait until the log tells you, your docker containers are up and running.\n\n## Prepare Project\nExit from aws-box terminal and go to the terminal of your pc/notebook.\nDowload full-example from graphcool/framework on github.\nFind latest instruction here: https://github.com/graphcool/framework/tree/master/examples/full-example\nNow you need your stripe test secret key from above:\n```\nexport STRIPE_TEST_KEY=\"sk_test...\"\ncurl https://codeload.github.com/graphcool/framework/tar.gz/master | tar -xz --strip=2 framework-master/examples/full-example\ncd full-example\nnpm install -g graphcool\nnpm install\n```\n\nBefore we can deploy our project, we first need to prepare our local environment, that it is pointing to our new aws-box graphcool and localfaas services.\n\nWe need to have a global graphcoolrc file to add our box. Please go to your browser and go to https://www.graph.cool/ and Open Console and log into or sign-up if you haven't. After that, you should have a global ~/.graphcoolrc file with your account credentials for the central graphcool service on your pc/notebook.\n\nBackup this file for security reasons, as we are going to change it now.\n```bash\ncp ~/.graphcoolrc ~/.graphcoolrc.backup\ntouch getToken.sh\nchmod +x getToken.sh\n```\n\nBut before we change this file, we first need a token, to access our aws-box without direct authentication:\n\nAdd the following lines to your getToken.sh file. \nReplace the string example.com with your domain your graphcool service is listening on.\nReplace the string MASTER_TOKEN with your new MASTER_TOKEN out of your docker-compose.yml environment.\n```bash\n#!/bin/bash\ncurl 'https://graphcool.aws-box.example.com/system' -H 'Content-Type: application/json' -d '{\"query\":\"mutation {authenticateCustomer(input:{auth0IdToken:\\\"MASTER_TOKEN\\\"}){token, user{id}}}\"}' -sS\n```\nSave the file and run it with\n```bash\n./getToken.sh\n```\nIf everything works, it'll output your new secret token to access your graphcool service in your aws-box. Copy only the token to your clipboard, we will add it now to your global .graphcoolrc file.\n\nOr you can also execute the above mutation query in your browser url https://graphcool.example.com/system playground directly, to obtain your token.\n\nNow, open ~/.graphcoolrc in your editor. Adjust it like so, and replace the example.com with your domain and replace the string YOUR-TOKEN-FROM-YOUR-CLIPBOARD with your new token. Please don't touch your platform token. This is for the graph.cool PAAS service.\n```bash\nclusters:\n  default: shared-eu-west-1\n  local:\n    host: 'https://graphcool.aws-box.example.com'\n    faasHost: 'https://graphcool.aws-box.example.com'\n    clusterSecret: \u003e-\n     YOUR-TOKEN-FROM-YOUR-CLIPBOARD\nplatformToken: \u003e-\n  DON'T-TOUCH-THE-PLATFORM-TOKEN-HERE\n\n```\nNow you are ready to deploy to your new graphcool backend.\n\n## Deploy Project\nRun in your full-example folder:\n```bash\ngraphcool deploy\n```\nChoose \"local\" deployment, \"PROD\" and \"full-example\" as input parameters.\n\nIt should deploy to your new aws-box backend.\n\nIf you get an error, switch to debug mode by setting the environment variable:\n```bash\nexport DEBUG=\"*\"\ngraphcool deploy\n```\n\nNow you should get much more information in which step you get an error.\nYou can also go to your aws-box and\n```bash\ncd /opt/graphcool\nsudo docker-compose logs -f\n```\nto see, if your backend containers receive your calls from your frontend.\n\nHINT: Take care about the authorizations of your database user.\nIt must have authorizations for the following databases:\n* graphcool\n* log\n* cj*\n\nWith every deployment graphcool creates a project starting with cj*. During deployment it generates a new database called cj*. Your database user must have authorization on these also.\n\nIf it doesn't work, chances are high, that the error lies in one of your graphcool environment parameters in your docker-compose.yml file. Good luck!\n\n## Test Run Project\nNow run:\n```bash\ngraphcool root-token seed-script\n```\nTo get a new token for the seed-script. Copy this token into your clipboard.\nReplace __ENDPOINT__ and __ROOT_TOKEN__ with the two copied values, and run the script to create a few product items:\n```bash\nnode src/scripts/seed.js\n```\n\nIt should have created a new product (iphone) in your full-example project.\n\n## Shopping Workflow\n* test a simple query\n* signup as a new user\n* login as a known user\n* set authorization token and test token login\n* create a new order\n* add a couple of items\n* pay the order\n\nGet into your playground with:\n```bash\ngraphcool playground\n```\nIt should open a browser and start the GraphQL playground of your full-example shop project.\nFor example:\nhttps://graphcool.aws-box.example.com/simple/v1/cj*\n\n### Test a simple query\nExecute the following query:\n```graphql\n{\n  allProducts {\n    id\n    name\n    description\n    price\n  }\n}\n```\nYou should see something like:\n```graphql\n{\n  \"data\": {\n    \"allProducts\": [\n      {\n        \"id\": \"cjproductid\",\n        \"name\": \"iPhone X\",\n        \"description\": \"The new shiny iPhone\",\n        \"price\": 1200\n      }\n    ]\n  }\n}\n```\n\n### Signup as a new user\nExecute the following mutation query:\n```graphql\nmutation signup {\n  signupUser(\n    email: \"me@example.com\"\n    password: \"password\"\n  ) {\n    id\n    token\n  }\n}\n```\nYou should get your Authorization token for your next calls:\n```graphql\n{\n  \"data\": {\n    \"signupUser\": {\n      \"id\": \"cjuserid\",\n      \"token\": \"long-token-string-with-many-characters-and-numbers\"\n    }\n  }\n}\n```\n\n### Login as a known user\nExecute the following mutation query:\n```graphql\nmutation login {\n  authenticateUser(\n    email: \"me@example.com\"\n    password: \"my-secret-password\"\n  ) {\n    token\n  }\n}\n```\nYou should get your Authorization token for your next calls:\n```graphql\n{\n  \"data\": {\n    \"authenticateUser\": {\n      \"token\": \"long-token-string-with-many-characters-and-numbers\"\n    }\n  }\n}\n```\n### Set authorization token and test token login\nIn the GraphQL Playground, click at the bottom on: ```HTTP Headers``` and create a new Header entry with the key and value:\n\n```bash\nAuthorization Bearer long-token-string-with-many-characters-and-numbers\n```\nWhile \"Authorization\" is the key, and the value is \"Bearer long-token-string-with-many-characters-and-numbers\". Please take care, that there is a space between Bearer and the login token. Don't use the quotes.\n\nUse this header for all authenticated requests in future.\n\n2. Execute the following query:\n```graphql\n{\n  loggedInUser {\n    id\n  }\n}\n```\nYou should get your User id:\n```graphql\n{\n  \"data\": {\n    \"loggedInUser\": {\n      \"id\": \"cjuserid\"\n    }\n  }\n}\n```\n\n### Create a new order\nTake care, that the Authorization header is set.\nIn the GraphQL Playground at the bottom, click onto \"QUERY VARIABLES\" to open the drawer for variable values. Add the variable in this drawer in json syntax:\n```json\n{\"userId\": \"cjuserid\"}\n```\nExecute the following mutation query (with Authorization header):\n```graphql\nmutation beginCheckout($userId: ID!) {\n  createOrder(\n    description: \"Christmas Presents 2017\"\n    userId: $userId\n  ) {\n    id\n  }\n}\n```\nYou'll get:\n```graphql\n{\n  \"data\": {\n    \"createOrder\": {\n      \"id\": \"cjorderid\"\n    }\n  }\n}\n```\n\n### Add an item to the order\nAdd variables:\n```json\n{ \n  \"orderId\": \"cjorderid\",\n  \"productId\": \"cjproductid\",\n  \"amount\": 1\n}\n```\nExecute the query:\n```graphql\nmutation addOrderItem($orderId: ID!, $productId: ID!, $amount: Int!) {\n  setOrderItem(\n    orderId: $orderId\n    productId: $productId\n    amount: $amount\n  ) {\n    itemId\n    amount\n  }\n}\n```\nYou will get something like:\n```graphql\n{\n  \"data\": {\n    \"setOrderItem\": {\n      \"itemId\": \"cjitemid\",\n      \"amount\": 1\n    }\n  }\n}\n```\n\n### Pay the order\nBefore we can pay, we need a one-time-payment token from stripe. Because we will need it more often, we create a shell script therefore:\n```bash\ntouch getStripePaymentToken.sh\nchmod +x getStripePaymentToken.sh\n```\nAdd the following lines to the file getStripePaymentToken.sh. Replace the sk_test_keyasdfsdafsdaf with your own Stripe test secret API key from stripe.com. (Don't forget to switch to test data!\n```bash\n#!/bin/bash\ncurl https://api.stripe.com/v1/tokens \\\n   -u sk_test_keyasdfsdafsdaf: \\\n   -d card[number]=4242424242424242 \\\n   -d card[exp_month]=12 \\\n   -d card[exp_year]=2018 \\\n   -d card[cvc]=123\n```\nRun\n```bash\n./getStripePaymentToken.sh\n```\nYou will get as output a new payment token: \"tok_paymentToken\"\n\nAdd the following variables and use your order id from earlier and your just generated one-time payment token.\n```json\n{ \n  \"orderId\": \"cjorderid\", \n  \"stripeToken\": \"tok_paymentToken\"\n}\n```\nExecute the following mutation query:\n```graphql\nmutation pay($orderId: String!, $stripeToken: String!) {\n  pay(\n    orderId: $orderId\n    stripeToken: $stripeToken\n  ) {\n    success\n  }\n}\n```\nYou will get hopefully the following json as result:\n```\n{\n  \"data\": {\n    \"pay\": {\n      \"success\": true\n    }\n  }\n}\n```\n\nWith these backend queries and mutations, you are able to develop a frontend app and run a simple webshop.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobkle%2Fsetup-graphcool-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobkle%2Fsetup-graphcool-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobkle%2Fsetup-graphcool-framework/lists"}