Updraven deploy_prod pro gimliho.

This commit is contained in:
Tomas 'Jethro' Pokorny 2018-08-20 20:22:44 +02:00
parent f6a6bdd715
commit 3879f577d0

View file

@ -79,8 +79,8 @@ deploy_test:
# Deploy to current *mamweb-prod* directory # Deploy to current *mamweb-prod* directory
deploy_prod: deploy_prod:
@if [ ${USER} != "www-mam" ]; then echo "Only possible by user www-mam"; exit 1; fi @if [ ${USER} != "mam-web" ]; then echo "Only possible by user www-mam"; exit 1; fi
@if [ `pwd` != "/akce/MaM/WWW/mamweb-prod" ]; then echo "Only possible in /akce/MaM/WWW/mamweb-prod"; exit 1; fi @if [ `pwd` != "/akce/mam/www/mamweb-prod" ]; then echo "Only possible in /akce/mam/www/mamweb-prod"; exit 1; fi
@echo "Backing up production DB ..." @echo "Backing up production DB ..."
( cd .. && ./backup_prod_db.sh ) ( cd .. && ./backup_prod_db.sh )
@echo "Installing version from origin/master ..." @echo "Installing version from origin/master ..."
@ -91,8 +91,8 @@ deploy_prod:
./manage.py collectstatic --noinput ./manage.py collectstatic --noinput
(chown -R :mam . || true ) (chown -R :mam . || true )
(chmod -R g+rX,go-w . || true ) (chmod -R g+rX,go-w . || true )
@echo Notifying apache about the change ... @echo Restarting systemd user unit for MaM web
touch mamweb/wsgi.py systemctl --user restart mamweb-prod
@echo Done. @echo Done.
@ -124,7 +124,7 @@ sync_local_media:
sync_local_db: sync_local_db:
scp www-mam@atrey.karlin.mff.cuni.cz:`ssh www-mam@atrey.karlin.mff.cuni.cz 'ls -v /akce/MaM/WWW/backups/mam-prod-*\.pgdump | tail -n 1'` \ scp www-mam@atrey.karlin.mff.cuni.cz:`ssh www-mam@atrey.karlin.mff.cuni.cz 'ls -v /akce/MaM/WWW/backups/mam-prod-*\.pgdump | tail -n 1'` \
./last.pgdump ./last.pgdump
pg_restore -c -d mam -U mam last.pgdump pg_restore -c -d mam_prod last.pgdump
# Sync database and media. See above lines # Sync database and media. See above lines
sync_local: sync_media sync_db sync_local: sync_media sync_db