Making Heroku CI (almost) as fast as running Rspec locally

Once Heroku support showed us how to specify the Postgres version for in-dyno Postgres in our app.json we re-ran our Rspec rspecs and were pleasantly surprised how fast they ran. (Specifying Postgres 9.6 seems to be required for Rspec for a Rails 4.2.11 app; using the default Postgres 10 causes errors related to the change of the increment_by field in P 10)

 Mac OS XHeroku CI "M" dynoHeroku CI "M" dyno
IN-DYNO postgres
Heroku CI "L" dynoHeroku CI "L" dyno
IN-DYNO postgres
Dyno cost/hour$0.34$0.34$0.68$0.68
Run Time5:5359:0013:27 !!!31:438:03 !!!
Heroku cost$ 0.34$ 0.08$0.36$0.09

The “trick” to specifying the Postgres version for in-dyno Postgres is to use an environment variable. If this is documented anywhere we could not find it, so perhaps this will be helpful to someone else:

In order to change the Postgres version for the in-dyno add-on you’ll need to create a new environment variable in your app.json like this:
  “environments”: {
    “test”: {
      “addons”: [“heroku-postgresql:in-dyno”],
      “env”: {
          “value”: “9.6”



Leave a Reply

Your email address will not be published. Required fields are marked *