diff --git a/Makefile b/Makefile index e17e073f..a9d2e082 100644 --- a/Makefile +++ b/Makefile @@ -64,8 +64,10 @@ schema_all.pdf: venv_check # Deploy to current *mamweb-test* directory deploy_test: venv_check - @echo "Installing version from origin/pseudo_test ..." - git pull origin pseudo_test + @if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi + @if [ `readlink -f .` != "/aux/akce/mam/www/mamweb-test" ]; then echo "Only possible in directory mamweb-test"; exit 1; fi + @echo "Installing version from origin/test ..." + git pull origin test git clean -f make install ./manage.py migrate @@ -78,8 +80,12 @@ deploy_test: venv_check # Deploy to current *mamweb-prod* directory deploy_prod: venv_check - @echo "Installing version from origin/pseudo_master ..." - git pull origin pseudo_master + @if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi + @if [ `readlink -f .` != "/aux/akce/mam/www/mamweb-prod" ]; then echo "Only possible in directory mamweb-prod"; exit 1; fi + @echo "Backing up production DB ..." + ( cd -P .. && ./backup_prod_db.sh ) + @echo "Installing version from origin/master ..." + git pull origin master git clean -f make install ./manage.py migrate @@ -102,10 +108,13 @@ sync_prod_flatpages: venv_check # Sync test media directory with production sync_test_media: + @if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi + @if [ `readlink -f .` != "/aux/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} != "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 diff --git a/mamweb/settings_prod.py b/mamweb/settings_prod.py index 234e2949..1c223842 100644 --- a/mamweb/settings_prod.py +++ b/mamweb/settings_prod.py @@ -28,8 +28,7 @@ DEBUG = False TEMPLATE_DEBUG = False ALLOWED_HOSTS = ['mam.mff.cuni.cz', 'www.mam.mff.cuni.cz', 'atrey.karlin.mff.cuni.cz', - 'mamweb.bezva.org','gimli.ms.mff.cuni.cz', - 'localhost'] + 'mamweb.bezva.org','gimli.ms.mff.cuni.cz'] # Database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases @@ -38,7 +37,7 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'mam_prod', - 'USER': 'user', + 'USER': 'mam-web', 'TEST': { 'NAME': 'mam-prod-testdb', }, @@ -47,8 +46,8 @@ DATABASES = { import os -SERVER_EMAIL = 'mamweb-prod-errors@pokemon.ledoian.cz' -ADMINS = [('M&M ERRORs', 'mam-errors@pokemon.ledoian.cz')] +SERVER_EMAIL = 'mamweb-prod-errors@mam.mff.cuni.cz' +ADMINS = [('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz')] # SECURITY: only send sensitive cookies via HTTPS