# RetrySight 1.0.0 — generated from docker-compose.yml for prebuilt images.
# Uses dev-default credentials unless you set them in a .env file next to this one.
# Change them before exposing this stack to anyone else.
services:
  postgres:
    image: ghcr.io/arkaprava/retrysight-tier-3-integration/postgres:1.0.0
    container_name: retrysight-integration-postgres
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-agent_retry_integration}
      POSTGRES_USER: ${POSTGRES_USER:-retrysight_integration}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme-integration}
    ports:
      - "${POSTGRES_PORT:-5434}:5432"
    volumes:
      - tier_integration_pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U \"$$POSTGRES_USER\" -d \"$$POSTGRES_DB\""]
      interval: 5s
      timeout: 5s
      retries: 10

  clickhouse:
    image: clickhouse/clickhouse-server:24.8-alpine
    container_name: retrysight-integration-clickhouse
    environment:
      CLICKHOUSE_DB: ${CLICKHOUSE_DATABASE:-agent_retry_integration}
      CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
      CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-}
    ports:
      - "${CLICKHOUSE_HTTP_PORT:-8124}:8123"
      - "${CLICKHOUSE_NATIVE_PORT:-9001}:9000"
    volumes:
      - tier_integration_chdata:/var/lib/clickhouse
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8123/ping | grep -q Ok"]
      interval: 5s
      timeout: 5s
      retries: 10

  manager:
    image: ghcr.io/arkaprava/retrysight-tier-3-integration/manager:1.0.0
    container_name: retrysight-integration-manager
    environment:
      SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-docker,tier-integration}
      MANAGER_PORT: ${MANAGER_PORT:-28475}
      POSTGRES_HOST: postgres
      POSTGRES_PORT: 5432
      POSTGRES_DB: ${POSTGRES_DB:-agent_retry_integration}
      POSTGRES_USER: ${POSTGRES_USER:-retrysight_integration}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme-integration}
      JWT_SECRET: ${JWT_SECRET:-agent-retry-platform-dev-secret-key-32chars}
      CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:8084,http://localhost:28475}
      SECADMIN_EMAIL: ${SECADMIN_EMAIL:-secadmin@local}
      SECADMIN_PASSWORD: ${SECADMIN_PASSWORD:-changeme}
      SSO_SECRET_KEY: ${SSO_SECRET_KEY:-dev-sso-secret-encryption-key-32}
      SSO_CALLBACK_BASE_URL: ${SSO_CALLBACK_BASE_URL:-http://localhost:8084}
      SSO_MANAGER_BASE_URL: ${SSO_MANAGER_BASE_URL:-http://localhost:28475}
      AGENT_API_KEY: ${AGENT_API_KEY:-dev-agent-key}
      SECURITY_ALLOW_DEFAULT_SECRETS: ${SECURITY_ALLOW_DEFAULT_SECRETS:-true}
      CLICKHOUSE_ENABLED: ${CLICKHOUSE_ENABLED:-true}
      CLICKHOUSE_READ_ENABLED: ${CLICKHOUSE_READ_ENABLED:-true}
      CLICKHOUSE_URL: ${CLICKHOUSE_URL:-http://clickhouse:8123}
      CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
      CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-}
      CLICKHOUSE_DATABASE: ${CLICKHOUSE_DATABASE:-agent_retry_integration}
      OTEL_INGEST_ENABLED: ${OTEL_INGEST_ENABLED:-true}
      OTEL_COWORK_MAPPING_ENABLED: ${OTEL_COWORK_MAPPING_ENABLED:-true}
      MCP_TOKEN_EXPIRATION_DAYS: ${MCP_TOKEN_EXPIRATION_DAYS:-30}
      RETENTION_TASK_EVENTS_DAYS: ${RETENTION_TASK_EVENTS_DAYS:-90}
    ports:
      - "${MANAGER_PORT:-28475}:${MANAGER_PORT:-28475}"
    depends_on:
      postgres:
        condition: service_healthy
      clickhouse:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -fsS http://localhost:${MANAGER_PORT:-28475}/api/v1/auth/sso/status >/dev/null || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 12
      start_period: 90s

  frontend:
    image: ghcr.io/arkaprava/retrysight-tier-3-integration/frontend:1.0.0
    container_name: retrysight-integration-frontend
    environment:
      MANAGER_PORT: ${MANAGER_PORT:-28475}
    ports:
      - "${FRONTEND_PORT:-8084}:80"
    depends_on:
      manager:
        condition: service_healthy

volumes:
  tier_integration_pgdata:
  tier_integration_chdata:
  tier_integration_buffer:
