Skip to content

Don't let your Heroku review apps go read-only 📢 😴

License

Notifications You must be signed in to change notification settings

alpinelab/heroku-review-apps-awakener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heroku review apps AWAKENER 📢 😴

This script keeps Heroku review apps database read-write for configured parent apps, even if they exceed 10k lines.

Setup

  1. Deploy this code to a Heroku app:

    Deploy

  2. Configure the Heroku Scheduler to start ruby heroku_review_apps_awakener.rb whenever you like (we do it everyday at 5am and 9pm UTC)

  3. Enjoy always-read-write database for your review apps 🎉

Why?

With Heroku Pipeline, every GitHub pull request can generate a review app.

A common trick is to:

  1. attach the parent app database as PARENT_DATABASE using:

    heroku addons:attach DATABASE PARENT_DATABASE
  2. make it available to review apps from app.json:

    "env": {
      "PARENT_DATABASE_URL": { "required": true }
    }
  3. copy the parent database content on each provisioned review app database (again, from app.json):

    "scripts": {
      "postdeploy": "pg_dump ${PARENT_DATABASE_URL} | psql ${DATABASE_URL}"
    }

The problem is that review apps can only use Heroku Postgres free plan, which has a maximum allowed capacity of 10,000 lines. If you exceed it, Heroku disrupts it after 24 hours by setting it read-only 😭

The solution is to force a PG backup restore (heroku pg:backups restore) to reset the 24 hours read-write grace period.

Message to herokai

Please let us define larger plans for review apps.

Shut up and take my money

License

This project is developed by Alpine Lab and released under the terms of the MIT license.

About

Don't let your Heroku review apps go read-only 📢 😴

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages