From 120d6e1a6977d2ea80a2aeeeb217b5c89afe1d19 Mon Sep 17 00:00:00 2001 From: Isaac Hodes Date: Fri, 31 Jul 2015 14:14:36 -0400 Subject: [PATCH] Add simple upgrade script for deployments. --- scripts/upgrade.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 scripts/upgrade.sh diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh new file mode 100644 index 0000000..750b702 --- /dev/null +++ b/scripts/upgrade.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -o errexit + +# If we're not in a virtual environment and haven't passed "force" to the +# script, then make sure the user wants to run the upgrade. +if [[ (! $VIRTUAL_ENV) && (! $1 || (! ($1 -neq 'force'))) ]]; then + read 'You are not running in a virtual environment, are you sure you would like to proceed? ' -n 1 -r + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo 'Aborting upgrade.' + exit 1 + fi +fi + +echo Upgrading Cycledash +echo +echo Pulling from origin/master... +git pull origin master + +echo Installing and upgrading dependencies... +source ENV.sh +pip install -r requirements.txt +npm install + +echo Building assets... +gulp prod + +echo Migrating the database... +alembic upgrade head + +echo Done upgrading Cycledash. +echo Restart workers and the Cycledash server to finish your upgrade.