Skip to content

Instantly share code, notes, and snippets.

@zunda
Last active June 7, 2017 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zunda/4a3b60894b5b83fb13f5f80813880a00 to your computer and use it in GitHub Desktop.
Save zunda/4a3b60894b5b83fb13f5f80813880a00 to your computer and use it in GitHub Desktop.
Deploying mastodon at 75c6513c

rake mastodon:maintenance:prepare_for_foreign_keys needs to run.

Merge

$ git checkout master
$ git fetch upstream
$ git rev-parse upstream/master
75c6513c678148e9a6adfcda57cfd5c8a16c804a
$ git rebase upstream/master
$ git checkout zunda-ninja-master-on-heroku
$ git merge master
$ git push	# auto deployes to zundan-mastodon-experiment

Test for db:migrate

I could not confirm:

$ export HEROKU_APP=zundan-mastodon-experiment
$ heroku run bash
~ $ rake mastodon:maintenance:prepare_for_foreign_keys	# no output
~ $ rake db:migrate	# no output

Backup the main database

I'll have to destroy this afterwards to aovid additional $9/month cost. Well, actually I had an error on the first try so the backup actually holds data after migration :P

$ export HEROKU_APP=zundan-mastodon
$ heroku addons:create heroku-postgresql:hobby-basic --as PG_BACKUP_170607
$ heroku pg:copy DATABASE_URL PG_BACKUP_170607

Deploy the mastodon rake task to the straming app

Promoted on dashboard from zundan-mastodon-experiment to zundan-mastodon-streaming where release command (db:migration) doesn't run.

$ export HEROKU_APP=zundan-mastodon-streaming
$ heroku run rake mastodon:maintenance:prepare_for_foreign_keys

Deploy to the main app and migrate database

$ export HEROKU_APP=zundan-mastodon
$ heroku pipelines:promote -a zundan-mastodon-experiment --to zundan-mastodon
  :
Migrating to AddForeignKeysForAccounts (20170604144747)
  :
== 20170604144747 AddForeignKeysForAccounts: migrated (0.4700s) ===============
  :
Migrating to ChangeTagSearchIndexToBtree (20170606113804)
  :
== 20170606113804 ChangeTagSearchIndexToBtree: migrated (0.0548s) =============

COOL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment