Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
357 lines (335 loc) · 7.63 KB
/
Copy pathdocker-compose.yml
File metadata and controls
357 lines (335 loc) · 7.63 KB
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
version: '3.8'
networks:
lufy-network:
driver: bridge
volumes:
redis-data:
mongodb-data:
etcd-data:
services:
# 基础设施服务
redis:
image: redis:7-alpine
container_name: lufy-redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- lufy-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
mongodb:
image: mongo:6.0
container_name: lufy-mongodb
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password123
MONGO_INITDB_DATABASE: lufy_game
volumes:
- mongodb-data:/data/db
- ./scripts/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
networks:
- lufy-network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 3s
retries: 3
etcd:
image: quay.io/coreos/etcd:v3.5.9
container_name: lufy-etcd
ports:
- "2379:2379"
- "2380:2380"
environment:
ETCD_NAME: etcd0
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: etcd0=http://0.0.0.0:2380
ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster-1
ETCD_INITIAL_CLUSTER_STATE: new
volumes:
- etcd-data:/etcd-data
networks:
- lufy-network
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 10s
timeout: 3s
retries: 3
nsqlookupd:
image: nsqio/nsq:v1.2.1
container_name: lufy-nsqlookupd
command: /nsqlookupd
ports:
- "4160:4160"
- "4161:4161"
networks:
- lufy-network
nsqd:
image: nsqio/nsq:v1.2.1
container_name: lufy-nsqd
command: /nsqd --lookupd-tcp-address=nsqlookupd:4160
ports:
- "4150:4150"
- "4151:4151"
depends_on:
- nsqlookupd
networks:
- lufy-network
# Lufy游戏服务器服务
lufy-center:
build: .
container_name: lufy-center
command: ["-config=config/config.yaml", "-node=center", "-id=center1"]
ports:
- "8010:8010"
- "9010:9010"
depends_on:
- redis
- mongodb
- etcd
- nsqlookupd
- nsqd
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=center
- NODE_ID=center1
restart: unless-stopped
lufy-login:
build: .
container_name: lufy-login
command: ["-config=config/config.yaml", "-node=login", "-id=login1"]
ports:
- "8020:8020"
- "9020:9020"
depends_on:
- lufy-center
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=login
- NODE_ID=login1
restart: unless-stopped
lufy-gateway1:
build: .
container_name: lufy-gateway1
command: ["-config=config/config.yaml", "-node=gateway", "-id=gateway1"]
ports:
- "8001:8001"
- "9001:9001"
- "7001:7001"
depends_on:
- lufy-login
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=gateway
- NODE_ID=gateway1
restart: unless-stopped
lufy-gateway2:
build: .
container_name: lufy-gateway2
command: ["-config=config/config.yaml", "-node=gateway", "-id=gateway2"]
ports:
- "8002:8002"
- "9002:9002"
- "7002:7002"
depends_on:
- lufy-login
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=gateway
- NODE_ID=gateway2
restart: unless-stopped
lufy-lobby:
build: .
container_name: lufy-lobby
command: ["-config=config/config.yaml", "-node=lobby", "-id=lobby1"]
ports:
- "8030:8030"
- "9030:9030"
depends_on:
- lufy-gateway1
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=lobby
- NODE_ID=lobby1
restart: unless-stopped
lufy-friend:
build: .
container_name: lufy-friend
command: ["-config=config/config.yaml", "-node=friend", "-id=friend1"]
ports:
- "8040:8040"
- "9040:9040"
depends_on:
- lufy-gateway1
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=friend
- NODE_ID=friend1
restart: unless-stopped
lufy-chat:
build: .
container_name: lufy-chat
command: ["-config=config/config.yaml", "-node=chat", "-id=chat1"]
ports:
- "8050:8050"
- "9050:9050"
depends_on:
- lufy-gateway1
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=chat
- NODE_ID=chat1
restart: unless-stopped
lufy-mail:
build: .
container_name: lufy-mail
command: ["-config=config/config.yaml", "-node=mail", "-id=mail1"]
ports:
- "8060:8060"
- "9060:9060"
depends_on:
- lufy-gateway1
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=mail
- NODE_ID=mail1
restart: unless-stopped
lufy-game1:
build: .
container_name: lufy-game1
command: ["-config=config/config.yaml", "-node=game", "-id=game1"]
ports:
- "8100:8100"
- "9100:9100"
depends_on:
- lufy-lobby
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=game
- NODE_ID=game1
restart: unless-stopped
lufy-game2:
build: .
container_name: lufy-game2
command: ["-config=config/config.yaml", "-node=game", "-id=game2"]
ports:
- "8101:8101"
- "9101:9101"
depends_on:
- lufy-lobby
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=game
- NODE_ID=game2
restart: unless-stopped
lufy-game3:
build: .
container_name: lufy-game3
command: ["-config=config/config.yaml", "-node=game", "-id=game3"]
ports:
- "8102:8102"
- "9102:9102"
depends_on:
- lufy-lobby
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=game
- NODE_ID=game3
restart: unless-stopped
lufy-gm:
build: .
container_name: lufy-gm
command: ["-config=config/config.yaml", "-node=gm", "-id=gm1"]
ports:
- "8200:8200"
- "9200:9200"
depends_on:
- lufy-center
networks:
- lufy-network
volumes:
- ./logs:/app/logs
environment:
- NODE_TYPE=gm
- NODE_ID=gm1
restart: unless-stopped
# 监控和管理工具
nsqadmin:
image: nsqio/nsq:v1.2.1
container_name: lufy-nsqadmin
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
ports:
- "4171:4171"
depends_on:
- nsqlookupd
- nsqd
networks:
- lufy-network
redis-commander:
image: rediscommander/redis-commander:latest
container_name: lufy-redis-commander
environment:
- REDIS_HOSTS=local:redis:6379
ports:
- "8081:8081"
depends_on:
- redis
networks:
- lufy-network
mongo-express:
image: mongo-express
container_name: lufy-mongo-express
ports:
- "8082:8081"
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
- ME_CONFIG_MONGODB_ADMINPASSWORD=password123
- ME_CONFIG_MONGODB_URL=mongodb://admin:password123@mongodb:27017/
depends_on:
- mongodb
networks:
- lufy-network