Created
February 20, 2015 06:00
-
-
Save pellaeon/7502acb2d025fa46021e to your computer and use it in GitHub Desktop.
Django uwsgi post-receive git deploy hook (FreeBSD)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export GIT_WORK_TREE=/srv/xxxx.tw | |
git checkout -f master | |
cd $GIT_WORK_TREE | |
cp /repos/settings.json ${GIT_WORK_TREE}/luroufan/settings/ | |
if [ ! -d ${GIT_WORK_TREE}/venv ]; then | |
virtualenv venv | |
fi | |
. venv/bin/activate | |
pip install -r requirements.txt | |
python manage.py migrate | |
if [ ! -d ${GIT_WORK_TREE}/static ]; then | |
mkdir ${GIT_WORK_TREE}/static | |
fi | |
python manage.py collectstatic --noinput | |
if [ -f /tmp/luroufan.pid ]; then | |
sudo -u www uwsgi --reload /tmp/luroufan.pid | |
else | |
sudo -u www uwsgi --ini ${GIT_WORK_TREE}/luroufan/uwsgi.ini | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git ALL=(www) NOPASSWD: /usr/local/bin/uwsgi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
chdir=/srv/xxxx.tw | |
virtualenv=/srv/xxxx.tw/venv | |
module=luroufan.wsgi:application | |
master=True | |
pidfile=/tmp/luroufan.pid | |
socket=/tmp/luroufan.sock | |
processes=10 | |
vacuum=True | |
daemonize=/var/log/uwsgi/luroufan.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment