website-update: Stop updating the database.

Move this to a separate service.
This commit is contained in:
Brett Smith 2019-11-23 09:12:12 -05:00
parent b81afe467b
commit d5e4646ca5

View file

@ -6,8 +6,6 @@ set -u
LOCKDIR="/tmp/website-update.$(id -u)" LOCKDIR="/tmp/website-update.$(id -u)"
SITEDIR=~/website SITEDIR=~/website
PRODUCTION_BRANCH=master PRODUCTION_BRANCH=master
DB_FILE=~/Database/conservancy-website.sqlite3
DB_SCRIPT=~bkuhn/django-supporters-list.sql
git_rev_name() { git_rev_name() {
git rev-parse --abbrev-ref --symbolic-full-name "$@" git rev-parse --abbrev-ref --symbolic-full-name "$@"
@ -19,16 +17,11 @@ if ! mkdir "$LOCKDIR"; then
fi fi
trap 'rmdir "$LOCKDIR"' 0 INT TERM QUIT trap 'rmdir "$LOCKDIR"' 0 INT TERM QUIT
exitcode=0
if [ "$DB_SCRIPT" -nt "$DB_FILE" ]; then
sqlite3 -bail -cmd ".timeout 30000" "$DB_FILE" <"$DB_SCRIPT" || exitcode=$?
fi
# If the checkout is not on the production branch, # If the checkout is not on the production branch,
# assume maintenance is happening and stop. # assume maintenance is happening and stop.
cd "$SITEDIR" cd "$SITEDIR"
if [ "$(git_rev_name HEAD)" != "$PRODUCTION_BRANCH" ]; then if [ "$(git_rev_name HEAD)" != "$PRODUCTION_BRANCH" ]; then
exit "$exitcode" exit 0
fi fi
# Abort if the production branch isn't tracking a remote branch. # Abort if the production branch isn't tracking a remote branch.
@ -41,9 +34,10 @@ $git_upstream
EOF EOF
git fetch --quiet --no-tags "$git_remote" "$git_refspec" git fetch --quiet --no-tags "$git_remote" "$git_refspec"
if [ "$(git rev-parse "$PRODUCTION_BRANCH")" = "$(git rev-parse "$git_upstream")" ]; then if [ "$(git rev-parse "$PRODUCTION_BRANCH")" = "$(git rev-parse "$git_upstream")" ]; then
exit "$exitcode" exit 0
fi fi
exitcode=0
git merge --quiet --ff-only "$git_remote" "$git_refspec" git merge --quiet --ff-only "$git_remote" "$git_refspec"
python2 -m compileall -q -x - www || exitcode=$? python2 -m compileall -q -x - www || exitcode=$?
chgrp -R www-data www || exitcode=$? chgrp -R www-data www || exitcode=$?