-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
108 lines (102 loc) · 3.46 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
108 lines (102 loc) · 3.46 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
# Compose stack for the API integration test suite (`pnpm test:api`).
#
# This is NOT the deployable stack — see docker-compose.yml for that. Databases
# run on tmpfs and are discarded on `down`, so every run starts from an empty
# schema (migrations + the default admin user are applied by the umami image on
# boot via scripts/start-docker.sh).
#
# Profiles:
# postgres umami + Postgres -> pnpm test:api
# clickhouse umami + Postgres + ClickHouse -> pnpm test:api:clickhouse
#
# Environment overrides:
# UMAMI_TEST_PORT host port for the app (default 3100, avoids the dev server on 3000)
# UMAMI_TEST_IMAGE image tag to run/build (default umami-test:local)
# SKIP_BUILD_GEO "1" (default) skips the MaxMind download during the image build
x-umami-service: &umami-service
image: ${UMAMI_TEST_IMAGE:-umami-test:local}
build:
context: .
args:
SKIP_BUILD_GEO: ${SKIP_BUILD_GEO:-1}
ports:
- "${UMAMI_TEST_PORT:-3100}:3000"
init: true
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:3000/api/heartbeat || exit 1"]
interval: 2s
timeout: 5s
retries: 90
start_period: 20s
x-umami-env: &umami-env
DATABASE_URL: postgresql://umami:umami@db:5432/umami
APP_SECRET: umami-api-test-secret
TWO_FACTOR_ENCRYPTION_KEY: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
# Playwright/curl user agents are classified as bots; without this /api/send silently drops events.
DISABLE_BOT_CHECK: "1"
DISABLE_TELEMETRY: "1"
DISABLE_UPDATES: "1"
MCP_ENABLED: "1"
services:
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: umami
POSTGRES_USER: umami
POSTGRES_PASSWORD: umami
tmpfs:
- /var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U umami -d umami"]
interval: 2s
timeout: 5s
retries: 30
umami:
<<: *umami-service
profiles: [postgres]
environment: *umami-env
depends_on:
db:
condition: service_healthy
clickhouse:
# Pinned to an LTS release. 26.7+ rejects db/clickhouse/schema.sql because
# website_event_stats_hourly has dimension columns outside the sorting key
# (see allow_dimensions_outside_sorting_key).
image: clickhouse/clickhouse-server:25.8
profiles: [clickhouse]
environment:
CLICKHOUSE_DB: umami
CLICKHOUSE_USER: umami
CLICKHOUSE_PASSWORD: umami
ulimits:
nofile:
soft: 262144
hard: 262144
tmpfs:
- /var/lib/clickhouse
volumes:
# The image runs /docker-entrypoint-initdb.d/*.sql on first start (empty data dir).
- ./tests/api/docker/clickhouse-init/00-create-db.sql:/docker-entrypoint-initdb.d/00-create-db.sql:ro
- ./db/clickhouse/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
healthcheck:
# Healthy only once schema.sql has been applied (session_link is the last table it creates).
test:
[
"CMD-SHELL",
"clickhouse-client --user umami --password umami --query \"SELECT throwIf(count() = 0) FROM system.tables WHERE database = 'umami' AND name = 'session_link'\"",
]
interval: 2s
timeout: 5s
retries: 90
start_period: 10s
umami-clickhouse:
<<: *umami-service
profiles: [clickhouse]
environment:
<<: *umami-env
CLICKHOUSE_URL: http://umami:umami@clickhouse:8123/umami
depends_on:
db:
condition: service_healthy
clickhouse:
condition: service_healthy