mirror of
https://github.com/daniviga/bite.git
synced 2025-04-20 22:41:18 +02:00
Add gunicorn for prod and traefik
This commit is contained in:
parent
91276430ac
commit
d830cd20e3
@ -17,4 +17,5 @@ RUN pip3 install -r /tmp/requirements.txt && rm /tmp/requirements.txt
|
|||||||
|
|
||||||
USER 1000:1000
|
USER 1000:1000
|
||||||
WORKDIR /srv/app/freedcs
|
WORKDIR /srv/app/freedcs
|
||||||
|
EXPOSE 8000/tcp
|
||||||
CMD ["python3", "manage.py", "runserver"]
|
CMD ["python3", "manage.py", "runserver"]
|
||||||
|
20
docker/docker-compose.prod.yml
Normal file
20
docker/docker-compose.prod.yml
Normal 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"
|
@ -31,8 +31,6 @@ services:
|
|||||||
- "pgdata:/var/lib/postgresql/data"
|
- "pgdata:/var/lib/postgresql/data"
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
ports:
|
|
||||||
- "127.0.0.1:5432:5432"
|
|
||||||
|
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
<<: *service_default
|
<<: *service_default
|
||||||
@ -60,6 +58,18 @@ services:
|
|||||||
# ports:
|
# ports:
|
||||||
# - "127.0.0.1:22375:2375"
|
# - "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:
|
freedcs:
|
||||||
<<: *service_default
|
<<: *service_default
|
||||||
build:
|
build:
|
||||||
@ -68,21 +78,19 @@ services:
|
|||||||
image: daniviga/freedcs
|
image: daniviga/freedcs
|
||||||
volumes:
|
volumes:
|
||||||
- "../freedcs:/srv/freedcs"
|
- "../freedcs:/srv/freedcs"
|
||||||
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
|
|
||||||
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
|
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
ports:
|
|
||||||
- "8000:8000"
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- data-migration
|
- data-migration
|
||||||
- timescale
|
- timescale
|
||||||
|
labels:
|
||||||
|
- "traefik.http.routers.freedcs.rule=PathPrefix(`/`)"
|
||||||
|
|
||||||
data-migration:
|
data-migration:
|
||||||
image: daniviga/freedcs
|
image: daniviga/freedcs
|
||||||
volumes:
|
volumes:
|
||||||
- "../freedcs:/srv/freedcs"
|
- "../freedcs:/srv/freedcs"
|
||||||
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
|
|
||||||
command: ["python3", "manage.py", "migrate", "--noinput"]
|
command: ["python3", "manage.py", "migrate", "--noinput"]
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
@ -92,7 +100,6 @@ services:
|
|||||||
image: daniviga/freedcs
|
image: daniviga/freedcs
|
||||||
volumes:
|
volumes:
|
||||||
- "../freedcs:/srv/freedcs"
|
- "../freedcs:/srv/freedcs"
|
||||||
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
|
|
||||||
command: ["python3", "manage.py", "mqtt-to-db"]
|
command: ["python3", "manage.py", "mqtt-to-db"]
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
|
@ -3,3 +3,4 @@ djangorestframework
|
|||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
paho-mqtt==1.5.0
|
paho-mqtt==1.5.0
|
||||||
asyncio-mqtt==0.5.0
|
asyncio-mqtt==0.5.0
|
||||||
|
gunicorn
|
||||||
|
Loading…
x
Reference in New Issue
Block a user