Update Heroku Release to Migrate and Load App (#5404) [deploy]

This commit is contained in:
Molly Struve 2020-01-08 13:43:00 -05:00 committed by GitHub
parent 64ca1e7638
commit 9dc1f51a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View file

@ -1,4 +1,4 @@
release: STATEMENT_TIMEOUT=180000 bundle exec rails db:migrate
release: ./release-tasks.sh
web: bin/start-pgbouncer bundle exec puma -C config/puma.rb
worker: bundle exec rails jobs:work
sidekiq_worker: bundle exec sidekiq -t 25

View file

@ -37,10 +37,13 @@ Upon deploy, the app installs dependencies, bundles assets, and gets the app
ready for launch. However, before it launches and releases the app Heroku runs a
release script on a one-off dyno. If that release script/step succeeds the new
app is released on all of the dynos. If that release script/step fails then the
deploy is halted and we are notified. During this release step, we have chosen
to run migrations. This ensures that a migration finishes successfully before
the code that uses it goes live. We deploy asynchronously, so the website is
running the new code a few minutes after deploy. A new instance of Heroku Rails
console will immediately run a new code.
deploy is halted and we are notified. During this release step, we first run any
outstanding migrations. This ensures that a migration finishes successfully
before the code that uses it goes live. After running migrations, we use the
rails runner to output a simple string. Executing a Rails runner command allows
us to ensure that we can boot up the entire app successfully before it is
deployed. We deploy asynchronously, so the website is running the new code a few
minutes after deploy. A new instance of Heroku Rails console will immediately
run a new code.
![](https://devcenter0.assets.heroku.com/article-images/1494371187-release-phase-diagram-3.png)

3
release-tasks.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
STATEMENT_TIMEOUT=180000 bundle exec rails db:migrate && rails runner "puts 'app load success'"