diff --git a/docker-compose.yml b/docker-compose.yml index 37dd5b6..7040ba5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,9 @@ web: - SECRET_KEY=${SECRET_KEY} - ALLOWED_HOSTS=${ALLOWED_HOSTS} - DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} + - MAILGUN_KEY=${MAILGUN_KEY} + - MAILGUN_FROM=${MAILGUN_FROM} + - MAILGUN_DOMAIN=${MAILGUN_DOMAIN} - DATABASE_URL=postgres://postgres:@postgres:5432/postgres - ELASTICSEARCH_URL=http://elasticsearch:9200 - REDIS_URL=redis://redis:6379 diff --git a/docs/public-health.conf b/docs/public-health.conf new file mode 100644 index 0000000..790dcac --- /dev/null +++ b/docs/public-health.conf @@ -0,0 +1,57 @@ +# Public Health CMS stage +upstream wagtail-stage { + server localhost:5000; +} +server { + listen 80; + server_name ph-alpha.nebula1.public-health.ch; + client_max_body_size 64M; + + gzip on; + gzip_types text/plain text/css application/x-javascript image/svg+xml; + gzip_comp_level 1; + gzip_disable msie6; + gzip_http_version 1.0; + gzip_proxied any; + gzip_vary on; + + location /static/ { + access_log off; + expires 3600; + alias /opt/public-health-ch/static/; + } + + # Set a longer expiry for CACHE/, because the filenames are unique. + location /static/CACHE/ { + access_log off; + expires 864000; + alias /opt/public-health-ch/static/CACHE/; + } + + # Only server /media/images by default, not e.g. original_images/. + location /media/images { + expires 864000; + alias /opt/public-health-ch/media/images; + } + + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_pass http://wagtail-stage; + } +} + +server { + listen 80; listen 443 ssl; + server_name conference.public-health.ch; + location /fr { + return 301 $scheme://sph17.organizers-congress.org/frontend/index.php?sub=89; + } + location / { + return 301 $scheme://sph17.organizers-congress.org; + } +} + + diff --git a/publichealth/settings/production.py b/publichealth/settings/production.py index 58e4624..94c0867 100644 --- a/publichealth/settings/production.py +++ b/publichealth/settings/production.py @@ -134,7 +134,7 @@ if REDIS_LOCATION is not None: if 'ELASTICSEARCH_URL' in env: WAGTAILSEARCH_BACKENDS = { 'default': { - 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch', + 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch5', 'URLS': [env['ELASTICSEARCH_URL']], 'INDEX': APP_NAME, 'ATOMIC_REBUILD': True, diff --git a/requirements.txt b/requirements.txt index 5f2b8b3..f8bf590 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ dj-database-url==0.4.2 puput==0.8 # Search -elasticsearch==5.2.0 +elasticsearch>=5.0.0,<6.0.0 # Caching django-redis==4.7.0