-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·36 lines (27 loc) · 976 Bytes
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# wrapper script to pull the latest site content and redeploy
cd $(dirname $0)
# see where in the history we are now
PREV=$(git rev-parse --short HEAD)
git pull --ff-only || exit 1
if git diff --name-only $PREV | grep -qE '^(templates/|app\.py|users\.cfg)' ; then
echo "Configuration or template change detected"
disposition=reload-or-restart
fi
if git diff --name-only $PREV | grep -q poetry.lock ; then
echo "Pipfile.lock changed"
poetry install || exit 1
disposition=restart
fi
if [ "$1" != "nokill" ] && [ ! -z "$disposition" ] ; then
systemctl --user $disposition plaidweb.site.service
fi
echo "Updating the content index..."
poetry run flask publ reindex
count=0
while [ $count -lt 5 ] && [ ! -S $HOME/.vhosts/plaidweb.site ] ; do
count=$(($count + 1))
echo "Waiting for service to restart... ($count)"
sleep $count
done
#poetry run pushl -rvvc $HOME/var/pushl http://plaidweb.site/feed https://plaidweb.site/feed