website/bin/deploy
Ben Sturmfels 2b709f61e0
Make bin/deploy abort if there's an error with git push
For example, your push failed because there's upstream changes.
2024-03-20 14:18:59 +11:00

17 lines
591 B
Bash
Executable file

#!/bin/sh
set -e # Abort on failure
git push
ssh debian@hickory.sfconservancy.org 'bash -s' << EOF
set -x # Show output
set -e
cd /var/www/website
sudo -u www-data git pull
export DJANGO_SETTINGS_MODULE=conservancy.settings.prod
sudo -E -u www-data /var/www/venv-website/bin/python3 manage.py check
sudo -E -u www-data /var/www/venv-website/bin/python3 manage.py migrate
sudo -E -u www-data /var/www/venv-website/bin/python3 manage.py collectstatic -v0 --noinput --link
sudo systemctl reload apache2
curl --silent --head https://sfconservancy.org | grep --perl-regexp "^HTTP/.+ 200"
EOF