Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
148 lines (141 loc) · 4.88 KB
/
Copy pathdocker-compose.yml
File metadata and controls
148 lines (141 loc) · 4.88 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:
postgres:
image: postgres:16-alpine
container_name: chainscope-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-chainscope}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-chainscope}
POSTGRES_DB: ${POSTGRES_DB:-chainscope}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- chainscope-pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-chainscope} -d ${POSTGRES_DB:-chainscope}"]
interval: 5s
timeout: 5s
retries: 10
# Redpanda: the phase-2 log transport (M5). A Kafka-API-compatible broker in a
# single native binary — no JVM, no ZooKeeper — so it is one more service here,
# not a cluster to run. The pipeline stages publish to and consume from topics
# on it instead of the in-process channel, which is what lets them become
# separate processes and lets several consumers read the same event stream.
redpanda:
image: redpandadata/redpanda:v24.2.7
container_name: chainscope-redpanda
restart: unless-stopped
command:
- redpanda
- start
# dev-container: a relaxed single-node profile for a laptop, not production.
- --mode=dev-container
- --smp=1
- --default-log-level=info
# One listener on 9092, advertised as localhost so a client on the host
# (the indexer and the tests, for now) connects to localhost:9092.
- --kafka-addr=PLAINTEXT://0.0.0.0:9092
- --advertise-kafka-addr=PLAINTEXT://localhost:9092
ports:
- "${REDPANDA_KAFKA_PORT:-9092}:9092"
- "9644:9644" # admin API, used by the healthcheck
volumes:
- chainscope-redpanda:/var/lib/redpanda/data
healthcheck:
test: ["CMD-SHELL", "rpk cluster health | grep -qE 'Healthy:.+true'"]
interval: 10s
timeout: 5s
retries: 12
# The three chainscope processes. Each builds from the shared multi-stage
# Dockerfile, waits for a healthy Postgres, and takes its secrets from .env.
# DATABASE_URL is overridden here because .env points at localhost (for host
# tooling); inside the compose network the database is reached as `postgres`.
indexer:
build:
context: .
args:
BIN: chainscope-indexer
container_name: chainscope-indexer
restart: unless-stopped
env_file: .env
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-chainscope}:${POSTGRES_PASSWORD:-chainscope}@postgres:5432/${POSTGRES_DB:-chainscope}
depends_on:
postgres:
condition: service_healthy
api:
build:
context: .
args:
BIN: chainscope-api
container_name: chainscope-api
restart: unless-stopped
env_file: .env
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-chainscope}:${POSTGRES_PASSWORD:-chainscope}@postgres:5432/${POSTGRES_DB:-chainscope}
API_BIND: 0.0.0.0:8080
ports:
- "${API_PORT:-8080}:8080"
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/healthz || exit 1"]
interval: 10s
timeout: 5s
retries: 6
alerter:
build:
context: .
args:
BIN: chainscope-alerter
container_name: chainscope-alerter
restart: unless-stopped
env_file: .env
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-chainscope}:${POSTGRES_PASSWORD:-chainscope}@postgres:5432/${POSTGRES_DB:-chainscope}
depends_on:
postgres:
condition: service_healthy
# Observability (M10). Prometheus scrapes the API's /metrics; Grafana ships
# with the datasource and the chainscope dashboard already provisioned, so
# `docker compose up` yields a working dashboard with no manual import.
prometheus:
image: prom/prometheus:v2.54.1
container_name: chainscope-prometheus
restart: unless-stopped
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.retention.time=15d
volumes:
- ./ops/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- chainscope-prometheus:/prometheus
ports:
- "${PROMETHEUS_PORT:-9090}:9090"
depends_on:
- api
grafana:
image: grafana/grafana:11.2.0
container_name: chainscope-grafana
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_USER: ${GRAFANA_USER:-admin}
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- ./ops/grafana/provisioning:/etc/grafana/provisioning:ro
- ./ops/grafana/dashboards:/var/lib/grafana/dashboards:ro
- chainscope-grafana:/var/lib/grafana
ports:
- "${GRAFANA_PORT:-3000}:3000"
depends_on:
- prometheus
volumes:
chainscope-pgdata:
name: chainscope-pgdata
chainscope-redpanda:
name: chainscope-redpanda
chainscope-prometheus:
name: chainscope-prometheus
chainscope-grafana:
name: chainscope-grafana