GitHub Repos

Deploying to heroku

Deploying direct to heroku (Ruby) without a CI tool

For Wordlessly, I didn’t even bother with Travis (or Circle CI). I just deployed direct to heroku, following these instructions:

  • Install everything you need to deploy a ruby app to Heroku
  • Install heroku command line tools
  • Login to heroku: heroku login
    • if you get bad request it might mean you forgot to navigate to the project folder first.
  • Create an app: heroku apps:create your-app-name
  • Run git push heroku master (note that even if your main git branch is named main, you still use master in this command)
    • !! But if you get the error “fatal: ‘heroku’ does not appear to be a git repository”, you need to run heroku git:remote -a your-app-name first (fill in your app name).
  • Ensure that at least one instance of the app is running: heroku ps:scale web=1 --app your-app-name
  • Open the website: heroku open --app your-app-name

Database stuff

  • For Ruby, PostgreSQL, Sinatra/Rails and heroku see here

Deploying to heroku (Ruby) with Circle CI

If I decide to switch to Circle CI in the future, I think this page for the Circle CI side of things and this page for the Heroku end will probably be useful.

Deploying to heroku (Ruby) with Travis

I documented the Heroku / Travis deployment steps in the tic-tac-toe readme here.

My apps

  • See clare-tech:

Free dyno hours

  • More here
  • To see hours used by one app:
    • Run heroku login and then heroku ps -a [app-name] to see how many hours have been used by that app and how many hours you have left in your account. The first two lines of output will tell you (“Free dyno hours…”)
  • To see hours used by all apps:
    • Visit the billing page to see a list of all apps and how many hours they’ve used
  • To turn off a worker dyno (might be running constantly if there is no web app, for instance if it’s just a docker app - more here):
    • Run heroku login and then heroku ps:stop worker -a [app name]
  • To delete a worker dyno (it might keep gettin restarted for various reasons, so stopping it may not be enough):
    • Go to the settings page for the app (change url to match app - eg
    • Scroll down to bottom and click Delete App

Upgrade to heroku-22 from heroku-18 (12/10/22)

  • Find out which apps are using a particular stack (in this case heroku-18):
    • heroku login
    • (If not already done) heroku plugins:install apps-table
    • heroku apps:table --filter="STACK=heroku-18"
  • I followed instructions here and here
  • This is what I did (on mars-rover, used as test bed):
    • I tried using review apps, but it didn’t work:
      • I added review apps (info here)
        • Pipeline => Settings
        • Connect to a github repo
        • Add review apps
      • I added a new branch
      • I added an app.json to the new branch, with {"stack": "heroku-22"} in it
        • Note this only works when upgrading review apps - you can’t use this method to upgrade main app
      • I created a PR from that branch
      • I went to the Pipeline tab and clicked Create Review app under the PR
      • … but this failed when I revbiewed the deployment, and there was no feedback as to why
    • Do I just clicked the upgrade button in the settings
      • This didn’t work - build log showed deploy failed because I was using a vserion of Ruby not supported by the new heroku stack
      • So I rolled back:
        • find previous release: heroku login then heroku releases -a [app name]
        • Roll back to last release using previous stack: heroku rollback v28
        • Check it’s worked by listing all apps using the previous stack (in this case heroku-18):
          • (If not already done) heroku plugins:install apps-table
          • Then heroku apps:table --filter="STACK=heroku-18"

Misc Heroku Stuff


  • “No web processes running”. I got this error for ages with the tic-tac-toe-kata (the error was visible in the logs via heroku logs --tail --app tic-tac-toe-kata). The solution was to go to the resources section in heroku, then under Free Dynos, click the Edit button (pencil icon) over on the right, and turn the switch on to activate the web dyno.

Deploying Dockerised apps