forked from Swetrix/selfhosting
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
119 lines (112 loc) · 3.11 KB
/
compose.yaml
File metadata and controls
119 lines (112 loc) · 3.11 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:
# This is Swetrix user interface application, it's used to display the analytics data, render charts, etc.
swetrix:
image: swetrix/swetrix-fe:v4.1.0
restart: always
depends_on:
- swetrix-api
ports:
- "80:3000"
environment:
- API_URL=${API_URL}
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 --spider http://localhost:3000/ping || exit 1",
]
interval: 30s
start_period: 15s
# This is Swetrix API, it's purpose is to collect incoming analytical events and serve the data to the UI
swetrix-api:
image: swetrix/swetrix-api:v4.1.0
restart: always
container_name: swetrix-api
ports:
- "8080:5005"
environment:
# Configurable with .env file
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- DISABLE_REGISTRATION
- IP_GEOLOCATION_DB_PATH
- DEBUG_MODE
- CLOUDFLARE_PROXY_ENABLED
# Emails configuration (SMTP)
- SMTP_HOST
- SMTP_PORT
- SMTP_USER
- SMTP_PASSWORD
- FROM_EMAIL
- SMTP_MOCK
# OIDC configuration
- OIDC_ENABLED
- OIDC_ONLY_AUTH
- OIDC_DISCOVERY_URL
- OIDC_CLIENT_ID
- OIDC_CLIENT_SECRET
# Redis and Clickhouse are required for the API to work
- REDIS_HOST=redis
- CLICKHOUSE_HOST=http://clickhouse
- CLICKHOUSE_PASSWORD
- REDIS_PASSWORD
links:
- "redis"
- "clickhouse"
depends_on:
redis:
condition: service_healthy
clickhouse:
condition: service_healthy
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 --spider http://localhost:5005/ping || exit 1",
]
interval: 30s
start_period: 15s
redis:
image: redis:8.2-alpine
restart: always
environment:
- REDIS_PORT=6379
- REDIS_USER=default
- REDIS_PASSWORD
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 30s
start_period: 1m
clickhouse:
image: clickhouse/clickhouse-server:24.10-alpine
container_name: clickhouse
environment:
- CLICKHOUSE_DATABASE=analytics
- CLICKHOUSE_USER=default
- CLICKHOUSE_PORT=8123
- CLICKHOUSE_PASSWORD
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 -O - http://127.0.0.1:8123/ping || exit 1",
]
interval: 30s
start_period: 1m
restart: always
cap_add:
- SYS_NICE
volumes:
- swetrix-events-data:/var/lib/clickhouse
# Disable logging
- ./clickhouse/reduce-logs.xml:/etc/clickhouse-server/config.d/reduce-logs.xml:ro
- ./clickhouse/disable-user-logging.xml:/etc/clickhouse-server/users.d/disable-user-logging.xml:ro
# Reduce RAM usage
- ./clickhouse/preserve-ram-config.xml:/etc/clickhouse-server/config.d/preserve-ram-config.xml:ro
- ./clickhouse/preserve-ram-user.xml:/etc/clickhouse-server/users.d/preserve-ram-user.xml:ro
ulimits:
nofile:
soft: 262144
hard: 262144
volumes:
swetrix-events-data:
driver: local