1
0
mirror of https://github.com/daniviga/bite.git synced 2025-04-20 22:41:18 +02:00

Fix nginx and pre-compile python to speedup start

This commit is contained in:
Daniele Viganò 2020-06-26 17:42:47 +02:00
parent 61fd6263f1
commit 1d1fd4e5f2
Signed by: dani
GPG Key ID: DB49AFC03C40EE02
2 changed files with 5 additions and 4 deletions

View File

@ -35,6 +35,7 @@ COPY --chown=1000:1000 bite /srv/app/bite
COPY --chown=1000:1000 requirements.txt /srv/app/bite/requirements.txt COPY --chown=1000:1000 requirements.txt /srv/app/bite/requirements.txt
RUN pip3 install -r /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 \ && mkdir -p /srv/appdata/bite/static \
&& chown -R 1000:1000 /srv/appdata/bite && chown -R 1000:1000 /srv/appdata/bite

View File

@ -48,13 +48,13 @@ http {
'' close; '' close;
} }
upstream bite { upstream django {
# We point to the Docker 'service' instead of directly to the container # We point to the Docker 'service' instead of directly to the container
# Docker does then a DNS round-robin internally # Docker does then a DNS round-robin internally
server bite:8000; server bite:8000;
} }
upstream broker { upstream mqtt {
# We point to the Docker 'service' instead of directly to the container # We point to the Docker 'service' instead of directly to the container
# Docker does then a DNS round-robin internally # Docker does then a DNS round-robin internally
server broker:9001; server broker:9001;
@ -69,7 +69,7 @@ http {
keepalive_timeout 60 60; keepalive_timeout 60 60;
location / { location / {
proxy_pass http://bite; proxy_pass http://django;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -85,7 +85,7 @@ http {
} }
location /mqtt { location /mqtt {
proxy_pass http://broker; proxy_pass http://mqtt;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;