-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
115 lines (107 loc) · 2.91 KB
/
docker-compose.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
version: '3.9'
services:
app-prod: &app-prod
container_name: cb-app
image: cb-app-prod
restart: unless-stopped
profiles: ["prod"]
build:
context: .
dockerfile: Dockerfile
env_file: .env
environment: &app-env
DEVELOPMENT: 0
DB_DB: ${DB_DB}
DB_HOST: db
DB_PORT: ${DB_PORT}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
depends_on:
db:
condition: service_healthy
command: >
bash -c "python manage.py -A -c ${CONFIG_FILE} db upgrade
&& gunicorn -b 0.0.0.0:5000 'coloringbook:prod_app'
--capture-output
--access-logfile '/logs/gunicorn-access.log'
--error-logfile '/logs/gunicorn-error.log'"
volumes:
- .:/coloringbook:rw
- ./logs/cb:/logs
ports:
- 3000:5000
app-dev:
<<: *app-prod
image: cb-app-dev
profiles: ["dev"]
restart: no
environment:
<<: *app-env
DEVELOPMENT: 1
command: >
bash -c "python manage.py -A -c ${CONFIG_FILE} db upgrade
&& python manage.py -c ${CONFIG_FILE} runserver --host 0.0.0.0 -dr"
db:
image: mysql:5.7
container_name: cb-db
env_file: .env
restart: unless-stopped
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: ${DB_DB}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
ports:
- "3307:3306"
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-u", "${DB_USER}", "-p${DB_PASSWORD}"]
timeout: 20s
retries: 10
volumes:
- sql-db:/var/lib/mysql
redis:
container_name: cb-redis
image: redis:6.2
restart: unless-stopped
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf
- ./redis-entrypoint.sh:/usr/local/bin/entrypoint.sh
- ./logs/redis:/logs/redis
entrypoint: ["sh", "/usr/local/bin/entrypoint.sh"]
worker-prod: &worker-prod
build: .
container_name: cb-worker
image: cb-worker-prod
profiles: ["prod"]
command: celery -A make_celery worker --uid=nobody --gid=nogroup
restart: unless-stopped
environment: &worker-env
FLASK_DEBUG: 0
APP_SETTINGS: project.server.config.DevelopmentConfig
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
CONFIG_FILE: ${CONFIG_FILE}
DB_DB: ${DB_DB}
DB_HOST: db
DB_PORT: ${DB_PORT}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
depends_on:
- db
- redis
volumes:
- .:/coloringbook:rw
worker-dev:
<<: *worker-prod
image: cb-worker-dev
profiles: ["dev"]
restart: no
command: celery -A make_celery worker --loglevel=info --uid=nobody --gid=nogroup
environment:
<<: *worker-env
FLASK_DEBUG: 1
volumes:
sql-db: