🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update self-hosting-advanced.mdx (#156)
Beda Schmid196a5d519f41
diff --git a/docs/src/content/self-hosting-advanced.mdx b/docs/src/content/self-hosting-advanced.mdxindex d07925d14..f58a73483 100644--- a/docs/src/content/self-hosting-advanced.mdx+++ b/docs/src/content/self-hosting-advanced.mdx@@ -82,3 +82,117 @@ server {```For a detailed step-by-step guide on setting up Nginx with SSL certificates using Certbot, see our [Nginx Setup Guide](/docs/self-hosting-nginx).++## Docker Compose setup with NPM, without exposing ports+_this setup assumes you have NPM docker up and running and are capable of creating SSL certs for your local hosts. Ideally, also use Technitium to create a DNS entry_++1. Create a `docker-compose.yml` file in your project folder with these contents:+```+services:+ rybbit_clickhouse:+ container_name: rybbit_clickhouse+ image: clickhouse/clickhouse-server:25.4.2+ volumes:+ - ./clickhouse-data:/var/lib/clickhouse+ - ./clickhouse_config:/etc/clickhouse-server/config.d+ environment:+ - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}+ - CLICKHOUSE_USER=${CLICKHOUSE_USER:-default}+ - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}+ healthcheck:+ test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"]+ interval: 3s+ timeout: 5s+ retries: 5+ start_period: 10s+ restart: unless-stopped+ networks:+ - internal++ rybbit_postgres:+ image: postgres:17.4+ container_name: rybbit_postgres+ environment:+ - POSTGRES_USER=${POSTGRES_USER:-frog}+ - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}+ - POSTGRES_DB=${POSTGRES_DB:-analytics}+ volumes:+ - ./postgres-data:/var/lib/postgresql/data+ restart: unless-stopped+ networks:+ - internal++ rybbit_backend:+ image: ghcr.io/rybbit-io/rybbit-backend:${IMAGE_TAG:-latest}+ container_name: rybbit_backend+ environment:+ - NODE_ENV=production+ - CLICKHOUSE_HOST=http://rybbit_clickhouse:8123+ - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}+ - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}+ - POSTGRES_HOST=rybbit_postgres+ - POSTGRES_PORT=5432+ - POSTGRES_DB=${POSTGRES_DB:-analytics}+ - POSTGRES_USER=${POSTGRES_USER:-frog}+ - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}+ - BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}+ - BASE_URL=${BASE_URL}+ - DISABLE_SIGNUP=${DISABLE_SIGNUP}+ depends_on:+ rybbit_clickhouse:+ condition: service_healthy+ rybbit_postgres:+ condition: service_started+ restart: unless-stopped+ networks:+ - internal+ - npm_proxy++ rybbit_client:+ image: ghcr.io/rybbit-io/rybbit-client:${IMAGE_TAG:-latest}+ container_name: rybbit_client+ environment:+ - NODE_ENV=production+ - NEXT_PUBLIC_BACKEND_URL=${BASE_URL}+ depends_on:+ - rybbit_backend+ restart: unless-stopped+ networks:+ - internal+ - npm_proxy++networks:+ internal:+ driver: bridge+ npm_proxy:+ external: true+```++2. Create an `.env` file with these contents (edit them adequately)+```+DOMAIN_NAME=domain.tld+BASE_URL=https://domain.tld+BETTER_AUTH_SECRET=long_random_string+DISABLE_SIGNUP=false+HOST_BACKEND_PORT=3001+HOST_CLIENT_PORT=3002+```++4. Optionally, copy the folder https://github.com/rybbit-io/rybbit/tree/master/clickhouse_config to your project (this is not strictly necessary but allows for greater control over clickhouse and might be necessary if you run into networking issues)++5. Make sure to create your external network `npm_proxy` and make sure NPM is on it as well++6. Create your NPM host entry for `rybbit_client` (point it to port 3002) and in that host, add a custom location for `/api`, pointing it to `rybbit_backend` port 3002.++Hint: In the Custom Location add a custom rule:+```+location /api/ {+ rewrite ^/api(/.*)$ $1 break;+ proxy_pass http://rybbit_backend:3001;+}+```+_note, this might not be necessary anymore, check https://github.com/rybbit-io/rybbit/issues/135_++7. run `docker compose up -d` (or separately pull and up)++8. Navigate to domain.tld and register your admin Account.