This repository was archived by the owner on Apr 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
61 lines (59 loc) · 1.54 KB
/
docker-compose.yaml
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
version: "3.8"
services:
# A nats cluster with 3 nodes
nats:
image: nats:2.10.14-alpine
command:
- "--debug"
- "-m"
- "8222"
- "--cluster"
- "nats://0.0.0.0:6222"
- "--routes"
# Note that this needs to be prefixed with the
# name of the directory that the docker-compose file is in.
# In this case it's "nats-consumers-78214263" (a mnemonic and question ID)
- "nats://nats-consumers-78214263-nats-1:6222"
hostname: nats
deploy:
replicas: 3
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8222/varz"]
interval: 10s
timeout: 5s
retries: 3
# The producer
# You can scale this up via `docker compose scale producer=n`
# to see how the consumers handle the load
producer:
deploy:
replicas: 1
build:
context: .
args:
- BINARY_NAME=producer
command: ["/usr/local/bin/producer"]
environment:
- PRODUCER_NATS_URL=nats://nats:4222
- PRODUCER_PRODUCERS=1
depends_on:
nats:
condition: service_healthy
# The consumer
# You can scale this up via `docker compose scale consumer=n`
# to see how the consumers handle the load
consumer:
deploy:
replicas: 1
build:
context: .
args:
- BINARY_NAME=consumer
command: ["/usr/local/bin/consumer"]
environment:
- CONSUMER_NATS_URL=nats://nats:4222
- CONSUMER_TOPIC=test.>
- CONSUMER_CONSUMERS=15000
depends_on:
nats:
condition: service_healthy