Skip to content

Hosting on Heroku

Celso Dantas edited this page Jan 23, 2019 · 7 revisions

It is possible to host shipit on Heroku using a free tier setup.

Addons

  • Heroku Postgres :: Database
  • Papertrail
  • Redis Cloud

Environment Variables

Make sure to set the environment variables that you set during the initial setup of shipit.

  • GITHUB_OAUTH_ID
  • GITHUB_OAUTH_SECRET
  • GITHUB_API_TOKEN

Additionally you will need

  • HEROKU_API_KEY if you are planning on deploying to Heroku
  • SHIPIT_HOST set to the url where Shipit is hosted
  • REDIS_URL set to the value of REDISCLOUD_URL. There is an underlying gem that does not support using the variable REDIS_PROVIDER.

Buildpacks

heroku buildpacks:add https://github.com/heroku/heroku-buildpack-ruby
heroku buildpacks:add https://github.com/perobertson/heroku-buildpack-ssh

The second buildpack will allow you to set a private ssh key of your choosing on the dynos, and set up the known hosts.

Set the ssh keys and known hosts

heroku config:set SSH_KEY="$(cat /path/to/id_rsa)" > /dev/null
heroku config:set SSH_KEY_PUB="$(cat /path/to/id_rsa.pub)"
heroku config:set SSH_KNOWN_HOSTS="github.com heroku.com"
  • the SSH keys used here should not required password, otherwise it will be prompted during a deployment. We suggest creating a dedicated SSH KEY only to be used by Ship it.

Notes

Managing a Heroku app while Shipit is deployed to Heroku is a little bit more complicated because you must use the platform-api since the toolbelt is not installed. By setting HEROKU_API_KEY you will be able to use that in the Shipit tasks to manage the stack.

Note from fellow user: You may consider using a toolbelt buildpack to give yourself access to a toolbelt. In particular, https://github.com/ksiggins/heroku-buildpack-toolbelt can use your API Key to auth with the toolbelt, and use normal CLI commands. The executable is located at ~/vendor/heroku-buildpack/bin/heroku.

First Run

To get the application running on Heroku for the first time, remember to:

  • Complete the above configuration before pushing up your code
  • git push heroku master
  • Enable the worker dyno

Gotchas

  • If you need to change your SSH keys, make sure to re-deploy the application since keys are set during the buildpack compile step.
Clone this wiki locally