-
Notifications
You must be signed in to change notification settings - Fork 18
/
docker-compose-prod-local.yml
161 lines (149 loc) · 3.87 KB
/
docker-compose-prod-local.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
version: '3.6'
x-build-args: &build_args
INSTALL_PYTHON_VERSION: 3.8.2
INSTALL_NODE_VERSION: 12
x-default-volumes: &default_volumes
volumes:
- ./:/app
- node-modules:/app/node_modules
- ./dev.db:/tmp/dev.db
services:
web:
build:
context: .
dockerfile: Dockerfile_production
target: production
args:
<<: *build_args
command: gunicorn -b :5000 -w ${GUNICORN_WORKERS} -k gevent 'airscore.app:create_app()'
image: master-image
container_name: ${FLASK_CONTAINER}
ports:
- "5000:5000"
environment:
PYTHONUNBUFFERED: ${PYTHONUNBUFFERED}
REDIS_CONTAINER: ${REDIS_CONTAINER}
WEB_SERVER_CONTAINER: ${WEB_SERVER_CONTAINER}
FLASK_CONTAINER: ${FLASK_CONTAINER}
FLASK_PORT: ${FLASK_PORT}
REDIS_URL: redis://${REDIS_CONTAINER}:6379
FLASK_ENV: production
FLASK_DEBUG: 0
LOG_LEVEL: info
GUNICORN_WORKERS: ${GUNICORN_WORKERS}
RQ_QUEUE: ${RQ_QUEUE}
MAIL_SERVER: ${MAIL_SERVER}
MAIL_PORT: ${MAIL_PORT}
MAIL_USE_TLS: ${MAIL_USE_TLS}
MAIL_USE_SSL: ${MAIL_USE_SSL}
MAIL_USERNAME: ${MAIL_USERNAME}
MAIL_PASSWORD: ${MAIL_PASSWORD}
ADMINS: ${ADMINS}
MYSQLHOST: db
DATABASE: airscore
MYSQLUSER: root
MYSQLPASSWORD: airscore
DATABASE_URI: mysql+pymysql://root:airscore@db:3306/airscore
XCONTEST_USER: ${XCONTEST_USER}
XCONTEST_PASS: ${XCONTEST_PASS}
TELEGRAM_API: ${TELEGRAM_API}
TELEGRAM_CHANNEL: ${TELEGRAM_CHANNEL}
networks:
- net
restart: always
<<: *default_volumes
worker:
image: master-image
depends_on:
- redis
command: rqworker --with-scheduler --name worker --url redis://${REDIS_CONTAINER}:6379/0 ${RQ_QUEUE}
environment:
PYTHONUNBUFFERED: ${PYTHONUNBUFFERED}
FLASK_CONTAINER: ${FLASK_CONTAINER}
FLASK_PORT: ${FLASK_PORT}
REDIS_URL: redis://${REDIS_CONTAINER}:6379
RQ_QUEUE: ${RQ_QUEUE}
MAIL_SERVER: ${MAIL_SERVER}
MAIL_PORT: ${MAIL_PORT}
MAIL_USE_TLS: ${MAIL_USE_TLS}
MAIL_USERNAME: ${MAIL_USERNAME}
MAIL_PASSWORD: ${MAIL_PASSWORD}
MYSQLHOST: db
DATABASE: airscore
MYSQLUSER: root
MYSQLPASSWORD: airscore
DATABASE_URI: mysql+pymysql://root:airscore@db:3306/airscore
XCONTEST_USER: ${XCONTEST_USER}
XCONTEST_PASS: ${XCONTEST_PASS}
TELEGRAM_API: ${TELEGRAM_API}
TELEGRAM_CHANNEL: ${TELEGRAM_CHANNEL}
networks:
- net
<<: *default_volumes
# uncomment to have a another worker
# worker2:
# image: master-image
# depends_on:
# - redis
# command: rqworker --name worker2 --url redis://redis:6379/0
redis:
image: redis
container_name: ${REDIS_CONTAINER}
networks:
- net
nginx:
container_name: ${WEB_SERVER_CONTAINER}
restart: always
build: ./nginx
ports:
- "80:80"
depends_on:
- web
networks:
- net
volumes:
- type: bind
source: ./airscore/static
target: /static
db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
container_name: mysql_db_local
security_opt:
- seccomp:unconfined
environment:
MYSQL_ROOT_PASSWORD: airscore
MYSQL_DATABASE: airscore
volumes:
- ./dev.db:/var/lib/mysql:rw
- type: bind
source: ./airscore.sql
target: /docker-entrypoint-initdb.d/airscore.sql
ports:
- "3306:3306"
networks:
- net
adminer:
image: adminer
restart: always
container_name: adminer
ports:
- 8080:8080
networks:
- net
volumes:
node-modules:
static-build:
dev-db:
aircore-sql:
networks:
net:
#
# dashboard:
# image: master-image
# ports:
# - 5555:5555
# depends_on:
# - redis
# command: rq-dashboard --port 5555 --redis-url redis://redis:6379/0