A set of rake tasks to automate interacting with Heroku.
This gem relies heavily on bash for interacting with Heroku. It's assuming you have the Heroku CLI
installed and curl
. Your session must be authenticated with heroku (i.e. running heroku logs
works).
You must have a Heroku remote set up (heroku git:remote -a my-app-name
).
Warning We use --force
when deploying to Heroku.
Add this to your gemfile
gem 'morpheus-heroku', '0.6.0'
Generate an initializer for config/morpheus-heroku.rb
with
bundle exec rails generate morpheus_heroku
MorpheusHeroku will infer the current branch from git, deploy it to Heroku master, run the migrations and then tag the release in git.
bundle exec rake deploy:production
MorpheusHeroku will fetch the latest PG backup. If there is no backup, then it will create one. It is strongly recommended to set a recurring Heroku backup to avoid loading stale data. https://devcenter.heroku.com/articles/heroku-postgres-backups#scheduling-backups
bundle exec rake db:fetch
MorpheusHeroku will fetch the latest database backup and then load it using the pg_restore
command.
bundle exec rake db:load
An email will be scrambled if it doesn't contain the substring in config.dev_email
. Say your dev email is [email protected].
An email like [email protected] will be scrambled as [email protected]. Email [email protected] will be unchanged.
If you see ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database.
even when running in development, then you need to do this:
bin/rails db:environment:set RAILS_ENV=development
$ gem bump
$ gem release
$ gem tag