Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ DISABLE_REGISTRATION=true
IP_GEOLOCATION_DB_PATH=
DEBUG_MODE=false

# Database credentials
# Can be generated via: openssl rand -hex 32
CLICKHOUSE_PASSWORD=
REDIS_PASSWORD=

# Emails configuration (SMTP)
# See https://docs.swetrix.com/selfhosting/configuring#email-configuration-smtp
SMTP_HOST=
Expand Down
20 changes: 11 additions & 9 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
# This is Swetrix user interface application, it's used to display the analytics data, render charts, etc.
swetrix:
image: swetrix/swetrix-fe:v5.1.1
image: swetrix/swetrix-fe:v5.2.0
restart: always
depends_on:
- swetrix-api
Expand All @@ -15,7 +15,7 @@ services:

# 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:v5.1.1
image: swetrix/swetrix-api:v5.2.0
restart: always
container_name: swetrix-api
environment:
Expand Down Expand Up @@ -43,7 +43,10 @@ services:
# Redis and Clickhouse are required for the API to work
- REDIS_HOST=redis
- CLICKHOUSE_HOST=http://clickhouse
- CLICKHOUSE_PASSWORD
- CLICKHOUSE_USER=default
- CLICKHOUSE_PORT=8123
- CLICKHOUSE_DATABASE=analytics
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:?Set CLICKHOUSE_PASSWORD in .env}
- REDIS_PASSWORD
links:
- "redis"
Expand All @@ -60,7 +63,7 @@ services:
start_period: 15s

redis:
image: redis:8.2-alpine
image: redis:8.6-alpine
restart: always
environment:
- REDIS_PORT=6379
Expand All @@ -72,13 +75,12 @@ services:
start_period: 1m

clickhouse:
image: clickhouse/clickhouse-server:24.10-alpine
image: clickhouse/clickhouse-server:25.8-alpine
container_name: clickhouse
environment:
- CLICKHOUSE_DATABASE=analytics
- CLICKHOUSE_DB=analytics
- CLICKHOUSE_USER=default
- CLICKHOUSE_PORT=8123
- CLICKHOUSE_PASSWORD
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:?Set CLICKHOUSE_PASSWORD in .env}
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 -O - http://127.0.0.1:8123/ping || exit 1"]
interval: 30s
Expand All @@ -101,7 +103,7 @@ services:
hard: 262144

nginx-proxy:
image: nginx:1.29.4-alpine
image: nginx:1.29.8-alpine
restart: always
depends_on:
swetrix:
Expand Down
11 changes: 9 additions & 2 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ generate_random_string() {
openssl rand -base64 48
}

generate_random_hex() {
openssl rand -hex 32
}

# Helper: check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
Expand Down Expand Up @@ -280,9 +284,12 @@ echo "DEBUG_MODE=false" >> .env
echo "IP_GEOLOCATION_DB_PATH=" >> .env
echo "DISABLE_REGISTRATION=true" >> .env

echo -e "\n\n# Keep these empty unless you manually set passwords for your databases" >> .env
clickhouse_password=$(generate_random_hex)

echo -e "\n\n# Database credentials" >> .env
echo "REDIS_PASSWORD=" >> .env
echo "CLICKHOUSE_PASSWORD=" >> .env
echo "CLICKHOUSE_PASSWORD=$clickhouse_password" >> .env
echo -e "${GREEN}Generated CLICKHOUSE_PASSWORD${NC}"

echo -e "\n${GREEN}Configuration complete! .env file has been created.${NC}"
echo -e "${YELLOW}Note: Make sure to review the .env file before starting the application.${NC}"