@@ -10,47 +10,117 @@ networks:
1010 plausible-internal:
1111 driver: overlay
1212
13+ configs:
14+ clickhouse_logs_config:
15+ content: |
16+ <clickhouse>
17+ <logger>
18+ <level>warning</level>
19+ <console>true</console>
20+ </logger>
21+ <query_log replace="1">
22+ <database>system</database>
23+ <table>query_log</table>
24+ <flush_interval_milliseconds>7500</flush_interval_milliseconds>
25+ <engine>
26+ ENGINE = MergeTree
27+ PARTITION BY event_date
28+ ORDER BY (event_time)
29+ TTL event_date + interval 30 day
30+ SETTINGS ttl_only_drop_parts=1
31+ </engine>
32+ </query_log>
33+ <metric_log remove="remove" />
34+ <asynchronous_metric_log remove="remove" />
35+ <query_thread_log remove="remove" />
36+ <text_log remove="remove" />
37+ <trace_log remove="remove" />
38+ <session_log remove="remove" />
39+ <part_log remove="remove" />
40+ </clickhouse>
41+ clickhouse_ipv4_config:
42+ content: |
43+ <clickhouse>
44+ <listen_host>0.0.0.0</listen_host>
45+ </clickhouse>
46+ clickhouse_resources_config:
47+ content: |
48+ <clickhouse>
49+ <mark_cache_size>524288000</mark_cache_size>
50+ <profile>
51+ <default>
52+ <max_threads>1</max_threads>
53+ <max_block_size>8192</max_block_size>
54+ <max_download_threads>1</max_download_threads>
55+ <input_format_parallel_parsing>0</input_format_parallel_parsing>
56+ <output_format_parallel_formatting>0</output_format_parallel_formatting>
57+ </default>
58+ </profile>
59+ </clickhouse>
60+
1361services:
1462 postgres:
1563 image: postgres:16-alpine
1664 volumes:
1765 - plausibleDb:/var/lib/postgresql/data
1866 environment:
19- POSTGRES_USER: plausible
20- POSTGRES_PASSWORD: plausible
21- POSTGRES_DB: plausible
67+ POSTGRES_PASSWORD: postgres
2268 networks:
2369 - plausible-internal
70+ healthcheck:
71+ test: ["CMD-SHELL", "pg_isready -U postgres"]
72+ start_period: 1m
2473 deploy:
2574 restart_policy:
2675 condition: any
2776 max_attempts: 3
2877 window: 120s
2978
3079 clickhouse:
31- image: clickhouse/clickhouse-server:24-alpine
80+ image: clickhouse/clickhouse-server:24.12 -alpine
3281 volumes:
3382 - clickhouseData:/var/lib/clickhouse
3483 - clickhouseLogs:/var/log/clickhouse-server
84+ configs:
85+ - source: clickhouse_logs_config
86+ target: /etc/clickhouse-server/config.d/logs.xml
87+ - source: clickhouse_ipv4_config
88+ target: /etc/clickhouse-server/config.d/ipv4-only.xml
89+ - source: clickhouse_resources_config
90+ target: /etc/clickhouse-server/config.d/low-resources.xml
91+ environment:
92+ CLICKHOUSE_SKIP_USER_SETUP: "1"
3593 ulimits:
3694 nofile:
3795 soft: 262144
3896 hard: 262144
3997 networks:
4098 - plausible-internal
99+ healthcheck:
100+ test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1"]
101+ start_period: 1m
41102 deploy:
42103 restart_policy:
43104 condition: any
44105 max_attempts: 3
45106 window: 120s
46107
47108 plausible:
48- image: ghcr.io/plausible/community-edition:${ container . buildImage || 'latest' }
109+ image: ghcr.io/plausible/community-edition:${ container . buildImage || 'v3.1.0' }
110+ command: sh -c "/app/bin/plausible eval Plausible.Release.setup_clickhouse && /app/bin/plausible eval Plausible.Release.migrate && /app/bin/plausible start"
49111 depends_on:
50- - postgres
51- - clickhouse
112+ postgres:
113+ condition: service_healthy
114+ clickhouse:
115+ condition: service_healthy
116+ volumes:
117+ - plausibleData:/var/lib/plausible
52118 env_file:
53119 - .env
120+ ulimits:
121+ nofile:
122+ soft: 65535
123+ hard: 65535
54124 networks:
55125 - traefik-public
56126 - plausible-internal
@@ -88,6 +158,7 @@ services:
88158
89159volumes:
90160 plausibleDb:
161+ plausibleData:
91162 clickhouseData:
92163 clickhouseLogs:
93164 ` ;
0 commit comments