-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
148 lines (137 loc) · 3.34 KB
/
docker-compose.yml
File metadata and controls
148 lines (137 loc) · 3.34 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
services:
# API负载均衡网关
api_gateway:
image: "haproxy:3.4-dev-alpine3.23"
container_name: ApiGateway
ports:
- "80:80"
- "443:443"
volumes:
- ./server/api_gateway/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
- ./server/api_gateway/haproxy/blacklist.acl:/etc/haproxy/blacklist.acl:ro
networks:
- public
- internal
depends_on:
- user_server
# 游戏负载均衡网关
game_gateway:
build: ./server/game_gateway
container_name: GameGateway
ports:
- "18550:18550/udp"
networks:
- public
- internal
volumes:
- ./config/game_gateway:/etc/quiver
command: ["./game_gateway", "--config", "/etc/quiver/config.toml"]
# 消息队列
mq:
image: "nats:2.12.4-alpine3.22"
container_name: MQ_Nats
expose:
- "4222"
- "6222"
- "8222"
networks:
- internal
# 内存数据库
imdb:
image: "ghcr.io/microsoft/garnet-alpine:1"
container_name: IMDB_Garnet
ulimits:
memlock: -1
expose:
- "6379"
volumes:
- imdb:/data
networks:
- internal
# 用户数据库
user_db:
image: "postgres:18.1-alpine3.23"
container_name: UserDB_Postgres
restart: unless-stopped
env_file:
- ./env/user_db.env
volumes:
- ./db/user/init:/docker-entrypoint-initdb.d
- user_db:/data
networks:
- internal
- public
ports:
- "7861:5432"
# 游戏数据库
game_db:
image: "postgres:18.1-alpine3.23"
container_name: GameDB_Postgres
restart: unless-stopped
env_file:
- ./env/game_db.env
volumes:
- ./db/game/init:/docker-entrypoint-initdb.d
- game_db:/data
networks:
- internal
- public
ports:
- "7862:5432"
# 用户服务器
user_server:
build: ./server/user_server
container_name: UserServer
networks:
- internal
expose:
- "80"
- "443"
volumes:
- ./config/user:/etc/quiver
- ./services/auth/dist/index.html:/etc/web/auth/index.html:ro
- ./services/auth/dist/assets:/etc/web/static/auth/assets
command: ["./user_server", "--config", "/etc/quiver/config.toml"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/health"]
interval: 30s
timeout: 10s
retries: 5
game_server_1:
build: ./server/game_server
container_name: GameServer_1
networks:
- internal
expose:
- "18650/udp"
volumes:
- ./config/game:/etc/quiver:ro
command: ["./game_server", "--config", "/etc/quiver/config.toml"]
game_server_2:
build: ./server/game_server
container_name: GameServer_2
networks:
- internal
expose:
- "18650/udp"
volumes:
- ./config/game:/etc/quiver:ro
command: ["./game_server", "--config", "/etc/quiver/config.toml"]
networks:
# 公共层
public:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/24
# 内部层
internal:
driver: bridge
internal: true
ipam:
config:
- subnet: 172.21.0.0/24
volumes:
imdb:
user_db:
game_db: