-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.api.yml
More file actions
134 lines (127 loc) · 3.77 KB
/
docker-compose.api.yml
File metadata and controls
134 lines (127 loc) · 3.77 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
version: '3.8'
services:
# ETCD кластер
etcd1:
image: quay.io/coreos/etcd:v3.5.9
container_name: etcd1
environment:
- ETCD_NAME=etcd1
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd1:2380
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_ADVERTISE_CLIENT_URLS=http://etcd1:2379
- ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
- ETCD_INITIAL_CLUSTER_STATE=new
- ETCD_INITIAL_CLUSTER_TOKEN=petacore-cluster
ports:
- "2379:2379"
networks:
- petacore-net
etcd2:
image: quay.io/coreos/etcd:v3.5.9
container_name: etcd2
environment:
- ETCD_NAME=etcd2
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd2:2380
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_ADVERTISE_CLIENT_URLS=http://etcd2:2379
- ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
- ETCD_INITIAL_CLUSTER_STATE=new
- ETCD_INITIAL_CLUSTER_TOKEN=petacore-cluster
ports:
- "2479:2379"
networks:
- petacore-net
etcd3:
image: quay.io/coreos/etcd:v3.5.9
container_name: etcd3
environment:
- ETCD_NAME=etcd3
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd3:2380
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_ADVERTISE_CLIENT_URLS=http://etcd3:2379
- ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
- ETCD_INITIAL_CLUSTER_STATE=new
- ETCD_INITIAL_CLUSTER_TOKEN=petacore-cluster
ports:
- "2579:2379"
networks:
- petacore-net
# PetaCore API реплики
api-node-1:
build:
context: .
dockerfile: Dockerfile
container_name: petacore-api-1
ports:
- "8081:8080"
environment:
- NODE_ID=api-node-1
- PORT=8080
- TOTAL_NODES=3
- ETCD_ENDPOINTS=etcd1:2379,etcd2:2379,etcd3:2379
command: ["./api-server", "-node=api-node-1", "-port=8080", "-nodes=3", "-etcd=etcd1:2379,etcd2:2379,etcd3:2379"]
depends_on:
- etcd1
- etcd2
- etcd3
networks:
- petacore-net
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 3
api-node-2:
build:
context: .
dockerfile: Dockerfile
container_name: petacore-api-2
ports:
- "8082:8080"
environment:
- NODE_ID=api-node-2
- PORT=8080
- TOTAL_NODES=3
- ETCD_ENDPOINTS=etcd1:2379,etcd2:2379,etcd3:2379
command: ["./api-server", "-node=api-node-2", "-port=8080", "-nodes=3", "-etcd=etcd1:2379,etcd2:2379,etcd3:2379"]
depends_on:
- etcd1
- etcd2
- etcd3
networks:
- petacore-net
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 3
api-node-3:
build:
context: .
dockerfile: Dockerfile
container_name: petacore-api-3
ports:
- "8083:8080"
environment:
- NODE_ID=api-node-3
- PORT=8080
- TOTAL_NODES=3
- ETCD_ENDPOINTS=etcd1:2379,etcd2:2379,etcd3:2379
command: ["./api-server", "-node=api-node-3", "-port=8080", "-nodes=3", "-etcd=etcd1:2379,etcd2:2379,etcd3:2379"]
depends_on:
- etcd1
- etcd2
- etcd3
networks:
- petacore-net
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 3
networks:
petacore-net:
driver: bridge