From 1d1fd4e5f2cb03a084d87fb13fade52f4ae579c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Fri, 26 Jun 2020 17:42:47 +0200 Subject: [PATCH] Fix nginx and pre-compile python to speedup start --- docker/django/Dockerfile | 1 + docker/ingress/nginx.conf | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docker/django/Dockerfile b/docker/django/Dockerfile index 346f59c..bf423fb 100644 --- a/docker/django/Dockerfile +++ b/docker/django/Dockerfile @@ -35,6 +35,7 @@ COPY --chown=1000:1000 bite /srv/app/bite COPY --chown=1000:1000 requirements.txt /srv/app/bite/requirements.txt RUN pip3 install -r /srv/app/bite/requirements.txt \ + && python3 -m compileall -q /srv/app/bite \ && mkdir -p /srv/appdata/bite/static \ && chown -R 1000:1000 /srv/appdata/bite diff --git a/docker/ingress/nginx.conf b/docker/ingress/nginx.conf index ab6f103..3e9674c 100644 --- a/docker/ingress/nginx.conf +++ b/docker/ingress/nginx.conf @@ -48,13 +48,13 @@ http { '' close; } - upstream bite { + upstream django { # We point to the Docker 'service' instead of directly to the container # Docker does then a DNS round-robin internally server bite:8000; } - upstream broker { + upstream mqtt { # We point to the Docker 'service' instead of directly to the container # Docker does then a DNS round-robin internally server broker:9001; @@ -69,7 +69,7 @@ http { keepalive_timeout 60 60; location / { - proxy_pass http://bite; + proxy_pass http://django; proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; @@ -85,7 +85,7 @@ http { } location /mqtt { - proxy_pass http://broker; + proxy_pass http://mqtt; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade;