version: '3.8'

configs:
  nalu-appsettings:
    external: true

secrets:
  nalu_mongodb_connection:
    external: true
  nalu_groq_api_key:
    external: true
  nalu_openrouter_api_key:
    external: true
  nalu_googleai_api_key:
    external: true
  nalu_stripe_secret_key:
    external: true
  nalu_stripe_webhook_secret:
    external: true
  nalu_oauth_google_secret:
    external: true
  nalu_oauth_ms_secret:
    external: true
  nalu_oauth_github_secret:
    external: true

services:
  app:
    image: registry.redecarneir.us/nalu:latest
    networks:
      - nalu-net
    deploy:
      replicas: 2
      placement:
        max_replicas_per_node: 1
      update_config:
        parallelism: 1
        order: stop-first
        delay: 10s
        monitor: 60s
        failure_action: rollback
      rollback_config:
        parallelism: 0
        delay: 5s
    configs:
      - source: nalu-appsettings
        target: /app/appsettings.Production.json
        mode: 0444
    secrets:
      - nalu_mongodb_connection
      - nalu_groq_api_key
      - nalu_openrouter_api_key
      - nalu_googleai_api_key
      - nalu_stripe_secret_key
      - nalu_stripe_webhook_secret
      - nalu_oauth_google_secret
      - nalu_oauth_ms_secret
      - nalu_oauth_github_secret
    environment:
      ASPNETCORE_ENVIRONMENT: Production
      ASPNETCORE_URLS: http://+:8080
      ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    ports:
      - published: 8084
        target: 8080
        protocol: tcp
        mode: ingress

networks:
  nalu-net:
    external: true
