# --------------------------------------------------------------------------- # PgPulse environment configuration # Copy to `.env` and adjust as needed. Never commit your real `.env`. # --------------------------------------------------------------------------- # App NODE_ENV=development PORT=3000 LOG_LEVEL=info # --------------------------------------------------------------------------- # Write path: app -> PgBouncer (transaction mode) -> Postgres primary # PgBouncer listens on 6432. Inside docker-compose the host is `pgbouncer`. # --------------------------------------------------------------------------- PRIMARY_DATABASE_URL=postgres://pgpulse:pgpulse_secret@pgbouncer:6432/pgpulse # --------------------------------------------------------------------------- # Read path: analytics queries -> read replica (direct, no PgBouncer needed, # but you may point this at a second PgBouncer in production). # Falls back to primary if replica is unavailable. # --------------------------------------------------------------------------- REPLICA_DATABASE_URL=postgres://pgpulse:pgpulse_secret@postgres-replica:5432/pgpulse # --------------------------------------------------------------------------- # Direct (no-PgBouncer) connection used by the migration runner and any DDL. # Migrations must run on a direct session-mode connection because PgBouncer # transaction mode does not support multi-statement DDL transactions, CREATE # INDEX CONCURRENTLY, or session-level state. # --------------------------------------------------------------------------- ADMIN_DATABASE_URL=postgres://pgpulse:pgpulse_secret@postgres:5432/pgpulse # Pool sizing (app-side pool to PgBouncer). PgBouncer multiplexes onto the # small server-side pool, so this can be generous on the client side. PG_POOL_MAX=20 PG_POOL_IDLE_TIMEOUT_MS=30000 PG_POOL_CONNECT_TIMEOUT_MS=5000 # Rate limiting (per tenant, per window) RATE_LIMIT_MAX=1000 RATE_LIMIT_WINDOW=1 minute # Buffered ingest (see README "Buffered ingest") INGEST_BUFFER_CAPACITY=10000 INGEST_BATCH_SIZE=1000 INGEST_FLUSH_INTERVAL_MS=500 INGEST_TENANT_RATE=1000 INGEST_TENANT_BURST=5000 # Alerting workers (see docs/SCALING.md "Alert System") ALERT_POLL_MS=5000 ALERT_EVAL_INTERVAL_MS=60000 ALERT_LEASE_MS=60000 ALERT_BATCH_SIZE=20 ALERT_MAX_ATTEMPTS=8 ALERT_DISPATCH_LEASE_MS=60000 ALERT_WEBHOOK_TIMEOUT_MS=5000 ALERT_BACKOFF_BASE_MS=1000 ALERT_BACKOFF_CAP_MS=900000 # Read routing: use the replica while lag <= REPLICA_MAX_LAG_MS, else the primary REPLICA_MAX_LAG_MS=2000 REPLICA_PROBE_INTERVAL_MS=1000 REPLICA_PROBE_TIMEOUT_MS=1000 REPLICA_RECOVERY_PROBES=3 # Rollup worker (watermark cursors) ROLLUP_INTERVAL_MS=30000 ROLLUP_SAFETY_LAG_SECONDS=30 # Partition lifecycle + cold archival (see docs/SCALING.md "Partition lifecycle") PARTITION_AHEAD_DAYS=7 PARTITION_RETENTION_DAYS=90 PARTITION_INTERVAL_MS=3600000 # S3 / MinIO. Leave S3_BUCKET empty to disable archival: partitions are still # pre-created, but nothing is detached or dropped. For AWS S3 leave S3_ENDPOINT # empty. MinIO from docker-compose: http://localhost:9000 from the host. S3_ENDPOINT=http://minio:9000 S3_BUCKET=pgpulse-archive S3_REGION=us-east-1 S3_ACCESS_KEY=pgpulse S3_SECRET_KEY=pgpulse_minio_secret S3_PREFIX=archive # Operator diagnostics: GET /internal/db-health requires # "Authorization: Bearer ". Leave empty to disable the endpoint (404). # Use a long random value, e.g. `openssl rand -hex 32`. INTERNAL_API_TOKEN= # Postgres superuser bootstrap (used by docker entrypoint only) POSTGRES_USER=pgpulse POSTGRES_PASSWORD=pgpulse_secret POSTGRES_DB=pgpulse # Replication credentials (streaming replica) REPLICATION_USER=replicator REPLICATION_PASSWORD=replicator_secret