From 013bd51657a1feb3da2877615c406c16e76a79b6 Mon Sep 17 00:00:00 2001 From: Blue Mouse Date: Wed, 6 May 2026 23:39:08 +0100 Subject: [PATCH 1/3] Update Clickhouse to 25.8, add password .env --- compose.yaml | 5 ++--- configure.sh | 11 +++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/compose.yaml b/compose.yaml index 8f47aad..1b7e1b9 100644 --- a/compose.yaml +++ b/compose.yaml @@ -72,12 +72,11 @@ 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 healthcheck: test: ["CMD-SHELL", "wget --no-verbose --tries=1 -O - http://127.0.0.1:8123/ping || exit 1"] diff --git a/configure.sh b/configure.sh index 111ed21..3f0383f 100755 --- a/configure.sh +++ b/configure.sh @@ -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 @@ -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}" From b05055fdc549e8574157845fc95ec91643736a63 Mon Sep 17 00:00:00 2001 From: Blue Mouse Date: Wed, 6 May 2026 23:42:08 +0100 Subject: [PATCH 2/3] Upgrade Redis & NGINX --- compose.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compose.yaml b/compose.yaml index 1b7e1b9..c0425e5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -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 @@ -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: @@ -60,7 +60,7 @@ services: start_period: 15s redis: - image: redis:8.2-alpine + image: redis:8.6-alpine restart: always environment: - REDIS_PORT=6379 @@ -100,7 +100,7 @@ services: hard: 262144 nginx-proxy: - image: nginx:1.29.4-alpine + image: nginx:1.29.8-alpine restart: always depends_on: swetrix: From 367bae4bed386c5f821219df38c96b6ca8f85f5c Mon Sep 17 00:00:00 2001 From: Blue Mouse Date: Wed, 6 May 2026 23:52:07 +0100 Subject: [PATCH 3/3] require ClickHouse password --- .env.example | 5 +++++ compose.yaml | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 4298419..2296b49 100644 --- a/.env.example +++ b/.env.example @@ -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= diff --git a/compose.yaml b/compose.yaml index c0425e5..3ef42a8 100644 --- a/compose.yaml +++ b/compose.yaml @@ -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" @@ -77,7 +80,7 @@ services: environment: - CLICKHOUSE_DB=analytics - CLICKHOUSE_USER=default - - 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