forked from wunki/django-salted
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·42 lines (33 loc) · 1003 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
37
38
39
40
41
42
#!/bin/bash
# check root permissions
if [[ $UID != 0 ]]; then
echo "Please start the script as root or sudo!"
exit 1
fi
VERSION=$1
APP_ROOT=/vagrant/demo_project
if [ ! -e $APP_ROOT/$VERSION ] ; then
echo "This release doesn't exist."
exit 1
fi
# below requires current symlink to already exist.
if [ ! -e $APP_ROOT/current ]; then
echo "This is an initial release. Creating 'current' symlink."
ln -vnsf $APP_ROOT/$VERSION $APP_ROOT/current
fi
ln -vnsf $APP_ROOT/$VERSION $APP_ROOT/next
ln -vnsf $(readlink $APP_ROOT/current) $APP_ROOT/last
mv -vTf $APP_ROOT/next $APP_ROOT/current
echo "Restarting UWSGI"
echo "Restarting rover-web alpha pool."
uwsgi --pause /var/run/uwsgi.alpha.pid
sleep 5
sudo service uwsgi-worker stop POOL=alpha
sudo service uwsgi-worker start POOL=alpha
echo "Sleeping 30."
sleep 30
echo "Restarting rover-web beta pool."
uwsgi --pause /var/run/uwsgi.beta.pid
sleep 5
sudo service uwsgi-worker stop POOL=beta
sudo service uwsgi-worker start POOL=beta