|
|
@ -63,8 +63,8 @@ schema_all.pdf: |
|
|
|
|
|
|
|
# Deploy to current *mamweb-test* directory
|
|
|
|
deploy_test: |
|
|
|
@if [ ${USER} != "www-mam" ]; then echo "Only possible by user www-mam"; exit 1; fi |
|
|
|
@if [ `pwd` != "/akce/MaM/WWW/mamweb-test" ]; then echo "Only possible in /akce/MaM/WWW/mamweb-test"; exit 1; fi |
|
|
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi |
|
|
|
@if [ `pwd` != "/akce/mam/www/mamweb-test" ]; then echo "Only possible in /akce/mam/www/mamweb-test"; exit 1; fi |
|
|
|
@echo "Installing version from origin/test ..." |
|
|
|
git pull origin test |
|
|
|
git clean -f |
|
|
@ -73,13 +73,13 @@ deploy_test: |
|
|
|
./manage.py collectstatic --noinput |
|
|
|
(chown -R :mam . || true ) |
|
|
|
(chmod -R g+rX,go-w . || true ) |
|
|
|
@echo Notifying apache about the change ... |
|
|
|
touch mamweb/wsgi.py |
|
|
|
@echo Restarting systemd unit |
|
|
|
systemctl --user restart mamweb-test.service |
|
|
|
@echo Done. |
|
|
|
|
|
|
|
# Deploy to current *mamweb-prod* directory
|
|
|
|
deploy_prod: |
|
|
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user www-mam"; exit 1; fi |
|
|
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; 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 ..." |
|
|
|
( cd .. && ./backup_prod_db.sh ) |
|
|
@ -92,22 +92,22 @@ deploy_prod: |
|
|
|
(chown -R :mam . || true ) |
|
|
|
(chmod -R g+rX,go-w . || true ) |
|
|
|
@echo Restarting systemd user unit for MaM web |
|
|
|
systemctl --user restart mamweb-prod |
|
|
|
systemctl --user restart mamweb-prod.service |
|
|
|
@echo Done. |
|
|
|
|
|
|
|
|
|
|
|
# Sync test media directory with production
|
|
|
|
sync_test_media: |
|
|
|
@if [ ${USER} != "www-mam" ]; then echo "Only possible by user www-mam"; exit 1; fi |
|
|
|
@if [ `pwd` != "/akce/MaM/WWW/mamweb-test" ]; then echo "Only possible in /akce/MaM/WWW/mamweb-test"; exit 1; fi |
|
|
|
rsync -av --delete /akce/MaM/WWW/mamweb-prod/media/ ./media |
|
|
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi |
|
|
|
@if [ `pwd` != "/akce/mam/www/mamweb-test" ]; then echo "Only possible in /akce/mam/www/mamweb-test"; exit 1; fi |
|
|
|
rsync -av --delete /akce/mam/www/mamweb-prod/media/ ./media |
|
|
|
|
|
|
|
# Sync test database with production database
|
|
|
|
sync_test_db: |
|
|
|
@if [ ${USER} != "www-mam" ]; then echo "Only possible by user www-mam"; exit 1; fi |
|
|
|
pg_dump mam-test -U mam > dump-test-`date +"%Y%m%d_%H%M"`.sql |
|
|
|
pg_dump -Fc mam-prod -U mam > dump-prod.sql |
|
|
|
pg_restore -c -d mam-test -U mam dump-prod.sql |
|
|
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi |
|
|
|
pg_dump mam_test > dump-test-`date +"%Y%m%d_%H%M"`.sql |
|
|
|
pg_dump -Fc mam_prod > dump-prod.sql |
|
|
|
pg_restore -c -d mam_test dump-prod.sql |
|
|
|
rm dump-prod.sql |
|
|
|
@echo Done. |
|
|
|
|
|
|
|