-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
237 lines (218 loc) · 5.67 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
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
version: "3"
services:
etcd1:
image: quay.io/coreos/etcd
container_name: etcd1
command: etcd --data-dir=/etcd-data --name node1 --initial-advertise-peer-urls http://etcd1:2380 --listen-peer-urls http://0.0.0.0:2380 --advertise-client-urls http://etcd1:2379 --listen-client-urls http://0.0.0.0:2379 --initial-cluster-state new --initial-cluster-token etcd-cluster --initial-cluster node1=http://etcd1:2380,node2=http://etcd2:2380,node3=http://etcd3:2380
ports:
- "23790:2379"
- "23800:2380"
volumes:
- ./data/etcd1:/etcd-data
logging:
options:
max-size: 20m
etcd2:
image: quay.io/coreos/etcd
container_name: etcd2
command: etcd --data-dir=/etcd-data --name node2 --initial-advertise-peer-urls http://etcd2:2380 --listen-peer-urls http://0.0.0.0:2380 --advertise-client-urls http://etcd2:2379 --listen-client-urls http://0.0.0.0:2379 --initial-cluster-state new --initial-cluster-token etcd-cluster --initial-cluster node1=http://etcd1:2380,node2=http://etcd2:2380,node3=http://etcd3:2380
ports:
- "23791:2379"
- "23801:2380"
volumes:
- ./data/etcd2:/etcd-data
logging:
options:
max-size: 20m
etcd3:
image: quay.io/coreos/etcd
container_name: etcd3
command: etcd --data-dir=/etcd-data --name node3 --initial-advertise-peer-urls http://etcd3:2380 --listen-peer-urls http://0.0.0.0:2380 --advertise-client-urls http://etcd3:2379 --listen-client-urls http://0.0.0.0:2379 --initial-cluster-state new --initial-cluster-token etcd-cluster --initial-cluster node1=http://etcd1:2380,node2=http://etcd2:2380,node3=http://etcd3:2380
ports:
- "23792:2379"
- "23802:2380"
volumes:
- ./data/etcd3:/etcd-data
logging:
options:
max-size: 20m
rabbitmq:
image: rabbitmq:management
container_name: rabbitmq
restart: "no"
hostname: my-rabbitmq
ports:
- "15672:15672"
- "5672:5672"
volumes:
- ./data/rabbitmq:/var/lib/rabbitmq
#环境变量
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=admin
logging:
options:
max-size: 20m
redis:
image: redis:latest
ports:
- "6379:6379"
volumes:
- ./data/redis:/redis-data
command: "redis-server"
logging:
options:
max-size: 20m
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
ports:
- "9200:9200"
- "9300:9300"
environment:
- "discovery.type=single-node"
restart: always
volumes:
- ./data/ES:/ES-data
logging:
options:
max-size: 50m
kibana:
image: docker.elastic.co/kibana/kibana:7.6.2
ports:
- "5601:5601"
restart: always
volumes:
- ./data/kibana:/kibana-data
logging:
options:
max-size: 20m
depends_on:
- elasticsearch
worker1:
build:
context: "./worker/server/"
image: worker:latest
command: "--port=8901 --httpPort=8081"
ports:
- "8901:8901"
- "8081:8081"
restart: always
depends_on:
- etcd1
- etcd2
- etcd3
volumes:
- ./data/work1:/work-data
logging:
driver: "json-file"
options:
max-size: 30m
worker2:
build:
context: "./worker/server/"
image: worker:latest
command: "--port=8902 --httpPort=8082"
ports:
- "8902:8902"
- "8082:8082"
restart: always
depends_on:
- etcd1
- etcd2
- etcd3
volumes:
- ./data/work2:/work-data
logging:
driver: "json-file"
options:
max-size: 30m
worker3:
build:
context: "./worker/server/"
# DEBUG
# dockerfile: "Dockerfile.debug"
image: worker:latest
command: "--port=8903 --httpPort=8083"
ports:
- "8903:8903"
- "8083:8083"
# DEBUG
# - "40001:40001"
restart: always
depends_on:
- etcd1
- etcd2
- etcd3
volumes:
- ./data/work2:/work-data
logging:
driver: "json-file"
options:
max-size: 30m
# DEBUG
# security_opt:
# - "seccomp:unconfined"
# cap_add:
# - SYS_PTRACE
# command: /dlv --headless --listen=:40001 --api-version=2 exec /worker -- -port=8903 -httpPort=8083
itemsave1:
build:
context: "./persist/server/"
# DEBUG
# dockerfile: "Dockerfile.debug"
image: itemsave:latest
ports:
- "2233:2233"
# DEBUG
# - "40010:40010"
restart: always
depends_on:
- etcd1
- etcd2
- etcd3
- elasticsearch
# links:
# - elasticsearch
volumes:
- ./data/itemsaver:/itemsaver-data
- ./delay-start.sh:/delay-start.sh
logging:
options:
max-size: 30m
# network_mode: host
entrypoint: sh /delay-start.sh -d 'elasticsearch:9200' -t 30 -c '/bin/go/itemsaver --port=2233'
# DEBUG
# security_opt:
# - "seccomp:unconfined"
# cap_add:
# - SYS_PTRACE
# entrypoint: bash /delay-start.sh -d 'elasticsearch:9200' -t 30 -c '/dlv --headless --listen=:40010 --api-version=2 exec /itemsaver -- -port=2233'
main:
build:
context: "./"
# DEBUG
# dockerfile: "Dockerfile.debug"
image: main:latest
restart: always
ports:
- "8800:8800"
# DEBUG
# - "40000:40000"
depends_on:
- itemsave1
- worker1
- worker2
- worker3
- rabbitmq
volumes:
- ./data/main:/main-data
logging:
options:
max-size: 20m
# DEBUG
## security_opt 和 cap_add 属性,允许调试器在 Docker 环境中运行
# security_opt:
# - "seccomp:unconfined"
# cap_add:
# - SYS_PTRACE
# command: /dlv --headless --listen=:40000 --api-version=2 exec /main