-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
60 lines (56 loc) · 1.76 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Creative Commons Attribution 4.0 International License
# https://creativecommons.org/licenses/by/4.0/
# https://docs.docker.com/compose/compose-file/
version: "3.6"
services:
flask:
build:
context: ./flask
dockerfile: Dockerfile.gunicorn
restart: unless-stopped
environment:
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
- SECRET_KEY=${SECRET_KEY}
# https://docs.gunicorn.org/en/stable/settings.html
# https://pythonspeed.com/articles/gunicorn-in-docker/
command: >
gunicorn
--reload
--bind 0.0.0.0:5000
--forwarded-allow-ips="*"
--log-level debug
wsgi:app
--capture-output
--log-file=logs/gunicorn_logs.log
--access-logformat='{"ip":"%({X-Forwarded-For}i)s", "reqtime":"%(L)s", "uname":"%(u)s", "date":"%(t)s", "statline":"%(r)s", "stat":"%(s)s", "resplen":"%(b)s", "ref":"%(f)s", "ua":"%(a)s"}'
--access-logfile=logs/gunicorn_access.log
--error-logfile=logs/gunicorn_error.log
--worker-tmp-dir /dev/shm
--workers=2
--threads=4
--worker-class=gthread
# --enable-stdio-inheritance
# using "ports" makes flask/gunicorn accessible without going through nginx
expose:
- 5000
# ports:
# - "5000:5000"
volumes:
- ${PWD}/:/scratch
- ${PWD}/flask/logs:/home/appuser/app/logs/
- ${PWD}/flask/users_sqlite.db:/home/appuser/app/users_sqlite.db
- ${PWD}/flask/data.json:/home/appuser/app/data.json
- /var/log/auth.log:/home/appuser/app/logs/auth.log
nginx:
build: ./services/nginx
restart: on-failure
ports:
- "80:80"
- "443:443"
# - 1337:80
volumes:
- ${PWD}/flask/logs/:/logs/
- ${PWD}/certs/:/certs/
depends_on:
- flask