Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 1.93 KB

README.md

File metadata and controls

83 lines (56 loc) · 1.93 KB

stage-ci

Realtime staging environments.

Prerequisites

Node 6.6.0 and greater (security requirement for crypto.timingSafeEqual)

Development

Install project dependencies:

$ yarn

If using GitHub, generate a GitHub token with the repo scope. Set this token in an environment variable:

$ export GITHUB_TOKEN=123

If using GitLab, generate a GitLab token with the api scope. Set this token in an environment variable:

$ export GITLAB_TOKEN=123

Generate a Zeit API token and set it in an environment variable:

$ export ZEIT_API_TOKEN=123

To enable Papertrail logging, set the respective environment variables:

$ export PAPERTRAIL_HOST=logs.papertrail.com && PAPERTRAIL_PORT=1234

To inject environment variables into the staging deployment, set the ENVS environment variable to a valid JSON object:

$ export ENVS='{"REDIS_HOST": "my.cache.aws.com", "REDIS_PORT": 1234}'

Now start the server:

$ yarn dev

Testing GitHub integration

Install ngrok or some other localhost tunnel. Fire it up and point it to port 3000:

$ ngrok http 3000

Setup a test repo on GitHub and configure a webhook using the ngrok url. Choose "Let me select individual events" and choose the "Pull request" event. You also must generate a secret; it should be long and you should not share it with anyone. Use this value here as the webhook Secret.

Now use the same value to set your secret environment variable:

$ export GITHUB_WEBHOOK_SECRET=REPLACEME_123123

Open a PR on your repo to trigger the webhook. It will also fire on commits pushed to the PR's branch.

Dev away! :)

License

stage-ci is licensed under the MIT License.