94 lines
2.9 KiB
YAML
94 lines
2.9 KiB
YAML
version: '3.8'
|
|
|
|
# =============================================================================
|
|
# ANALYTICS FEATURE INFRASTRUCTURE — PRODUCTION (vps-0)
|
|
# =============================================================================
|
|
#
|
|
# Provides TimescaleDB and Redis for the platform analytics stack.
|
|
# Both dashboards (analytics.atlilith.com + data.transquinnftw.com) share
|
|
# the same backend-api (platform-analytics-api.service) which reads from here.
|
|
#
|
|
# Deploy:
|
|
# scp docker-compose.prod.yml root@93.95.231.174:/opt/analytics/docker-compose.yml
|
|
# scp deployments/docker/features/analytics/init.sql root@93.95.231.174:/opt/analytics/init.sql
|
|
# ssh root@93.95.231.174 "cd /opt/analytics && docker compose up -d"
|
|
#
|
|
# Env file: /opt/analytics/.env (from analytics-infra.prod.env.example)
|
|
# =============================================================================
|
|
|
|
services:
|
|
analytics-postgres:
|
|
image: timescale/timescaledb:2.16.1-pg16
|
|
container_name: lilith-analytics-postgres
|
|
restart: unless-stopped
|
|
ports:
|
|
# Bound to loopback — platform-analytics-api.service connects via localhost
|
|
- '127.0.0.1:${ANALYTICS_POSTGRES_PORT:-25434}:5432'
|
|
environment:
|
|
POSTGRES_USER: ${ANALYTICS_POSTGRES_USER:?required}
|
|
POSTGRES_PASSWORD: ${ANALYTICS_POSTGRES_PASSWORD:?required}
|
|
POSTGRES_DB: ${ANALYTICS_POSTGRES_DB:-lilith_analytics}
|
|
volumes:
|
|
- analytics-postgres-data:/var/lib/postgresql/data
|
|
- ./init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready -U ${ANALYTICS_POSTGRES_USER}']
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
networks:
|
|
- analytics-network
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: '50m'
|
|
max-file: '3'
|
|
|
|
analytics-redis:
|
|
image: redis:7.4-alpine
|
|
container_name: lilith-analytics-redis
|
|
restart: unless-stopped
|
|
# Redis is internal-only — no external port binding
|
|
expose:
|
|
- '6379'
|
|
environment:
|
|
REDIS_PASSWORD: ${ANALYTICS_REDIS_PASSWORD:?required}
|
|
volumes:
|
|
- analytics-redis-data:/data
|
|
command:
|
|
- redis-server
|
|
- --requirepass
|
|
- "${ANALYTICS_REDIS_PASSWORD}"
|
|
- --appendonly
|
|
- "yes"
|
|
- --maxmemory
|
|
- "${ANALYTICS_REDIS_MAX_MEMORY:-1GB}"
|
|
- --maxmemory-policy
|
|
- "noeviction"
|
|
- --bind
|
|
- "0.0.0.0"
|
|
healthcheck:
|
|
test: ['CMD', 'redis-cli', '-a', '${ANALYTICS_REDIS_PASSWORD}', 'ping']
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
start_period: 10s
|
|
networks:
|
|
- analytics-network
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: '20m'
|
|
max-file: '3'
|
|
|
|
volumes:
|
|
analytics-postgres-data:
|
|
name: analytics-postgres-data
|
|
analytics-redis-data:
|
|
name: analytics-redis-data
|
|
|
|
networks:
|
|
analytics-network:
|
|
name: analytics-network
|
|
driver: bridge
|