🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
chore(env): clean up ClickHouse configuration in .env.example and documentation
Bill Yang73b2bf8bd6ca
diff --git a/.env.example b/.env.exampleindex a6e30a3e2..d4ce88766 100644--- a/.env.example+++ b/.env.example@@ -14,15 +14,10 @@ USE_WEBSERVER=trueHOST_BACKEND_PORT=127.0.0.1:3001HOST_CLIENT_PORT=127.0.0.1:3002-# ClickHouse Database ConfigurationCLICKHOUSE_DB=analyticsCLICKHOUSE_USER=defaultCLICKHOUSE_PASSWORD=frog-# Password for the least-privilege `rybbit_query` ClickHouse user that runs-# user-authored SQL (custom queries / dashboards). Defaults to CLICKHOUSE_PASSWORD.-# CLICKHOUSE_QUERY_PASSWORD=-# PostgreSQL Database ConfigurationPOSTGRES_DB=analyticsPOSTGRES_USER=frogPOSTGRES_PASSWORD=frogdiff --git a/docs/content/docs/(docs)/self-hosting-guides/self-hosting-advanced.mdx b/docs/content/docs/(docs)/self-hosting-guides/self-hosting-advanced.mdxindex 67a076cad..90568e398 100644--- a/docs/content/docs/(docs)/self-hosting-guides/self-hosting-advanced.mdx+++ b/docs/content/docs/(docs)/self-hosting-guides/self-hosting-advanced.mdx@@ -79,9 +79,6 @@ POSTGRES_USER=frogPOSTGRES_PASSWORD=frogPOSTGRES_DB=analyticsCLICKHOUSE_DB=analytics-# Password for the least-privilege `rybbit_query` ClickHouse user that runs-# custom SQL queries and dashboards (defaults to CLICKHOUSE_PASSWORD)-CLICKHOUSE_QUERY_PASSWORD=frog# Custom image tagsIMAGE_TAG=latest@@ -90,31 +87,3 @@ IMAGE_TAG=latestHOST_BACKEND_PORT="3001:3001"HOST_CLIENT_PORT="3002:3002"```--## Custom SQL queries and dashboards--User-authored SQL (the Query page and dashboard cards) runs as a dedicated least-privilege ClickHouse user, `rybbit_query`, never as the main ClickHouse account. The backend creates and maintains this user at startup with `CREATE USER` / `GRANT` statements: SELECT on the events table only, `readonly = 2`, and pinned execution-time, memory, thread and row limits. That needs the main ClickHouse user to have `access_management` enabled — the bundled compose files set `CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1` on the `clickhouse` service (existing installs pick it up when the container is recreated with `docker compose up -d clickhouse`).--`CLICKHOUSE_QUERY_PASSWORD` sets that user's password (defaults to `CLICKHOUSE_PASSWORD`); `CLICKHOUSE_QUERY_USER` overrides the name.--If your ClickHouse admin account cannot manage access (some managed offerings), the backend logs an error at startup and custom queries fail closed until you create the user yourself:--```sql-CREATE SETTINGS PROFILE IF NOT EXISTS rybbit_query- SETTINGS readonly = 2 READONLY,- max_execution_time = 10 READONLY,- max_memory_usage = 4000000000 READONLY,- max_threads = 4 READONLY,- max_result_rows = 1000 READONLY,- result_overflow_mode = 'break' READONLY,- max_concurrent_queries_for_user = 8 READONLY,- enable_json_type = 1;--CREATE USER IF NOT EXISTS rybbit_query- IDENTIFIED WITH sha256_password BY '<CLICKHOUSE_QUERY_PASSWORD>'- SETTINGS PROFILE 'rybbit_query';--GRANT SELECT ON analytics.events TO rybbit_query;-```--Grant nothing else: the absence of table-function and `system.*` privileges is what keeps user SQL contained.