-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
202 lines (189 loc) · 4.6 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
x-logging: &default-logging
driver: "local"
options:
max-size: "20m"
max-file: "3"
services:
mongodb:
# 容器的名称为 mongo
container_name: mongo
# 使用的镜像名称
image: mongo:latest
# 当 docker 服务启动后,自动启动 mongodb 容器
restart: always
# 对外映射的端口
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
# 宿主机硬盘目录映射容器内的存放数据的目录
volumes:
- /data/db:/data/db
- /opt/mcim/config/mongod.conf:/etc/mongod.conf
command:
- "--bind_ip_all"
logging: *default-logging
deploy:
resources:
limits:
memory: 400M
reservations:
memory: 200M
redis:
container_name: redis
image: redis:alpine
ports:
- 6379:6379
restart: always
logging: *default-logging
volumes:
- /opt/mcim/config/redis.conf:/etc/redis/redis.conf
command: redis-server /etc/redis/redis.conf
deploy:
resources:
limits:
memory: 300M
reservations:
memory: 200M
# mcim_api:
# container_name: mcim_api
# image: mcim_api
# build:
# context: .
# dockerfile: ./docker/fastapi
# ports:
# - 8000:8000
# restart: always
# depends_on:
# - mongodb
# - redis
# volumes:
# - /opt/mcim/config:/config
# - /opt/mcim/logs:/logs
mcim_api_gunicorn:
container_name: mcim_api_gunicorn
image: mcim_api_gunicorn
build:
context: .
dockerfile: ./docker/fastapi_gunicorn
environment:
PROMETHEUS_MULTIPROC_DIR: /tmp/prometheus
TZ: Asia/Shanghai
ports:
- 8000:8000
restart: always
depends_on:
- mongodb
- redis
volumes:
- /opt/mcim/config:/config
- /opt/mcim/logs:/logs
command: >
sh -c "rm -rf /tmp/prometheus &&
mkdir -p /tmp/prometheus &&
gunicorn -k uvicorn.workers.UvicornWorker -c gunicorn_config.py app:APP"
logging: *default-logging
deploy:
resources:
limits:
memory: 800M
reservations:
memory: 200M
mcim_sync:
container_name: mcim_sync
image: mcim_sync
build:
context: .
dockerfile: ./docker/dramatiq
environment:
PROMETHEUS_MULTIPROC_DIR: /tmp/dramatiq-prometheus
dramatiq_prom_db: /tmp/dramatiq-prometheus
TZ: Asia/Shanghai
SYNC_MODE: SYNC_INFO
ports:
- 9191:9191
restart: always
depends_on:
- mongodb
- redis
volumes:
- /opt/mcim/config:/config
- /opt/mcim/logs:/logs
command: >
sh -c "rm -rf /tmp/dramatiq-prometheus/ &&
mkdir -p /tmp/dramatiq-prometheus &&
dramatiq app.sync"
logging: *default-logging
deploy:
resources:
limits:
memory: 1024M
reservations:
memory: 200M
translate:
container_name: translate
image: mcim_translate
build:
context: .
dockerfile: ./translate-mod-summary/Dockerfile
restart: always
depends_on:
- mongodb
volumes:
- /opt/mcim/translate-mod-summary/config:/translate-mod-summary/config
logging: *default-logging
deploy:
resources:
limits:
memory: 200M
# tc:
# image: "${DOCKER_IMAGE_TERMINAL:-lukaszlach/docker-tc}"
# container_name: docker-tc
# cap_add:
# - NET_ADMIN
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock
# - /var/docker-tc:/var/docker-tc
# deploy:
# mode: global
# restart_policy:
# condition: any
# environment:
# HTTP_BIND: "${HTTP_BIND:-127.0.0.1}"
# HTTP_PORT: "${HTTP_PORT:-4080}"
# network_mode: host
grafana:
image: grafana/grafana
container_name: grafana
restart: unless-stopped
depends_on:
- prometheus
ports:
- 3000:3000
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning
env_file:
- ./grafana/config.monitoring
logging: *default-logging
prometheus:
image: prom/prometheus:latest
restart: unless-stopped
container_name: prometheus
ports:
- 9090:9090
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
ports:
- 9100:9100
command:
- '--path.rootfs=/host'
restart: unless-stopped
volumes:
- /:/host:ro,rslave
- /proc:/host/proc:ro"
- /sys:/host/sys:ro"
logging: *default-logging