diff --git a/public/svgs/swetrix.svg b/public/svgs/swetrix.svg new file mode 100644 index 000000000..8bb5bfdfa --- /dev/null +++ b/public/svgs/swetrix.svg @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/templates/compose/swetrix.yaml b/templates/compose/swetrix.yaml new file mode 100644 index 000000000..756a96839 --- /dev/null +++ b/templates/compose/swetrix.yaml @@ -0,0 +1,165 @@ +# documentation: https://docs.swetrix.com/selfhosting/how-to +# slogan: Privacy-friendly and cookieless European web analytics alternative to Google Analytics. +# category: analytics +# tags: analytics,privacy,monitoring,open-source,clickhouse,redis +# logo: svgs/swetrix.svg +# port: 3000 + +services: + swetrix: + image: swetrix/swetrix-fe:v4.0.2 + restart: always + depends_on: + - swetrix-api + environment: + # Required - public URL of the API service (e.g. https://swetrix-api.example.com) + - 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 + + swetrix-api: + image: swetrix/swetrix-api:v4.0.2 + restart: always + environment: + # Required + - SECRET_KEY_BASE=${SECRET_KEY_BASE:?} + + # Optional + - DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-false} + - IP_GEOLOCATION_DB_PATH=${IP_GEOLOCATION_DB_PATH:-} + - DEBUG_MODE=${DEBUG_MODE:-false} + - CLOUDFLARE_PROXY_ENABLED=${CLOUDFLARE_PROXY_ENABLED:-false} + + # SMTP (optional) + - SMTP_HOST=${SMTP_HOST:-} + - SMTP_PORT=${SMTP_PORT:-} + - SMTP_USER=${SMTP_USER:-} + - SMTP_PASSWORD=${SMTP_PASSWORD:-} + - FROM_EMAIL=${FROM_EMAIL:-} + - SMTP_MOCK=${SMTP_MOCK:-false} + + # OIDC (optional) + - OIDC_ENABLED=${OIDC_ENABLED:-false} + - OIDC_ONLY_AUTH=${OIDC_ONLY_AUTH:-false} + - OIDC_DISCOVERY_URL=${OIDC_DISCOVERY_URL:-} + - OIDC_CLIENT_ID=${OIDC_CLIENT_ID:-} + - OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET:-} + + # Required service endpoints + - REDIS_HOST=redis + - CLICKHOUSE_HOST=http://clickhouse + - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-} + 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=${REDIS_PORT:-6379} + - REDIS_USER=${REDIS_USER:-default} + - REDIS_PASSWORD=${REDIS_PASSWORD:-} + healthcheck: + test: + - CMD-SHELL + - redis-cli ping | grep PONG + interval: 30s + start_period: 1m + + clickhouse: + image: clickhouse/clickhouse-server:24.10-alpine + restart: always + environment: + - CLICKHOUSE_DATABASE=${CLICKHOUSE_DATABASE:-analytics} + - CLICKHOUSE_USER=${CLICKHOUSE_USER:-default} + - CLICKHOUSE_PORT=${CLICKHOUSE_PORT:-8123} + - CLICKHOUSE_PASSWORD=${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 + cap_add: + - SYS_NICE + volumes: + # Persistent storage for ClickHouse + - swetrix-events-data:/var/lib/clickhouse + + # Disable logging + - type: bind + source: ./disable-user-logging.xml + target: /etc/clickhouse-server/users.d/disable-user-logging.xml + read_only: true + content: | + + + + 0 + 0 + + + + - type: bind + source: ./reduce-logs.xml + target: /etc/clickhouse-server/config.d/reduce-logs.xml + read_only: true + content: | + + + warning + true + + + + + + + + + + + + # Reduce RAM usage + - type: bind + source: ./preserve-ram-config.xml + target: /etc/clickhouse-server/config.d/preserve-ram-config.xml + read_only: true + content: | + + 536870912 + 1 + + - type: bind + source: ./preserve-ram-user.xml + target: /etc/clickhouse-server/users.d/preserve-ram-user.xml + read_only: true + content: | + + + + 2048 + 1 + 0 + 0 + + + + + ulimits: + nofile: + soft: 262144 + hard: 262144