Browse Source

Merge branch 'master' of atrey.karlin.mff.cuni.cz:/akce/MaM/MaMweb/mamweb

remotes/origin/master
parent
commit
c43ba12be7
  1. 26
      Makefile
  2. 8
      mamweb/settings_test.py
  3. 14
      mamweb_test.ini

26
Makefile

@ -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.

8
mamweb/settings_test.py

@ -25,11 +25,11 @@ INSTALLED_APPS += (
SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['*.mam.mff.cuni.cz', 'atrey.karlin.mff.cuni.cz', 'mam.mff.cuni.cz']
ALLOWED_HOSTS = ['*.mam.mff.cuni.cz', 'atrey.karlin.mff.cuni.cz', 'mam.mff.cuni.cz', 'mam-test.kam.mff.cuni.cz', 'gimli.ms.mff.cuni.cz']
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
@ -37,8 +37,8 @@ ALLOWED_HOSTS = ['*.mam.mff.cuni.cz', 'atrey.karlin.mff.cuni.cz', 'mam.mff.cuni.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mam-test',
'USER': 'mam',
'NAME': 'mam_test',
'USER': 'mam-web',
'TEST': {
'NAME': 'mam-test-testdb',
},

14
mamweb_test.ini

@ -0,0 +1,14 @@
[uwsgi]
socket = /tmp/uwsgi-mamweb_test.sock
logto = /akce/mam/www/mamweb_test.log
chdir = /akce/mam/www/mamweb-test/
home = /akce/mam/www/mamweb-test/
module = mamweb.wsgi
plugin = python
master = True
vacuum = True
chmod-socket = 666
max-requests = 5000
die-on-term=true
Loading…
Cancel
Save