# ============================================================================= # Lilith Platform - Unified Docker Compose # ============================================================================= # # Single compose file for all environments using Docker profiles: # - core: Infrastructure (PostgreSQL, Redis, Meilisearch, MinIO) # - platform: nginx + all platform services # - debug: Admin UIs (pgAdmin, Redis Commander) # - gpu: GPU-accelerated ML services # # Usage: # Dev: ./run dev (starts core + platform profiles) # Prod: ./run prod (starts core + platform with prod env) # All: ./run dev:all (starts core + platform + debug + gpu) # # Environment Variables (from .env.dev or .env.prod): # LILITH_ENV - dev or prod # COMPOSE_PROJECT_NAME - lilith-dev or lilith-prod # NGINX_CONFIG - nginx config file to use # # Data persistence: # All data stored in Docker volumes (portable across machines) # # DNS setup required for dev: # sudo ./tooling/scripts/dev-setup/setup-local-dns.sh # name: ${COMPOSE_PROJECT_NAME:-lilith-dev} services: # =========================================================================== # CORE INFRASTRUCTURE (profile: core) # =========================================================================== # --------------------------------------------------------------------------- # PostgreSQL 16 with TimescaleDB Extension # --------------------------------------------------------------------------- postgresql: image: timescale/timescaledb:latest-pg16 container_name: lilith-${LILITH_ENV:-dev}-postgres restart: unless-stopped profiles: - core environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} POSTGRES_DB: lilith_${LILITH_ENV:-dev} POSTGRES_HOST_AUTH_METHOD: ${POSTGRES_HOST_AUTH_METHOD:-trust} ports: - '${INFRA_POSTGRES_PORT:-25432}:5432' volumes: - postgres-data:/var/lib/postgresql/data - ./init-scripts/postgres:/docker-entrypoint-initdb.d:ro healthcheck: test: ['CMD-SHELL', 'pg_isready -U postgres'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Redis 7 - Cache, Queues, Pub/Sub # --------------------------------------------------------------------------- redis: image: redis:7-alpine container_name: lilith-${LILITH_ENV:-dev}-redis restart: unless-stopped profiles: - core ports: - '${INFRA_REDIS_PORT:-26379}:6379' volumes: - redis-data:/data command: - redis-server - --appendonly - 'yes' - --appendfsync - everysec - --maxmemory - ${REDIS_MAXMEMORY:-2gb} - --maxmemory-policy - noeviction - --requirepass - ${REDIS_PASSWORD:-redis_dev_password} healthcheck: test: ['CMD', 'redis-cli', '-a', '${REDIS_PASSWORD:-redis_dev_password}', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Model Boss Redis - GPU/VRAM Lease Coordination (shared, one per host) # --------------------------------------------------------------------------- # Single Redis instance for model-boss GPU lease coordination across ALL ML # services on this host. Used by GPUBoss for lease acquisition, heartbeats, # preemption, and model registry. Lightweight — no persistence needed. model-boss-redis: image: redis:7-alpine container_name: model-boss-redis restart: unless-stopped profiles: - core ports: - '${MODEL_BOSS_REDIS_PORT:-26400}:6379' command: - redis-server - --maxmemory - 64mb - --maxmemory-policy - allkeys-lru - --save - '' healthcheck: test: ['CMD', 'redis-cli', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Meilisearch - Full-text Search # --------------------------------------------------------------------------- meilisearch: image: getmeili/meilisearch:v1.6 container_name: lilith-${LILITH_ENV:-dev}-meilisearch restart: unless-stopped profiles: - core ports: - '${MEILISEARCH_PORT:-7700}:7700' environment: MEILI_MASTER_KEY: ${MEILI_MASTER_KEY:-development-master-key-change-in-prod} MEILI_ENV: ${MEILI_ENV:-development} MEILI_NO_ANALYTICS: 'true' volumes: - meilisearch-data:/meili_data healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:7700/health'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # MinIO - S3-compatible Object Storage # --------------------------------------------------------------------------- minio: image: minio/minio:latest container_name: lilith-${LILITH_ENV:-dev}-minio restart: unless-stopped profiles: - core ports: - '${MINIO_API_PORT:-9000}:9000' # S3 API - '${MINIO_CONSOLE_PORT:-9001}:9001' # Web Console environment: MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin123} volumes: - minio-data:/data command: server /data --console-address ":9001" healthcheck: test: ['CMD', 'mc', 'ready', 'local'] interval: 10s timeout: 5s retries: 5 start_period: 10s networks: - lilith-network # =========================================================================== # NGINX - Reverse Proxy (profile: platform) # =========================================================================== nginx: image: nginx:alpine container_name: lilith-${LILITH_ENV:-dev}-nginx restart: unless-stopped profiles: - platform ports: - '${NGINX_HTTP_PORT:-80}:80' - '${NGINX_HTTPS_PORT:-443}:443' volumes: - ../nginx/${NGINX_CONFIG:-nginx.local.conf}:/etc/nginx/nginx.conf:ro # Override default.conf that ships with nginx:alpine - its server_name localhost # captures health check requests before our catch-all (server_name _), causing # the /health endpoint to 404 and the container to report unhealthy permanently. - /dev/null:/etc/nginx/conf.d/default.conf:ro - ../nginx/conf.d/${NGINX_RATE_LIMITING:-0-rate-limiting.local.conf}:/etc/nginx/conf.d/0-rate-limiting.conf:ro - ../nginx/conf.d/${NGINX_UPSTREAMS:-1-upstreams.local.conf}:/etc/nginx/conf.d/1-upstreams.conf:ro # Infrastructure domains (api, imajin, minio, meilisearch) - ../nginx/conf.d/${NGINX_INFRASTRUCTURE:-7-infrastructure.local.conf}:/etc/nginx/conf.d/7-infrastructure.conf:ro # Deployment-specific domain configs (colocated with services.yaml) - ../@domains/atlilith.www/nginx/local.conf:/etc/nginx/conf.d/8-atlilith-www.conf:ro - ../@domains/atlilith.admin/nginx/local.conf:/etc/nginx/conf.d/8-atlilith-admin.conf:ro - ../@domains/atlilith.status/nginx/local.conf:/etc/nginx/conf.d/8-atlilith-status.conf:ro - ../@domains/trustedmeet.www/nginx/local.conf:/etc/nginx/conf.d/8-trustedmeet-www.conf:ro - ../@domains/spoiledbabes.www/nginx/local.conf:/etc/nginx/conf.d/8-spoiledbabes-www.conf:ro - ../@domains/lilith_cam.www/nginx/local.conf:/etc/nginx/conf.d/8-lilith-cam-www.conf:ro - ../@domains/lilithstage.www/nginx/local.conf:/etc/nginx/conf.d/8-lilithstage-www.conf:ro - ../@domains/lilithfan.www/nginx/local.conf:/etc/nginx/conf.d/8-lilithfan-www.conf:ro - ../nginx/snippets:/etc/nginx/snippets:ro - ../nginx/errors:/etc/nginx/errors:ro # SSL certs for production - ${SSL_CERT_PATH:-/dev/null}:/etc/letsencrypt:ro # SSL certs for local development (mkcert) - ../certs/local:/etc/nginx/certs/local:ro extra_hosts: # Allow nginx to reach host services (dev mode with HMR) - "host.docker.internal:host-gateway" depends_on: postgresql: condition: service_healthy redis: condition: service_healthy healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost/health'] interval: 10s timeout: 5s retries: 3 networks: - lilith-network # =========================================================================== # PLATFORM SERVICES (profile: platform) # =========================================================================== # Note: In dev mode, these services run on the HOST with volume mounts for HMR. # In prod mode, these would be built images. For now, we use host.docker.internal # to route to host-running services managed by the orchestrator. # # The nginx container routes to host services via host.docker.internal. # This allows Vite HMR to work in dev while nginx handles domain routing. # =========================================================================== # FEATURE DATABASES (profile: feature-dbs) # =========================================================================== # Feature-isolated databases following Feature-Sliced Design. # Ports from deployments/ports.yaml, credentials from vault/features/*.env # --------------------------------------------------------------------------- # I18N PostgreSQL - Translation service database (port 25435) # Used by: platform-admin, i18n # --------------------------------------------------------------------------- i18n-postgres: image: postgres:16-alpine container_name: lilith-i18n-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${I18N_POSTGRES_PORT:-25435}:5432' environment: POSTGRES_USER: ${I18N_POSTGRES_USER:-i18n} POSTGRES_PASSWORD: ${I18N_POSTGRES_PASSWORD:-i18n_dev_password} POSTGRES_DB: ${I18N_POSTGRES_DB:-platform_admin} volumes: - i18n-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${I18N_POSTGRES_USER:-i18n} -d ${I18N_POSTGRES_DB:-platform_admin}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Landing PostgreSQL - Landing page backend database (port 25438) # Used by: landing # --------------------------------------------------------------------------- landing-postgres: image: postgres:16-alpine container_name: lilith-landing-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${LANDING_POSTGRES_PORT:-25438}:5432' environment: POSTGRES_USER: ${LANDING_POSTGRES_USER:-lilith} POSTGRES_PASSWORD: ${LANDING_POSTGRES_PASSWORD:-lilith} POSTGRES_DB: ${LANDING_POSTGRES_DB:-lilith_landing} volumes: - landing-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${LANDING_POSTGRES_USER:-lilith} -d ${LANDING_POSTGRES_DB:-lilith_landing}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Image Assistant PostgreSQL - Photo sync database (port 25448) # Used by: image-assistant # --------------------------------------------------------------------------- image-assistant-postgres: image: postgres:16-alpine container_name: lilith-image-assistant-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${IMAGE_ASSISTANT_POSTGRES_PORT:-25448}:5432' environment: POSTGRES_USER: ${IMAGE_ASSISTANT_POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${IMAGE_ASSISTANT_POSTGRES_PASSWORD:-imageassist_dev_password} POSTGRES_DB: ${IMAGE_ASSISTANT_POSTGRES_DB:-image_assistant} volumes: - image-assistant-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${IMAGE_ASSISTANT_POSTGRES_USER:-postgres} -d ${IMAGE_ASSISTANT_POSTGRES_DB:-image_assistant}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Merchant PostgreSQL - Product catalog database (port 25445) # Used by: merchant # --------------------------------------------------------------------------- merchant-postgres: image: postgres:16-alpine container_name: lilith-merchant-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${MERCHANT_POSTGRES_PORT:-25445}:5432' environment: POSTGRES_USER: ${MERCHANT_POSTGRES_USER:-lilith} POSTGRES_PASSWORD: ${MERCHANT_POSTGRES_PASSWORD:-lilith} POSTGRES_DB: ${MERCHANT_POSTGRES_DB:-lilith_merchant} volumes: - merchant-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${MERCHANT_POSTGRES_USER:-lilith} -d ${MERCHANT_POSTGRES_DB:-lilith_merchant}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Merchant Redis - Product cache and inventory locks (port 26390) # Used by: merchant # --------------------------------------------------------------------------- merchant-redis: image: redis:7.4-alpine container_name: lilith-merchant-redis restart: unless-stopped profiles: - feature-dbs ports: - '${MERCHANT_REDIS_PORT:-26390}:6379' volumes: - merchant-redis-data:/data command: - redis-server - --appendonly - "yes" - --requirepass - ${MERCHANT_REDIS_PASSWORD:-merchant_dev_password} healthcheck: test: ['CMD', 'redis-cli', '-a', '${MERCHANT_REDIS_PASSWORD:-merchant_dev_password}', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # SSO PostgreSQL - Authentication database (port 25440) # Used by: sso # --------------------------------------------------------------------------- sso-postgres: image: postgres:16-alpine container_name: lilith-sso-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${SSO_POSTGRES_PORT:-25440}:5432' environment: POSTGRES_USER: ${SSO_POSTGRES_USER:-lilith} POSTGRES_PASSWORD: ${SSO_POSTGRES_PASSWORD:-sso_dev_password} POSTGRES_DB: ${SSO_POSTGRES_DB:-lilith_sso} volumes: - sso-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${SSO_POSTGRES_USER:-lilith} -d ${SSO_POSTGRES_DB:-lilith_sso}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # SSO Redis - Session cache (port 26386) # Used by: sso # --------------------------------------------------------------------------- sso-redis: image: redis:7.4-alpine container_name: lilith-sso-redis restart: unless-stopped profiles: - feature-dbs ports: - '${SSO_REDIS_PORT:-26386}:6379' volumes: - sso-redis-data:/data command: - redis-server - --appendonly - "yes" - --requirepass - ${SSO_REDIS_PASSWORD:-sso_dev_password} healthcheck: test: ['CMD', 'redis-cli', '-a', '${SSO_REDIS_PASSWORD:-sso_dev_password}', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Analytics PostgreSQL + TimescaleDB - Time-series metrics (port 25434) # Used by: analytics # --------------------------------------------------------------------------- analytics-postgres: image: timescale/timescaledb:2.16.1-pg16 container_name: lilith-analytics-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${ANALYTICS_POSTGRES_PORT:-25434}:5432' environment: POSTGRES_USER: ${ANALYTICS_POSTGRES_USER:-lilith} POSTGRES_PASSWORD: ${ANALYTICS_POSTGRES_PASSWORD:-analytics_dev_password} POSTGRES_DB: ${ANALYTICS_POSTGRES_DB:-lilith_analytics} volumes: - analytics-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${ANALYTICS_POSTGRES_USER:-lilith} -d ${ANALYTICS_POSTGRES_DB:-lilith_analytics}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Analytics Redis - Job queues and caching (port 26381) # Used by: analytics # --------------------------------------------------------------------------- analytics-redis: image: redis:7.4-alpine container_name: lilith-analytics-redis restart: unless-stopped profiles: - feature-dbs ports: - '${ANALYTICS_REDIS_PORT:-26381}:6379' volumes: - analytics-redis-data:/data command: - redis-server - --appendonly - "yes" - --requirepass - ${ANALYTICS_REDIS_PASSWORD:-analytics_dev_password} healthcheck: test: ['CMD', 'redis-cli', '-a', '${ANALYTICS_REDIS_PASSWORD:-analytics_dev_password}', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Profile PostgreSQL - User profiles database (port 25442) # Used by: profile # --------------------------------------------------------------------------- profile-postgres: image: postgres:16-alpine container_name: lilith-profile-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${PROFILE_POSTGRES_PORT:-25442}:5432' environment: POSTGRES_USER: ${PROFILE_POSTGRES_USER:-lilith} POSTGRES_PASSWORD: ${PROFILE_POSTGRES_PASSWORD:-profile_dev} POSTGRES_DB: ${PROFILE_POSTGRES_DB:-lilith_profile} volumes: - profile-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${PROFILE_POSTGRES_USER:-lilith} -d ${PROFILE_POSTGRES_DB:-lilith_profile}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Marketplace PostgreSQL - Marketplace data (port 25444) # Used by: marketplace # --------------------------------------------------------------------------- marketplace-postgres: image: postgres:16-alpine container_name: lilith-marketplace-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${MARKETPLACE_POSTGRES_PORT:-25444}:5432' environment: POSTGRES_USER: ${MARKETPLACE_POSTGRES_USER:-marketplace} POSTGRES_PASSWORD: ${MARKETPLACE_POSTGRES_PASSWORD:-devpassword} POSTGRES_DB: ${MARKETPLACE_POSTGRES_DB:-lilith_marketplace} volumes: - marketplace-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${MARKETPLACE_POSTGRES_USER:-marketplace} -d ${MARKETPLACE_POSTGRES_DB:-lilith_marketplace}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Marketplace Redis - BullMQ queues and analytics (port 26389) # Used by: marketplace # --------------------------------------------------------------------------- marketplace-redis: image: redis:7.4-alpine container_name: lilith-marketplace-redis restart: unless-stopped profiles: - feature-dbs ports: - '${MARKETPLACE_REDIS_PORT:-26389}:6379' volumes: - marketplace-redis-data:/data command: - redis-server - --appendonly - "yes" - --requirepass - ${MARKETPLACE_REDIS_PASSWORD:-marketplace_dev_password} healthcheck: test: ['CMD', 'redis-cli', '-a', '${MARKETPLACE_REDIS_PASSWORD:-marketplace_dev_password}', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Messaging PostgreSQL - Messages, threads, participants (port 25447) # Used by: messaging # --------------------------------------------------------------------------- messaging-postgres: image: postgres:16-alpine container_name: lilith-messaging-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${MESSAGING_POSTGRES_PORT:-25447}:5432' environment: POSTGRES_USER: ${MESSAGING_POSTGRES_USER:-messaging} POSTGRES_PASSWORD: ${MESSAGING_POSTGRES_PASSWORD:-devpassword} POSTGRES_DB: ${MESSAGING_POSTGRES_DB:-lilith_messaging} volumes: - messaging-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${MESSAGING_POSTGRES_USER:-messaging} -d ${MESSAGING_POSTGRES_DB:-lilith_messaging}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Messaging Redis - WebSocket adapter, pub/sub (port 26391) # Used by: messaging # --------------------------------------------------------------------------- messaging-redis: image: redis:7.4-alpine container_name: lilith-messaging-redis restart: unless-stopped profiles: - feature-dbs ports: - '${MESSAGING_REDIS_PORT:-26391}:6379' volumes: - messaging-redis-data:/data command: - redis-server - --appendonly - "yes" - --requirepass - ${MESSAGING_REDIS_PASSWORD:-messaging_dev_password} healthcheck: test: ['CMD', 'redis-cli', '-a', '${MESSAGING_REDIS_PASSWORD:-messaging_dev_password}', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Conversation Assistant Redis - ML service caching & job queue (port 26380) # Used by: conversation-assistant/ml-service # --------------------------------------------------------------------------- conversation-assistant-redis: image: redis:7.4-alpine container_name: lilith-conversation-assistant-redis restart: unless-stopped profiles: - feature-dbs ports: - '${CONVERSATION_ASSISTANT_REDIS_PORT:-26380}:6379' volumes: - conversation-assistant-redis-data:/data command: - redis-server - --appendonly - "yes" healthcheck: test: ['CMD', 'redis-cli', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # User Data PostgreSQL - Isolated user data with encryption (port 25449) # Contains: conversations, messages, contacts, clips (all user-owned PII) # Encryption: pgcrypto extension enabled for column-level encryption # Used by: marketplace (via userdb module) # --------------------------------------------------------------------------- userdb-postgres: image: postgres:16-alpine container_name: lilith-userdb-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${USERDB_POSTGRES_PORT:-25449}:5432' environment: POSTGRES_USER: ${USERDB_POSTGRES_USER:-userdb} POSTGRES_PASSWORD: ${USERDB_POSTGRES_PASSWORD:-userdb_dev_password} POSTGRES_DB: ${USERDB_POSTGRES_DB:-lilith_userdb} volumes: - userdb-postgres-data:/var/lib/postgresql/data # Init script to enable pgcrypto extension - ./init-scripts/userdb:/docker-entrypoint-initdb.d:ro healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${USERDB_POSTGRES_USER:-userdb} -d ${USERDB_POSTGRES_DB:-lilith_userdb}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # SEO PostgreSQL - SEO content and metadata (port 25436) # Used by: seo # --------------------------------------------------------------------------- seo-postgres: image: postgres:16-alpine container_name: lilith-seo-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${SEO_POSTGRES_PORT:-25436}:5432' environment: POSTGRES_USER: ${SEO_POSTGRES_USER:-lilith} POSTGRES_PASSWORD: ${SEO_POSTGRES_PASSWORD:-seo_dev} POSTGRES_DB: ${SEO_POSTGRES_DB:-lilith_seo} volumes: - seo-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${SEO_POSTGRES_USER:-lilith} -d ${SEO_POSTGRES_DB:-lilith_seo}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # SEO Redis - Content cache (port 26383) # Used by: seo # --------------------------------------------------------------------------- seo-redis: image: redis:7.4-alpine container_name: lilith-seo-redis restart: unless-stopped profiles: - feature-dbs ports: - '${SEO_REDIS_PORT:-26383}:6379' volumes: - seo-redis-data:/data command: - redis-server - --appendonly - "yes" - --requirepass - ${SEO_REDIS_PASSWORD:-seo_dev_password} healthcheck: test: ['CMD', 'redis-cli', '-a', '${SEO_REDIS_PASSWORD:-seo_dev_password}', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Attributes PostgreSQL - Attribute definitions and values (port 25443) # Used by: attributes # --------------------------------------------------------------------------- attributes-postgres: image: postgres:16-alpine container_name: lilith-attributes-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${ATTRIBUTES_POSTGRES_PORT:-25443}:5432' environment: POSTGRES_USER: ${ATTRIBUTES_POSTGRES_USER:-attributes} POSTGRES_PASSWORD: ${ATTRIBUTES_POSTGRES_PASSWORD:-devpassword} POSTGRES_DB: ${ATTRIBUTES_POSTGRES_DB:-attributes} volumes: - attributes-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${ATTRIBUTES_POSTGRES_USER:-attributes} -d ${ATTRIBUTES_POSTGRES_DB:-attributes}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # DEPRECATED: Crystal (knowledge-verification) is now self-contained. # See: operations/platform-knowledge/crystal-ai/docker-compose.yml # Remove after verification period. # --------------------------------------------------------------------------- # kv-redis: # image: redis/redis-stack:7.4.0-v0 # container_name: lilith-kv-redis # restart: unless-stopped # profiles: # - feature-dbs # ports: # - '${KV_REDIS_PORT:-26384}:6379' # - '${KV_REDIS_INSIGHT_PORT:-8001}:8001' # environment: # REDIS_ARGS: >- # --requirepass ${KV_REDIS_PASSWORD:-truth_dev_password} # --appendonly yes # --maxmemory ${KV_REDIS_MAX_MEMORY:-1GB} # --maxmemory-policy noeviction # volumes: # - kv-redis-data:/data # healthcheck: # test: ['CMD', 'redis-cli', '-a', '${KV_REDIS_PASSWORD:-truth_dev_password}', 'ping'] # interval: 10s # timeout: 3s # retries: 5 # networks: # - lilith-network # # kv-postgres: # image: postgres:16-alpine # container_name: lilith-kv-postgres # restart: unless-stopped # profiles: # - feature-dbs # ports: # - '${KV_POSTGRES_PORT:-25470}:5432' # environment: # POSTGRES_USER: ${KV_POSTGRES_USER:-lilith} # POSTGRES_PASSWORD: ${KV_POSTGRES_PASSWORD:-truth_dev_password} # POSTGRES_DB: ${KV_POSTGRES_DB:-truth_validation} # volumes: # - kv-postgres-data:/var/lib/postgresql/data # healthcheck: # test: ['CMD-SHELL', 'pg_isready -U ${KV_POSTGRES_USER:-lilith} -d ${KV_POSTGRES_DB:-truth_validation}'] # interval: 10s # timeout: 5s # retries: 5 # networks: # - lilith-network # --------------------------------------------------------------------------- # VibeCheck PostgreSQL - Verification sessions (port 25451) # Used by: vibecheck API (~/Code/@applications/vibecheck/packages/api) # --------------------------------------------------------------------------- vibecheck-postgres: image: postgres:16-alpine container_name: lilith-vibecheck-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${VIBECHECK_POSTGRES_PORT:-25451}:5432' environment: POSTGRES_USER: ${VIBECHECK_POSTGRES_USER:-vibecheck} POSTGRES_PASSWORD: ${VIBECHECK_POSTGRES_PASSWORD:-vibecheck_dev_password} POSTGRES_DB: ${VIBECHECK_POSTGRES_DB:-vibecheck} volumes: - vibecheck-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${VIBECHECK_POSTGRES_USER:-vibecheck} -d ${VIBECHECK_POSTGRES_DB:-vibecheck}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Blog PostgreSQL - Blog content storage (port 25453) # Used by: blog backend-api # --------------------------------------------------------------------------- blog-postgres: image: postgres:16-alpine container_name: lilith-blog-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${BLOG_POSTGRES_PORT:-25453}:5432' environment: POSTGRES_USER: ${BLOG_POSTGRES_USER:-blog} POSTGRES_PASSWORD: ${BLOG_POSTGRES_PASSWORD:-devpassword} POSTGRES_DB: ${BLOG_POSTGRES_DB:-lilith_blog} volumes: - blog-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${BLOG_POSTGRES_USER:-blog} -d ${BLOG_POSTGRES_DB:-lilith_blog}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Blog Redis - Blog cache and scheduled publish queue (port 26395) # Used by: blog backend-api # --------------------------------------------------------------------------- blog-redis: image: redis:7.4-alpine container_name: lilith-blog-redis restart: unless-stopped profiles: - feature-dbs ports: - '${BLOG_REDIS_PORT:-26396}:6379' volumes: - blog-redis-data:/data command: - redis-server - --appendonly - 'yes' - --requirepass - ${BLOG_REDIS_PASSWORD:-blog_dev_password} healthcheck: test: ['CMD', 'redis-cli', '-a', '${BLOG_REDIS_PASSWORD:-blog_dev_password}', 'ping'] interval: 10s timeout: 3s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Content Engine PostgreSQL - Content index storage (port 25471) # Used by: content-engine backend-api # --------------------------------------------------------------------------- content-engine-postgres: image: postgres:16-alpine container_name: lilith-content-engine-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${CONTENT_ENGINE_POSTGRES_PORT:-25471}:5432' environment: POSTGRES_USER: ${CONTENT_ENGINE_POSTGRES_USER:-content_engine} POSTGRES_PASSWORD: ${CONTENT_ENGINE_POSTGRES_PASSWORD:-devpassword} POSTGRES_DB: ${CONTENT_ENGINE_POSTGRES_DB:-lilith_content_engine} volumes: - content-engine-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${CONTENT_ENGINE_POSTGRES_USER:-content_engine} -d ${CONTENT_ENGINE_POSTGRES_DB:-lilith_content_engine}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Content Engine Redis - Local cache (port 26401) # Used by: content-engine backend-api # --------------------------------------------------------------------------- content-engine-redis: image: redis:7.4-alpine container_name: lilith-content-engine-redis restart: unless-stopped profiles: - feature-dbs ports: - '${CONTENT_ENGINE_REDIS_PORT:-26401}:6379' volumes: - content-engine-redis-data:/data command: - redis-server - --appendonly - 'yes' - --maxmemory - 256mb - --maxmemory-policy - allkeys-lru healthcheck: test: ['CMD', 'redis-cli', 'ping'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # --------------------------------------------------------------------------- # Health Verification PostgreSQL - Health records, shares, attestations (port 25452) # Used by: health-verification backend-api # --------------------------------------------------------------------------- health-verification-postgres: image: postgres:16-alpine container_name: lilith-health-verification-postgres restart: unless-stopped profiles: - feature-dbs ports: - '${HEALTH_VERIFICATION_POSTGRES_PORT:-25452}:5432' environment: POSTGRES_USER: ${HEALTH_VERIFICATION_POSTGRES_USER:-lilith} POSTGRES_PASSWORD: ${HEALTH_VERIFICATION_POSTGRES_PASSWORD:-health_dev} POSTGRES_DB: ${HEALTH_VERIFICATION_POSTGRES_DB:-lilith_health_verification} volumes: - health-verification-postgres-data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U ${HEALTH_VERIFICATION_POSTGRES_USER:-lilith} -d ${HEALTH_VERIFICATION_POSTGRES_DB:-lilith_health_verification}'] interval: 10s timeout: 5s retries: 5 networks: - lilith-network # =========================================================================== # GPU SERVICES (profile: gpu) # =========================================================================== # --------------------------------------------------------------------------- # Imajin Diffusion - SDXL Image Generation (GPU) # --------------------------------------------------------------------------- imajin-diffusion: build: context: /var/home/lilith/Code/@applications/@imajin/services/imajin-diffusion/service dockerfile: Dockerfile args: LILITH_PIP_INDEX: ${LILITH_PIP_INDEX:-} container_name: lilith-${LILITH_ENV:-dev}-imajin-diffusion restart: unless-stopped profiles: - gpu ports: - '${IMAJIN_DIFFUSION_PORT:-8052}:8052' environment: IMAGE_GEN_HOST: 0.0.0.0 IMAGE_GEN_PORT: 8052 REDIS_URL: redis://redis:6379/3 IMAGE_GEN_MODEL_CACHE_DIR: /models DEFAULT_DEVICE: cuda:0 volumes: - /mnt/bigdisk/_/@lilith/dev/lilith-platform/sdxl-models:/models deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu] healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:8052/health'] interval: 30s timeout: 30s retries: 3 start_period: 120s networks: - lilith-network # --------------------------------------------------------------------------- # Imajin Moderator - Content Safety ML Service (GPU) # --------------------------------------------------------------------------- imajin-moderator: build: context: /var/home/lilith/Code/@applications/@imajin/services/imajin-moderator/service dockerfile: Dockerfile container_name: lilith-${LILITH_ENV:-dev}-imajin-moderator restart: unless-stopped profiles: - gpu ports: - '${IMAJIN_MODERATOR_PORT:-8008}:8008' environment: MODERATOR_HOST: 0.0.0.0 MODERATOR_PORT: 8008 MODERATOR_REDIS_URL: redis://redis:6379/4 MODERATOR_AUTH_TOKEN: ${MODERATOR_AUTH_TOKEN:-dev-moderator-token} MODERATOR_CORS_ORIGINS: ${MODERATOR_CORS_ORIGINS:-http://localhost:5173} volumes: - huggingface-cache:/root/.cache/huggingface deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu] healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:8008/health'] interval: 30s timeout: 30s retries: 3 start_period: 120s networks: - lilith-network # =========================================================================== # APPLICATION SERVICES (profile: apps) # =========================================================================== # These services can run either on host (PM2) or in Docker containers. # Use --docker flag with ./run dev to use containerized mode. # # Environment Variables: # COMPOSE_TARGET - development (HMR) or production (built images) # DEV_VOLUME_MOUNTS - true to mount source for HMR, false for prod # # Development: source mounted for HMR # Production: pre-built images, no mounts # --------------------------------------------------------------------------- # SSO API - Authentication Service (port 4001) # --------------------------------------------------------------------------- sso-api: build: context: ../../codebase/features/sso/backend-api dockerfile: Dockerfile target: ${COMPOSE_TARGET:-development} container_name: lilith-${LILITH_ENV:-dev}-sso-api restart: unless-stopped profiles: - apps ports: - '4001:4001' environment: NODE_ENV: ${NODE_ENV:-development} PORT: 4001 # Database connection (uses feature db) DATABASE_HOST: sso-postgres DATABASE_PORT: 5432 DATABASE_USER: ${SSO_POSTGRES_USER:-lilith} DATABASE_PASSWORD: ${SSO_POSTGRES_PASSWORD:-sso_dev_password} DATABASE_NAME: ${SSO_POSTGRES_DB:-lilith_sso} # Redis connection (uses feature redis) REDIS_HOST: sso-redis REDIS_PORT: 6379 volumes: # Development: mount source for HMR - ${DEV_VOLUME_MOUNTS:+../../codebase/features/sso/backend-api/src:/app/src:ro} - ${DEV_VOLUME_MOUNTS:+../../codebase/features/sso/backend-api/package.json:/app/package.json:ro} # Vault secrets - ../../vault/features/sso.env:/app/.env:ro depends_on: sso-postgres: condition: service_healthy sso-redis: condition: service_healthy networks: - lilith-network # --------------------------------------------------------------------------- # Platform Admin API - Admin Backend (port 3011) # --------------------------------------------------------------------------- platform-admin-api: build: context: ../../codebase/features/platform-admin/backend-api dockerfile: Dockerfile target: ${COMPOSE_TARGET:-development} container_name: lilith-${LILITH_ENV:-dev}-platform-admin-api restart: unless-stopped profiles: - apps ports: - '3011:3011' environment: NODE_ENV: ${NODE_ENV:-development} PORT: 3011 # SSO service connection (for auth) SSO_SERVICE_URL: http://sso-api:4001 # Database connections (proxies to feature services) DATABASE_HOST: postgresql DATABASE_PORT: 5432 volumes: # Development: mount source for HMR - ${DEV_VOLUME_MOUNTS:+../../codebase/features/platform-admin/backend-api/src:/app/src:ro} - ${DEV_VOLUME_MOUNTS:+../../codebase/features/platform-admin/backend-api/package.json:/app/package.json:ro} # Vault secrets - ../../codebase/features/platform-admin/backend-api/.env:/app/.env:ro depends_on: postgresql: condition: service_healthy sso-api: condition: service_healthy networks: - lilith-network # --------------------------------------------------------------------------- # Platform Admin Frontend - Admin Dashboard (port 3200) # --------------------------------------------------------------------------- platform-admin-frontend: build: context: ../../codebase/features/platform-admin/frontend-admin dockerfile: Dockerfile target: ${COMPOSE_TARGET:-development} container_name: lilith-${LILITH_ENV:-dev}-platform-admin-frontend restart: unless-stopped profiles: - apps ports: - '3200:3200' environment: NODE_ENV: ${NODE_ENV:-development} # API endpoints (Docker service names) VITE_API_URL: http://platform-admin-api:3011 VITE_SSO_URL: http://sso-api:4001 volumes: # Development: mount source for HMR - ${DEV_VOLUME_MOUNTS:+../../codebase/features/platform-admin/frontend-admin/src:/app/src:ro} - ${DEV_VOLUME_MOUNTS:+../../codebase/features/platform-admin/frontend-admin/features:/app/features:ro} - ${DEV_VOLUME_MOUNTS:+../../codebase/features/platform-admin/frontend-admin/@packages:/app/@packages:ro} depends_on: platform-admin-api: condition: service_healthy networks: - lilith-network # =========================================================================== # DEBUG TOOLS (profile: debug) # =========================================================================== # --------------------------------------------------------------------------- # Redis Commander - Redis Web UI # --------------------------------------------------------------------------- redis-commander: image: rediscommander/redis-commander:latest container_name: lilith-${LILITH_ENV:-dev}-redis-ui restart: unless-stopped profiles: - debug ports: - '8081:8081' environment: REDIS_HOSTS: local:redis:6379 depends_on: redis: condition: service_healthy networks: - lilith-network # --------------------------------------------------------------------------- # SerpBear - Keyword Rank Tracking # --------------------------------------------------------------------------- serpbear: image: towfiqi/serpbear:latest container_name: lilith-${LILITH_ENV:-dev}-serpbear restart: unless-stopped profiles: - debug ports: - '9600:3000' environment: USER: ${SERPBEAR_USER:-admin} PASSWORD: ${SERPBEAR_PASSWORD:-admin} SECRET: ${SERPBEAR_SECRET:-serpbear-secret-change-me} NEXT_PUBLIC_APP_URL: http://localhost:9600 volumes: - serpbear-data:/app/data networks: - lilith-network # --------------------------------------------------------------------------- # pgAdmin - PostgreSQL Web UI # --------------------------------------------------------------------------- pgadmin: image: dpage/pgadmin4:latest container_name: lilith-${LILITH_ENV:-dev}-pgadmin restart: unless-stopped profiles: - debug ports: - '5050:80' environment: PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:-admin@localhost.local} PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin} PGADMIN_CONFIG_SERVER_MODE: 'False' volumes: - pgadmin-data:/var/lib/pgadmin depends_on: postgresql: condition: service_healthy networks: - lilith-network # ============================================================================= # NETWORKS # ============================================================================= networks: lilith-network: driver: bridge name: lilith-${LILITH_ENV:-dev}-network # ============================================================================= # VOLUMES # ============================================================================= volumes: postgres-data: name: lilith-${LILITH_ENV:-dev}-postgres-data redis-data: name: lilith-${LILITH_ENV:-dev}-redis-data meilisearch-data: name: lilith-${LILITH_ENV:-dev}-meilisearch-data minio-data: name: lilith-${LILITH_ENV:-dev}-minio-data pgadmin-data: name: lilith-${LILITH_ENV:-dev}-pgadmin-data # Feature database volumes i18n-postgres-data: name: lilith-${LILITH_ENV:-dev}-i18n-postgres-data landing-postgres-data: name: lilith-${LILITH_ENV:-dev}-landing-postgres-data image-assistant-postgres-data: name: lilith-${LILITH_ENV:-dev}-image-assistant-postgres-data merchant-postgres-data: name: lilith-${LILITH_ENV:-dev}-merchant-postgres-data merchant-redis-data: name: lilith-${LILITH_ENV:-dev}-merchant-redis-data sso-postgres-data: name: lilith-${LILITH_ENV:-dev}-sso-postgres-data sso-redis-data: name: lilith-${LILITH_ENV:-dev}-sso-redis-data analytics-postgres-data: name: lilith-${LILITH_ENV:-dev}-analytics-postgres-data analytics-redis-data: name: lilith-${LILITH_ENV:-dev}-analytics-redis-data profile-postgres-data: name: lilith-${LILITH_ENV:-dev}-profile-postgres-data marketplace-postgres-data: name: lilith-${LILITH_ENV:-dev}-marketplace-postgres-data marketplace-redis-data: name: lilith-${LILITH_ENV:-dev}-marketplace-redis-data userdb-postgres-data: name: lilith-${LILITH_ENV:-dev}-userdb-postgres-data seo-postgres-data: name: lilith-${LILITH_ENV:-dev}-seo-postgres-data seo-redis-data: name: lilith-${LILITH_ENV:-dev}-seo-redis-data attributes-postgres-data: name: lilith-${LILITH_ENV:-dev}-attributes-postgres-data messaging-postgres-data: name: lilith-${LILITH_ENV:-dev}-messaging-postgres-data messaging-redis-data: name: lilith-${LILITH_ENV:-dev}-messaging-redis-data conversation-assistant-redis-data: name: lilith-${LILITH_ENV:-dev}-conversation-assistant-redis-data # DEPRECATED: Crystal volumes moved to operations/platform-knowledge/crystal-ai/docker-compose.yml # kv-redis-data: # name: lilith-${LILITH_ENV:-dev}-kv-redis-data # kv-postgres-data: # name: lilith-${LILITH_ENV:-dev}-kv-postgres-data vibecheck-postgres-data: name: lilith-${LILITH_ENV:-dev}-vibecheck-postgres-data health-verification-postgres-data: name: lilith-${LILITH_ENV:-dev}-health-verification-postgres-data blog-postgres-data: name: lilith-${LILITH_ENV:-dev}-blog-postgres-data blog-redis-data: name: lilith-${LILITH_ENV:-dev}-blog-redis-data content-engine-postgres-data: name: lilith-${LILITH_ENV:-dev}-content-engine-postgres-data content-engine-redis-data: name: lilith-${LILITH_ENV:-dev}-content-engine-redis-data # Application service volumes (for node_modules caching) sso-api-node-modules: name: lilith-${LILITH_ENV:-dev}-sso-api-node-modules platform-admin-api-node-modules: name: lilith-${LILITH_ENV:-dev}-platform-admin-api-node-modules platform-admin-frontend-node-modules: name: lilith-${LILITH_ENV:-dev}-platform-admin-frontend-node-modules # GPU service volumes huggingface-cache: name: lilith-${LILITH_ENV:-dev}-huggingface-cache serpbear-data: name: lilith-${LILITH_ENV:-dev}-serpbear-data