-
Notifications
You must be signed in to change notification settings - Fork 54
/
docker-compose.yaml
236 lines (223 loc) · 7.13 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
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
networks:
openim:
driver: bridge
services:
mongo:
image: "${MONGO_IMAGE}"
container_name: mongo
command: ["/bin/bash", "-c", "/docker-entrypoint-initdb.d/mongo-init.sh; docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth"]
volumes:
- "${DATA_DIR}/components/mongodb/data/db:/data/db"
- "${DATA_DIR}/components/mongodb/data/logs:/data/logs"
- "${DATA_DIR}/components/mongodb/data/conf:/etc/mongo"
- "./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro"
environment:
- TZ=Asia/Shanghai
- wiredTigerCacheSizeGB=1
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=openIM123
- MONGO_INITDB_DATABASE=openim_v3
- MONGO_OPENIM_USERNAME=${MONGO_USERNAME}
- MONGO_OPENIM_PASSWORD=${MONGO_PASSWORD}
restart: always
networks:
- openim
redis:
image: "${REDIS_IMAGE}"
container_name: redis
volumes:
- "${DATA_DIR}/components/redis/data:/data"
- "${DATA_DIR}/components/redis/config/redis.conf:/usr/local/redis/config/redis.conf"
environment:
TZ: Asia/Shanghai
restart: always
sysctls:
net.core.somaxconn: 1024
command: [ "redis-server", "/usr/local/redis/config/redis.conf", "--requirepass", "${REDIS_PASSWORD}", "--appendonly", "yes" ]
networks:
- openim
etcd:
image: "${ETCD_IMAGE}"
container_name: etcd
ports:
- "12379:2379"
- "12380:2380"
environment:
- ETCD_NAME=s1
- ETCD_DATA_DIR=/etcd-data
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://0.0.0.0:2380
- ETCD_INITIAL_CLUSTER=s1=http://0.0.0.0:2380
- ETCD_INITIAL_CLUSTER_TOKEN=tkn
- ETCD_INITIAL_CLUSTER_STATE=new
restart: always
networks:
- openim
kafka:
image: "${KAFKA_IMAGE}"
container_name: kafka
user: root
restart: always
volumes:
- ./scripts/create-topic.sh:/opt/bitnami/kafka/create-topic.sh
- "${DATA_DIR}/components/kafka:/bitnami/kafka"
command: >
bash -c "/opt/bitnami/scripts/kafka/run.sh & /opt/bitnami/kafka/create-topic.sh; wait"
environment:
TZ: Asia/Shanghai
KAFKA_CFG_NODE_ID: 0
KAFKA_CFG_PROCESS_ROLES: controller,broker
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,EXTERNAL://kafka:9094
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
networks:
- openim
minio:
image: "${MINIO_IMAGE}"
ports:
- "${MINIO_PORT}:9000"
- "${MINIO_CONSOLE_PORT}:9090"
container_name: minio
volumes:
- "${DATA_DIR}/components/mnt/data:/data"
- "${DATA_DIR}/components/mnt/config:/root/.minio"
environment:
TZ: Asia/Shanghai
MINIO_ROOT_USER: "${MINIO_ACCESS_KEY_ID}"
MINIO_ROOT_PASSWORD: "${MINIO_SECRET_ACCESS_KEY}"
restart: always
command: minio server /data --console-address ':9090'
networks:
- openim
openim-web-front:
image: ${OPENIM_WEB_FRONT_IMAGE}
container_name: openim-web-front
restart: always
ports:
- "${OPENIM_WEB_FRONT_PORT}:80"
networks:
- openim
openim-admin-front:
image: ${OPENIM_ADMIN_FRONT_IMAGE}
container_name: openim-admin-front
restart: always
ports:
- "${OPENIM_ADMIN_FRONT_PORT}:80"
networks:
- openim
prometheus:
image: ${PROMETHEUS_IMAGE}
container_name: prometheus
hostname: prometheus
restart: always
volumes:
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml
- ./config/instance-down-rules.yml:/etc/prometheus/instance-down-rules.yml
- ${DATA_DIR}/components/prometheus/data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
ports:
- "${PROMETHEUS_PORT}:9090"
networks:
- openim
alertmanager:
image: ${ALERTMANAGER_IMAGE}
container_name: alertmanager
hostname: alertmanager
restart: always
volumes:
- ${DATA_DIR}/config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
- ${DATA_DIR}/config/email.tmpl:/etc/alertmanager/email.tmpl
ports:
- "${ALERT_MANAGER_PORT}:9093"
networks:
- openim
grafana:
image: ${GRAFANA_IMAGE}
container_name: grafana
hostname: grafana
user: root
restart: always
ports:
- "${GRAFANA_PORT}:3000"
volumes:
- "${DATA_DIR}/components/grafana:/var/lib/grafana"
environment:
- GF_SECURITY_ALLOW_EMBEDDING=true
- GF_SESSION_COOKIE_SAMESITE=none
- GF_SESSION_COOKIE_SECURE=true
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
networks:
- openim
node-exporter:
image: ${NODE_EXPORTER_IMAGE}
container_name: node-exporter
hostname: node-exporter
restart: always
ports:
- "${NODE_EXPORTER_PORT}:9100"
networks:
- openim
openim-server:
image: ${OPENIM_SERVER_IMAGE}
container_name: openim-server
init: true
ports:
- "${OPENIM_MSG_GATEWAY_PORT}:10001"
- "${OPENIM_API_PORT}:10002"
healthcheck:
test: [ "CMD", "sh", "-c", "mage check" ]
interval: 5s
timeout: 60s
retries: 10
environment:
- IMENV_MONGODB_ADDRESS=${MONGO_ADDRESS}
- IMENV_MONGODB_USERNAME=${MONGO_USERNAME}
- IMENV_MONGODB_PASSWORD=${MONGO_PASSWORD}
- IMENV_KAFKA_ADDRESS=${KAFKA_ADDRESS}
- IMENV_DISCOVERY_ETCD_ADDRESS=${ETCD_ADDRESS}
- IMENV_REDIS_ADDRESS=${REDIS_ADDRESS}
- IMENV_REDIS_PASSWORD=${REDIS_PASSWORD}
- IMENV_MINIO_INTERNALADDRESS=${MINIO_INTERNAL_ADDRESS}
- IMENV_MINIO_EXTERNALADDRESS=${MINIO_EXTERNAL_ADDRESS}
- IMENV_MINIO_ACCESSKEYID=${MINIO_ACCESS_KEY_ID}
- IMENV_MINIO_SECRETACCESSKEY=${MINIO_SECRET_ACCESS_KEY}
- IMENV_SHARE_SECRET=${OPENIM_SECRET}
- IMENV_LOG_ISSTDOUT=${LOG_IS_STDOUT}
- IMENV_LOG_REMAINLOGLEVEL=${LOG_LEVEL}
- IMENV_OPENIM_API_PROMETHEUS_GRAFANAURL=${GRAFANA_URL}
restart: always
networks:
- openim
openim-chat:
image: ${OPENIM_CHAT_IMAGE}
container_name: openim-chat
init: true
healthcheck:
test: [ "CMD", "sh", "-c", "mage check" ]
interval: 5s
timeout: 60s
retries: 10
environment:
- CHATENV_MONGODB_ADDRESS=${MONGO_ADDRESS}
- CHATENV_MONGODB_USERNAME=${MONGO_USERNAME}
- CHATENV_MONGODB_PASSWORD=${MONGO_PASSWORD}
- CHATENV_DISCOVERY_ETCD_ADDRESS=${ETCD_ADDRESS}
- CHATENV_REDIS_ADDRESS=${REDIS_ADDRESS}
- CHATENV_REDIS_PASSWORD=${REDIS_PASSWORD}
- CHATENV_SHARE_OPENIM_SECRET=${OPENIM_SECRET}
- CHATENV_SHARE_OPENIM_APIURL=${API_URL}
- CHATENV_LOG_ISSTDOUT=${LOG_IS_STDOUT}
- CHATENV_LOG_REMAINLOGLEVEL=${LOG_LEVEL}
ports:
- "${CHAT_API_PORT}:10008"
- "${ADMIN_API_PORT}:10009"
restart: always
networks:
- openim