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

Add gunicorn for prod and traefik

This commit is contained in:
Daniele Viganò 2020-06-15 22:46:32 +02:00
parent 91276430ac
commit d830cd20e3
Signed by: dani
GPG Key ID: DB49AFC03C40EE02
4 changed files with 36 additions and 7 deletions

View File

@ -17,4 +17,5 @@ RUN pip3 install -r /tmp/requirements.txt && rm /tmp/requirements.txt
USER 1000:1000
WORKDIR /srv/app/freedcs
EXPOSE 8000/tcp
CMD ["python3", "manage.py", "runserver"]

View File

@ -0,0 +1,20 @@
version: "3.7"
services:
ingress:
command: --providers.docker
ports:
- "80:80"
freedcs:
volumes:
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
command: ["gunicorn", "-b", "0.0.0.0:8000", "freedcs.wsgi:application"]
data-migration:
volumes:
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
mqtt-to-db:
volumes:
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"

View File

@ -31,8 +31,6 @@ services:
- "pgdata:/var/lib/postgresql/data"
networks:
- net
ports:
- "127.0.0.1:5432:5432"
rabbitmq:
<<: *service_default
@ -60,6 +58,18 @@ services:
# ports:
# - "127.0.0.1:22375:2375"
ingress:
image: traefik:v2.2
command: --api.insecure=true --providers.docker
ports:
- "8000:80"
- "8080:8080"
networks:
- net
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
freedcs:
<<: *service_default
build:
@ -68,21 +78,19 @@ services:
image: daniviga/freedcs
volumes:
- "../freedcs:/srv/freedcs"
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
networks:
- net
ports:
- "8000:8000"
depends_on:
- data-migration
- timescale
labels:
- "traefik.http.routers.freedcs.rule=PathPrefix(`/`)"
data-migration:
image: daniviga/freedcs
volumes:
- "../freedcs:/srv/freedcs"
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
command: ["python3", "manage.py", "migrate", "--noinput"]
networks:
- net
@ -92,7 +100,6 @@ services:
image: daniviga/freedcs
volumes:
- "../freedcs:/srv/freedcs"
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
command: ["python3", "manage.py", "mqtt-to-db"]
networks:
- net

View File

@ -3,3 +3,4 @@ djangorestframework
psycopg2-binary
paho-mqtt==1.5.0
asyncio-mqtt==0.5.0
gunicorn