From 859230c9bff7ab3351be37eaad895a501e025c8d Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Fri, 11 Mar 2016 11:33:25 +0000 Subject: [PATCH] Bug 1165229 - Heroku: Move the deploy tasks to their own script Since we'll soon be adding reporting deploys to New Relic, which will be too verbose to include in the Procfile. Also adds additional log output (which follows the buildpack compile log formatting convention) to make it easier to find & follow the release tasks on Papertrail. Uses the `set -euo pipefail` recommendation from: http://redsymbol.net/articles/unofficial-bash-strict-mode/ --- Procfile | 3 ++- bin/pre_deploy | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 bin/pre_deploy diff --git a/Procfile b/Procfile index 9cbec13b1..b328a5127 100644 --- a/Procfile +++ b/Procfile @@ -7,4 +7,5 @@ worker_buildapi_4hr: newrelic-admin run-program celery -A treeherder worker -Q b worker_default: newrelic-admin run-program celery -A treeherder worker -Q default,cycle_data,calculate_durations,fetch_bugs,fetch_allthethings,generate_perf_alerts,detect_intermittents --maxtasksperchild=50 --concurrency=3 worker_hp: newrelic-admin run-program celery -A treeherder worker -Q classification_mirroring,publish_to_pulse --maxtasksperchild=50 --concurrency=1 worker_log_parser: newrelic-admin run-program celery -A treeherder worker -Q log_parser_fail,log_parser,log_parser_hp,log_parser_json,error_summary,store_error_summary,autoclassify --maxtasksperchild=50 --concurrency=5 -release: ./manage.py migrate --noinput && ./manage.py load_initial_data && ./manage.py init_datasources + +release: ./bin/pre_deploy diff --git a/bin/pre_deploy b/bin/pre_deploy new file mode 100755 index 000000000..326b6dc89 --- /dev/null +++ b/bin/pre_deploy @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Tasks run after the Heroku buildpack compile, but prior to the deploy. +# If failures occur, the deploy will not proceed. + +set -euo pipefail + +echo "-----> PRE-DEPLOY: Running Django migration..." +./manage.py migrate --noinput + +echo "-----> PRE-DEPLOY: Loading initial data..." +./manage.py load_initial_data + +echo "-----> PRE-DEPLOY: Initialising datasources..." +./manage.py init_datasources + +echo "-----> PRE-DEPLOY: Complete!"