Production settings

This commit is contained in:
Oleg Lavrovsky 2017-04-06 09:42:47 +02:00
parent 6156beed4f
commit 9f082f3ae6
4 changed files with 62 additions and 2 deletions

View File

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

57
docs/public-health.conf Normal file
View File

@ -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;
}
}

View File

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

View File

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