Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
119 lines (114 loc) · 3.75 KB
/
Copy pathdocker-compose.yml
File metadata and controls
119 lines (114 loc) · 3.75 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
services:
clickhouse:
# Operator-controlled (CLICKHOUSE_IMAGE in .env). The default stays on 24.3
# until the operator switches: docs/upgrades/clickhouse-26.8.md is the
# runbook for 26.8 LTS (check the CPU has AVX2 first).
image: ${CLICKHOUSE_IMAGE:-clickhouse/clickhouse-server:24.3-alpine}
ports:
- "8123:8123"
- "9000:9000"
volumes:
- clickhouse_data:/var/lib/clickhouse
# Caps system.*_log growth — they share the data volume and are
# unbounded by default. Mount the FILE, not the directory: a directory
# bind-mount masks the image's own docker_related_config.xml and
# ClickHouse silently falls back to listening on loopback only.
- ./clickhouse/config.d/system-logs-ttl.xml:/etc/clickhouse-server/config.d/system-logs-ttl.xml:ro
environment:
CLICKHOUSE_DB: asstats
CLICKHOUSE_USER: asstats
CLICKHOUSE_PASSWORD: asstats
ulimits:
nofile:
soft: 262144
hard: 262144
healthcheck:
test: ["CMD", "clickhouse-client", "--query", "SELECT 1"]
interval: 10s
timeout: 5s
retries: 5
migrate:
build:
context: .
dockerfile: Dockerfile.migrate
restart: "no"
environment:
CLICKHOUSE_ADDR: clickhouse:9000
CLICKHOUSE_DATABASE: asstats
CLICKHOUSE_USER: asstats
CLICKHOUSE_PASSWORD: asstats
MIGRATE_AUTO_BASELINE: "true"
MIGRATE_TIMEOUT: "30m"
depends_on:
clickhouse:
condition: service_healthy
collector:
build:
context: .
dockerfile: Dockerfile.collector
ports:
- "2055:2055/udp"
- "6343:6343/udp"
environment:
CLICKHOUSE_ADDR: clickhouse:9000
CLICKHOUSE_DATABASE: asstats
CLICKHOUSE_USER: asstats
CLICKHOUSE_PASSWORD: asstats
COLLECTOR_LISTEN_NETFLOW: ":2055"
COLLECTOR_LISTEN_SFLOW: ":6343"
# Time-driven flushing: each INSERT creates ~21 parts across the MVs, so
# fewer, larger INSERTs cut part count and merge I/O (see .env.example).
COLLECTOR_BATCH_SIZE: "50000"
COLLECTOR_FLUSH_INTERVAL: "15s"
COLLECTOR_WORKERS: "4"
# Exporter allow-list (IPs / CIDRs, comma-separated); empty = any source.
COLLECTOR_ALLOWED_EXPORTERS: "${COLLECTOR_ALLOWED_EXPORTERS:-}"
# SIGTERM drains the pipeline and flushes the last batch, bounded by
# COLLECTOR_SHUTDOWN_TIMEOUT (40s). Docker's default 10s grace would
# SIGKILL it mid-flush and lose up to one flush interval of flows.
stop_grace_period: 60s
depends_on:
migrate:
condition: service_completed_successfully
healthcheck:
# HTTP /healthz on the metrics listener (COLLECTOR_PROMETHEUS_ADDR,
# default :9090). A UDP probe of 2055 looked like a malformed flow to the
# decoder and polluted asstats_decode_errors_total.
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:9090/healthz || exit 1"]
interval: 30s
timeout: 5s
retries: 3
api:
build:
context: .
dockerfile: Dockerfile.api
ports:
- "8080:8080"
environment:
CLICKHOUSE_ADDR: clickhouse:9000
CLICKHOUSE_DATABASE: asstats
CLICKHOUSE_USER: asstats
CLICKHOUSE_PASSWORD: asstats
API_LISTEN_ADDR: ":8080"
API_CORS_ORIGINS: "http://localhost:5173,http://localhost:80"
AUTH_ENABLED: "false"
ALLOW_UNAUTHENTICATED: "true"
depends_on:
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/healthz || exit 1"]
interval: 10s
timeout: 5s
retries: 5
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
ports:
- "80:80"
depends_on:
api:
condition: service_healthy
volumes:
clickhouse_data: