From 971d68c06a3fade7e228dad34a6ed84f02874b04 Mon Sep 17 00:00:00 2001 From: "root (lxc-fetsite-04)" Date: Sat, 10 Oct 2020 12:02:45 +0200 Subject: [PATCH] allowed hosts --- deployment/nginx.conf | 9 +++++++++ docker-compose.yml | 2 ++ fet2020/fet2020/settings.py | 5 +++-- fet2020/initdb | 4 ++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/deployment/nginx.conf b/deployment/nginx.conf index 182cff57..c6cecc78 100644 --- a/deployment/nginx.conf +++ b/deployment/nginx.conf @@ -20,6 +20,15 @@ server { } + location /etherpad { + rewrite /etherpad/(.*) $1 break; + rewrite ^/etherpad$ /etherpad/ permanent; + proxy_pass http://etherpad:8080; + proxy_redirect / /etherpad/; + proxy_set_header Host $host; + proxy_buffering off; + } + location / { include uwsgi_params; uwsgi_pass unix:///tmp/uwsgi.sock; diff --git a/docker-compose.yml b/docker-compose.yml index f7375d6f..437b1579 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,6 +43,8 @@ services: - etherpadsql fet2020: image: fet2020django + environment: + HOST_NAME: "uat1.2020.fet.at" depends_on: - mysql ports: diff --git a/fet2020/fet2020/settings.py b/fet2020/fet2020/settings.py index 869f2ab6..96501bab 100644 --- a/fet2020/fet2020/settings.py +++ b/fet2020/fet2020/settings.py @@ -19,7 +19,8 @@ env = environ.Env( MYSQL_PORT=(int, 3308), MYSQL_DATABASE=(str, "fet2020db"), MYSQL_USER=(str), - MYSQL_PASSWORD=(str) + MYSQL_PASSWORD=(str), + HOST_NAME=(str, "localhost") ) # Prints and logs are written to console @@ -56,7 +57,7 @@ else: SECRET_KEY = env('SECRET_KEY') -ALLOWED_HOSTS = ["127.0.0.1", "localhost"] +ALLOWED_HOSTS = ["127.0.0.1", env('HOST_NAME')] DATA_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 1024 diff --git a/fet2020/initdb b/fet2020/initdb index dfec82f3..2f2aa251 100755 --- a/fet2020/initdb +++ b/fet2020/initdb @@ -1,3 +1,3 @@ #!/bin/sh -python manage.py makemigrations && python manage.py makemigrations posts members \ -&& python manage.py migrate \ No newline at end of file +python manage.py makemigrations && python manage.py makemigrations posts members blackboard\ +&& python manage.py migrate