version: "3.9" networks: soma_network: driver: bridge volumes: postgres_data: redis_data: ollama_data: chroma_data: uploads_data: services: nginx: image: nginx:alpine restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx/ssl:/etc/nginx/ssl:ro - /etc/letsencrypt:/etc/letsencrypt:ro depends_on: frontend: condition: service_started backend: condition: service_healthy networks: - soma_network frontend: build: context: ./frontend dockerfile: Dockerfile restart: unless-stopped environment: - NEXTAUTH_SECRET=${NEXTAUTH_SECRET} - NEXTAUTH_URL=${NEXTAUTH_URL} - BACKEND_URL=http://backend:8000 - NEXT_PUBLIC_API_URL=/api/v1 depends_on: backend: condition: service_healthy networks: - soma_network backend: build: context: ./backend dockerfile: Dockerfile restart: unless-stopped environment: - DATABASE_URL=${DATABASE_URL} - REDIS_URL=${REDIS_URL} - JWT_SECRET=${JWT_SECRET} - OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://ollama:11434} - OLLAMA_MODEL=${OLLAMA_MODEL:-phi3:mini} - GEMINI_API_KEY=${GEMINI_API_KEY} - PERPLEXITY_API_KEY=${PERPLEXITY_API_KEY} - GROQ_API_KEY=${GROQ_API_KEY} - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} - AWS_REGION=${AWS_REGION:-ap-south-1} - SES_FROM_EMAIL=${SES_FROM_EMAIL} - REPORT_TO_EMAIL=${REPORT_TO_EMAIL} - ALLOW_REGISTRATION=${ALLOW_REGISTRATION:-true} - LOGIN_RATE_LIMIT_ATTEMPTS=${LOGIN_RATE_LIMIT_ATTEMPTS:-5} - LOGIN_RATE_LIMIT_WINDOW=${LOGIN_RATE_LIMIT_WINDOW:-900} - SOMA_CONFIG_PATH=/app/config.yaml volumes: - ./config.yaml:/app/config.yaml:ro - uploads_data:/app/uploads depends_on: postgres: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s networks: - soma_network postgres: image: postgres:15-alpine restart: unless-stopped environment: - POSTGRES_USER=${POSTGRES_USER:-soma} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-somapass} - POSTGRES_DB=${POSTGRES_DB:-somadb} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-soma} -d ${POSTGRES_DB:-somadb}"] interval: 10s timeout: 5s retries: 5 start_period: 10s networks: - soma_network redis: image: redis:7-alpine restart: unless-stopped command: redis-server --appendonly yes --maxmemory 128mb --maxmemory-policy allkeys-lru volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 networks: - soma_network ollama: image: ollama/ollama restart: unless-stopped volumes: - ollama_data:/root/.ollama environment: - OLLAMA_HOST=0.0.0.0 healthcheck: test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"] interval: 30s timeout: 10s retries: 5 start_period: 60s networks: - soma_network chromadb: image: chromadb/chroma restart: unless-stopped volumes: - chroma_data:/chroma/.chroma/index environment: - IS_PERSISTENT=TRUE - ANONYMIZED_TELEMETRY=FALSE healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/heartbeat"] interval: 30s timeout: 10s retries: 3 start_period: 30s networks: - soma_network