diff --git a/.gitignore b/.gitignore index a42a8dbd..62c13315 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ fet2020/*/migrations/* .flake8 migrate run -*.pid \ No newline at end of file +*.pid +*~ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 160ed9e3..3d09621f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ COPY --from=builder /opt/venv /opt/venv # Make sure we use the virtualenv: ENV PATH="/opt/venv/bin:$PATH" -COPY ./fet2020 /app +COPY --chown nginx ./fet2020 /app COPY ./deployment/nginx.conf /etc/nginx/conf.d/fet2020.conf #RUN python manage.py makemigrations && python manage.py makemigrations posts members diff --git a/build_docker b/build_docker new file mode 100755 index 00000000..e83485a7 --- /dev/null +++ b/build_docker @@ -0,0 +1 @@ +docker build -t fet2020django . diff --git a/deployment/nginx.conf b/deployment/nginx.conf index 7fbb3683..182cff57 100644 --- a/deployment/nginx.conf +++ b/deployment/nginx.conf @@ -5,6 +5,21 @@ server { alias /app/static; try_files $uri $uri/ =404; } + + location /fotos { + proxy_ssl_server_name on; + proxy_ssl_verify off; + + proxy_pass http://flaskfetfotos:8080; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + # proxy_set_header REMOTE-USER $http_REMOTE_USER; +# proxy_set_header X-Forwarded-User $http_REMOTE_USER; +# proxy_set_header x-forwarded-user $http_REMOTE_USER; + proxy_set_header Connection "upgrade"; + + } + location / { include uwsgi_params; uwsgi_pass unix:///tmp/uwsgi.sock; diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..29317c9e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: "3" +services: + flaskfetfotos: + image: flask-fet-fotos + ports: + - "8080:8080" + environment: + FLASK_DEBUG: 1 + FLASK_APP: main.py + pages_root: /app/data + mysql: + image: jbergstroem/mariadb-alpine + environment: +# SKIP_INNODB: no + MYSQL_DATABASE: fet2020db + MYSQL_USER: user + MYSQL_PASSWORD: hgu + fet2020: + image: fet2020django + ports: + - "8001:8080" + volumes: + - ./fet2020:/app diff --git a/fet2020/fet2020/settings.py b/fet2020/fet2020/settings.py index e01128cd..5c9b9a63 100644 --- a/fet2020/fet2020/settings.py +++ b/fet2020/fet2020/settings.py @@ -43,7 +43,7 @@ SECRET_KEY = 'r37-i7l)vrduzz2-gira+z#u!p!di9#f+%s*5-bb($hg)55@ns' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['uat1.2020.fet.at', '127.0.0.1'] DATA_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 1024 # Application definition