diff --git a/Procfile b/Procfile index 67c796ecb..efbe1a4db 100644 --- a/Procfile +++ b/Procfile @@ -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 diff --git a/docs/deployment.md b/docs/deployment.md index 20967b873..4062d4bcd 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -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) diff --git a/release-tasks.sh b/release-tasks.sh new file mode 100755 index 000000000..cace30bd7 --- /dev/null +++ b/release-tasks.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +STATEMENT_TIMEOUT=180000 bundle exec rails db:migrate && rails runner "puts 'app load success'"