-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdocker-compose.yml
202 lines (193 loc) · 7.17 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
services:
minio:
image: docker.io/bitnami/minio:2022
container_name: minio
networks:
- minionetwork
volumes:
- 'minio_data:/data'
environment:
MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: minio
MINIO_ROOT_USER: nun-db
MINIO_ROOT_PASSWORD: nun-db-something-more
MINIO_DEFAULT_BUCKETS: nun-db
ports:
- '9000:9000'
- '9001:9001'
toxiproxy:
image: "shopify/toxiproxy"
ports:
- "3017:3017"
- "3018:3018"
- "3019:3019"
# We created proxy configuration from another ephermal container
toxiproxy-config:
image: "shopify/toxiproxy"
entrypoint: >
sh -c "
sleep 1
/go/bin/toxiproxy-cli -h toxiproxy:8474 create primary --listen 0.0.0.0:3017 --upstream nun-db-primary:3017
/go/bin/toxiproxy-cli -h toxiproxy:8474 create secondary-1 --listen 0.0.0.0:3018 --upstream nun-db-secondary-1:3018
/go/bin/toxiproxy-cli -h toxiproxy:8474 create secondary-2 --listen 0.0.0.0:3019 --upstream nun-db-secondary-2:3019
/go/bin/toxiproxy-cli -h toxiproxy:8474 toxic add -t latency -a latency=2000 primary
/go/bin/toxiproxy-cli -h toxiproxy:8474 toxic add --upstream --type=latency --toxicName=latency_upstream --a latency=2000 --toxicity=1 primary
/go/bin/toxiproxy-cli -h toxiproxy:8474 toxic add -t latency -a latency=500 secondary-1
/go/bin/toxiproxy-cli -h toxiproxy:8474 toxic add --upstream --type=latency --toxicName=latency_upstream --a latency=2000 --toxicity=1 secondary-1
/go/bin/toxiproxy-cli -h toxiproxy:8474 toxic add -t latency -a latency=500 secondary-2
/go/bin/toxiproxy-cli -h toxiproxy:8474 toxic add --upstream --type=latency --toxicName=latency_upstream --a latency=2000 --toxicity=1 secondary-2
sleep 100000
"
jaeger:
image: jaegertracing/all-in-one:1.17
environment:
COLLECTOR_ZIPKIN_HTTP_PORT: 9411
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "16686:16686"
- "14268:14268"
- "9411:9411"
labels:
- "traefik.enable=true"
- "traefik.http.routers.jaeger.rule=Host(`jaeger.docker.localhost`)"
- "traefik.http.routers.jaeger.entrypoints=web"
- "traefik.http.routers.jaeger.service=jaeger"
- "traefik.http.services.jaeger.loadbalancer.server.port=16686"
traefik:
image: "traefik:v2.7"
container_name: "traefik"
depends_on:
- nun-db-primary
- nun-db-secondary-1
- nun-db-secondary-2
- jaeger
command:
#- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--tracing.servicename=tracing"
- "--tracing.jaeger.localagenthostport=jaeger:6831"
- "--tracing.jaeger.samplingparam=1.0"
- "--tracing.jaeger.samplingserverurl=http://jaeger:5778/sampling"
- "--tracing.jaeger.samplingtype=const"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
nun-db-primary:
image: mateusfreira/nun-db
#build:
# context: .
# dockerfile: ./Dockerfile
environment:
- NUN_DBS_DIR=/nun_data
- NUN_WS_ADDR=0.0.0.0:3058
- NUN_HTTP_ADDR=0.0.0.0:9092
- NUN_TCP_ADDR=nun-db-primary:3017
- NUN_TCP_JOIN_ADDR=toxiproxy:3017
- NUN_LOG_LEVEL=debug
- NUN_USER=mateus
- NUN_REPLICASET=toxiproxy:3017,toxiproxy:3018,toxiproxy:3019
- NUN_PWD=mateus
- NUN_ELECTION_TIMEOUT=6000
command:
- "sh"
- "-c"
- "sleep 3&&nun-db -u $$NUN_USER -p $$NUN_PWD start --http-address $$NUN_HTTP_ADDR --tcp-address $$NUN_TCP_ADDR --ws-address $$NUN_WS_ADDR --replicate-address $$NUN_REPLICASET --external-address $$NUN_TCP_JOIN_ADDR"
ports:
- "3058:3058" # ws
- "9092:9092" # http
#- "3017:3017" # socket
volumes:
- /tmp/data/nun_db/:/nun_data
labels:
- "traefik.enable=true"
- "traefik.http.routers.nun-db-primary.rule=Host(`nun-db-primary.localhost`)"
- "traefik.http.routers.nun-db-primary.entrypoints=web"
- "traefik.http.services.nun-db-primary.loadbalancer.server.port=9092"
- "traefik.tcp.routers.nun-db-primary.rule=HostSNI(`nun-db-primary.localhost`)"
- "traefik.tcp.services.nun-db-primary.loadbalancer.server.port=3017"
depends_on:
- toxiproxy
- toxiproxy-config
nun-db-secondary-1:
image: mateusfreira/nun-db
# build:
# context: .
# dockerfile: ./Dockerfile
depends_on:
- nun-db-primary
environment:
- NUN_LOG_LEVEL=debug
- NUN_DBS_DIR=/nun_data
- NUN_WS_ADDR=0.0.0.0:3059
- NUN_HTTP_ADDR=0.0.0.0:9093
- NUN_TCP_ADDR=nun-db-secondary-1:3018
- NUN_TCP_JOIN_ADDR=toxiproxy:3018
- NUN_USER=mateus
- NUN_PWD=mateus
- NUN_REPLICASET=toxiproxy:3017,toxiproxy:3018,toxiproxy:3019
- NUN_ELECTION_TIMEOUT=6000
command:
- "sh"
- "-c"
- "sleep 3&&nun-db -u $$NUN_USER -p $$NUN_PWD start --http-address $$NUN_HTTP_ADDR --tcp-address $$NUN_TCP_ADDR --ws-address $$NUN_WS_ADDR --replicate-address $$NUN_REPLICASET --external-address $$NUN_TCP_JOIN_ADDR"
ports:
- "3059:3059" # ws
- "9093:9093" # http
volumes:
- /tmp/data/nun_db1/:/nun_data
labels:
- "traefik.enable=true"
- "traefik.http.routers.nun-db-2.rule=Host(`nun-db-2.localhost`)"
- "traefik.http.routers.nun-db-2.entrypoints=web"
- "traefik.http.services.nun-db-2.loadbalancer.server.port=9093"
- "traefik.tcp.routers.nun-db-2.rule=HostSNI(`nun-db-2.localhost`)"
- "traefik.tcp.services.nun-db-2.loadbalancer.server.port=3018"
nun-db-secondary-2:
image: mateusfreira/nun-db
#image: docker.io/library/nun-db-nun-db-secondary-1
#build:
# context: .
# dockerfile: ./Dockerfile
depends_on:
- nun-db-primary
- nun-db-secondary-1
environment:
- NUN_DBS_DIR=/nun_data
- NUN_WS_ADDR=0.0.0.0:3060
- NUN_HTTP_ADDR=0.0.0.0:9094
- NUN_TCP_ADDR=nun-db-secondary-2:3019
- NUN_TCP_JOIN_ADDR=toxiproxy:3019
- NUN_USER=mateus
- NUN_PWD=mateus
- NUN_REPLICASET=toxiproxy:3017,toxiproxy:3018,toxiproxy:3019
- NUN_ELECTION_TIMEOUT=6000
command:
- "sh"
- "-c"
- "sleep 3&&nun-db -u $$NUN_USER -p $$NUN_PWD start --http-address $$NUN_HTTP_ADDR --tcp-address $$NUN_TCP_ADDR --ws-address $$NUN_WS_ADDR --replicate-address $$NUN_REPLICASET --external-address $$NUN_TCP_JOIN_ADDR"
ports:
- "3060:3060" # ws
- "9094:9094" # http
volumes:
- /tmp/data/nun_db2/:/nun_data
labels:
- "traefik.enable=true"
- "traefik.http.routers.nun-db-3.rule=Host(`nun-db-3.localhost`)"
- "traefik.http.routers.nun-db-3.entrypoints=web"
- "traefik.http.services.nun-db-3.loadbalancer.server.port=9094"
- "traefik.tcp.routers.nun-db-3.rule=HostSNI(`nun-db-3.localhost`)"
- "traefik.tcp.services.nun-db-3.loadbalancer.server.port=3019"
volumes:
minio_data:
driver: local
networks:
minionetwork:
driver: bridge