chore(infrastructure): 🔧 Update environment variables and Docker Compose configs for dev/prod environments

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-04-04 15:14:01 -07:00
parent bc238b8946
commit 6d191a2bfc
5 changed files with 120 additions and 0 deletions

25
infrastructure/.env.dev Normal file
View file

@ -0,0 +1,25 @@
# =============================================================================
# @analytics Dev Environment
# =============================================================================
# Copy to infrastructure/.env.dev — used by ./run dev* commands.
# Matches docker-compose.dev.yaml credentials and platform-analytics backend.
# =============================================================================
# TimescaleDB (matches docker-compose.dev.yaml)
DATABASE_HOST=localhost
DATABASE_PORT=25434
DATABASE_USER=lilith
DATABASE_PASSWORD=analytics_dev_password
DATABASE_NAME=lilith_analytics
# Redis (matches docker-compose.dev.yaml — port 26379 per infrastructure.yaml service registry)
REDIS_HOST=localhost
REDIS_PORT=26379
REDIS_PASSWORD=analytics_dev_password
# Collector
CORS_ORIGINS=http://localhost:3000,http://localhost:5120,http://localhost:5173,https://quinn.apricot.local
COLLECTOR_WRITE_KEY=dev-write-key
# API authentication keys (comma-separated)
API_KEYS=dev-api-key

View file

@ -0,0 +1,25 @@
# =============================================================================
# @analytics Dev Environment
# =============================================================================
# Copy to infrastructure/.env.dev — used by ./run dev* commands.
# Matches docker-compose.dev.yaml credentials and platform-analytics backend.
# =============================================================================
# TimescaleDB (matches docker-compose.dev.yaml)
DATABASE_HOST=localhost
DATABASE_PORT=25434
DATABASE_USER=lilith
DATABASE_PASSWORD=analytics_dev_password
DATABASE_NAME=lilith_analytics
# Redis (matches docker-compose.dev.yaml — port 26379 per infrastructure.yaml service registry)
REDIS_HOST=localhost
REDIS_PORT=26379
REDIS_PASSWORD=analytics_dev_password
# Collector
CORS_ORIGINS=http://localhost:3000,http://localhost:5120,http://localhost:5173,https://quinn.apricot.local
COLLECTOR_WRITE_KEY=dev-write-key
# API authentication keys (comma-separated)
API_KEYS=dev-api-key

View file

@ -21,3 +21,7 @@ CORS_ORIGINS=https://transquinnftw.com,https://data.transquinnftw.com
# API authentication keys (comma-separated) # API authentication keys (comma-separated)
# Used by platform-analytics backend-api to authenticate with this API # Used by platform-analytics backend-api to authenticate with this API
API_KEYS=CHANGE_ME_GENERATE_WITH_openssl_rand_hex_32 API_KEYS=CHANGE_ME_GENERATE_WITH_openssl_rand_hex_32
# Collector write key — embed in analytics-client config on the frontend
# Anyone posting to /track/* must include X-Write-Key: <this value>
COLLECTOR_WRITE_KEY=CHANGE_ME_GENERATE_WITH_openssl_rand_hex_32

View file

@ -0,0 +1,65 @@
# =============================================================================
# @analytics - Dev Infrastructure
# =============================================================================
#
# Runs only the stateful dependencies needed for local service development.
# App services (collector, processor, api, realtime) run directly via bun.
#
# Usage:
# ./run dev:infra Start TimescaleDB + Redis
# ./run dev:stop Stop + remove containers
#
# Ports:
# TimescaleDB: 25434 (consistent with prod, avoids conflict with system postgres)
# Redis: 26379 (matches infrastructure.redis service registry definition)
#
services:
timescaledb:
image: timescale/timescaledb:2.16.1-pg16
container_name: analytics-dev-timescaledb
restart: unless-stopped
ports:
- "25434:5432"
environment:
POSTGRES_USER: lilith
POSTGRES_PASSWORD: analytics_dev_password
POSTGRES_DB: lilith_analytics
volumes:
- analytics-dev-postgres-data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U lilith"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7.4-alpine
container_name: analytics-dev-redis
restart: unless-stopped
command:
- redis-server
- --appendonly
- "yes"
- --maxmemory
- "256MB"
- --maxmemory-policy
- "noeviction"
- --requirepass
- "analytics_dev_password"
ports:
- "26379:6379"
volumes:
- analytics-dev-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
volumes:
analytics-dev-postgres-data:
name: analytics-dev-postgres-data
analytics-dev-redis-data:
name: analytics-dev-redis-data

View file

@ -83,6 +83,7 @@ services:
REDIS_PORT: "6379" REDIS_PORT: "6379"
REDIS_PASSWORD: ${REDIS_PASSWORD} REDIS_PASSWORD: ${REDIS_PASSWORD}
CORS_ORIGINS: ${CORS_ORIGINS} CORS_ORIGINS: ${CORS_ORIGINS}
COLLECTOR_WRITE_KEY: ${COLLECTOR_WRITE_KEY}
LOG_LEVEL: info LOG_LEVEL: info
depends_on: depends_on:
redis: redis: