0 1 0
Brett Smith (brett) - 12 months ago 2019-11-23 14:12:12
brett@sfconservancy.org
website-update: Stop updating the database. Move this to a separate service.
1 file changed with 3 insertions and 9 deletions:
↑ Collapse Diff ↑
...
 
@@ -6,8 +6,6 @@ set -u
6 6
 
LOCKDIR="/tmp/website-update.$(id -u)"
7 7
 
SITEDIR=~/website
8 8
 
PRODUCTION_BRANCH=master
9
 
DB_FILE=~/Database/conservancy-website.sqlite3
10
 
DB_SCRIPT=~bkuhn/django-supporters-list.sql
11 9
 

	
12 10
 
git_rev_name() {
13 11
 
    git rev-parse --abbrev-ref --symbolic-full-name "$@"
...
 
@@ -19,16 +17,11 @@ if ! mkdir "$LOCKDIR"; then
19 17
 
fi
20 18
 
trap 'rmdir "$LOCKDIR"' 0 INT TERM QUIT
21 19
 

	
22
 
exitcode=0
23
 
if [ "$DB_SCRIPT" -nt "$DB_FILE" ]; then
24
 
    sqlite3 -bail -cmd ".timeout 30000" "$DB_FILE" <"$DB_SCRIPT" || exitcode=$?
25
 
fi
26
 

	
27 20
 
# If the checkout is not on the production branch,
28 21
 
# assume maintenance is happening and stop.
29 22
 
cd "$SITEDIR"
30 23
 
if [ "$(git_rev_name HEAD)" != "$PRODUCTION_BRANCH" ]; then
31
 
    exit "$exitcode"
24
 
    exit 0
32 25
 
fi
33 26
 

	
34 27
 
# Abort if the production branch isn't tracking a remote branch.
...
 
@@ -41,9 +34,10 @@ $git_upstream
41 34
 
EOF
42 35
 
git fetch --quiet --no-tags "$git_remote" "$git_refspec"
43 36
 
if [ "$(git rev-parse "$PRODUCTION_BRANCH")" = "$(git rev-parse "$git_upstream")" ]; then
44
 
    exit "$exitcode"
37
 
    exit 0
45 38
 
fi
46 39
 

	
40
 
exitcode=0
47 41
 
git merge --quiet --ff-only "$git_remote" "$git_refspec"
48 42
 
python2 -m compileall -q -x - www || exitcode=$?
49 43
 
chgrp -R www-data www || exitcode=$?
0 comments (0 inline, 0 general)