networks:
  local:
    external: true
    name: local

volumes:
  firebase-emulator-data:
    external: true
    name: firebase-emulator-data

services:
  eppcage:
    image: siga2-firebase-emulators:local
    restart: always
    environment:
      FIREBASE_PROJECT: gesproc2
      APP_PORT: 3000
      AZURE_OPENAI_KEY: local-dev-placeholder
      AZURE_OPENAI_ENDPOINT: https://eppcage-functions.numeria.com.br
      AZURE_OPENAI_DEPLOYMENT: local-dev-placeholder
      SEED_USER_EMAIL: admin@sefaz.rs.gov.br
      SEED_USER_PASSWORD: "123456"
      SEED_USER_NAME: Admin Teste
      SEED_USER_PROFILE: ep
    volumes:
      - firebase-emulator-data:/app/.firebase-emulator-data
    networks:
      - local
    deploy:
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          cpus: "2"
          memory: 4096M
      labels:
        - traefik.enable=true
        - traefik.docker.network=local
        - traefik.http.routers.eppcage.rule=Host(`eppcage.numeria.com.br`)
        - traefik.http.routers.eppcage.entrypoints=websecure
        - traefik.http.routers.eppcage.tls=true
        - traefik.http.routers.eppcage.tls.certresolver=letsencryptresolver
        - traefik.http.routers.eppcage.priority=100
        - traefik.http.services.eppcage.loadbalancer.server.port=3000
        - traefik.http.services.eppcage.loadbalancer.server.scheme=http

        - traefik.http.routers.eppcage-auth.rule=Host(`eppcage-auth.numeria.com.br`)
        - traefik.http.routers.eppcage-auth.entrypoints=websecure
        - traefik.http.routers.eppcage-auth.tls=true
        - traefik.http.routers.eppcage-auth.tls.certresolver=letsencryptresolver
        - traefik.http.services.eppcage-auth.loadbalancer.server.port=9099
        - traefik.http.services.eppcage-auth.loadbalancer.server.scheme=http

        - traefik.http.routers.eppcage-firestore.rule=Host(`eppcage-firestore.numeria.com.br`)
        - traefik.http.routers.eppcage-firestore.entrypoints=websecure
        - traefik.http.routers.eppcage-firestore.tls=true
        - traefik.http.routers.eppcage-firestore.tls.certresolver=letsencryptresolver
        - traefik.http.services.eppcage-firestore.loadbalancer.server.port=8080
        - traefik.http.services.eppcage-firestore.loadbalancer.server.scheme=http

        - traefik.http.routers.eppcage-functions.rule=Host(`eppcage-functions.numeria.com.br`)
        - traefik.http.routers.eppcage-functions.entrypoints=websecure
        - traefik.http.routers.eppcage-functions.tls=true
        - traefik.http.routers.eppcage-functions.tls.certresolver=letsencryptresolver
        - traefik.http.services.eppcage-functions.loadbalancer.server.port=5001
        - traefik.http.services.eppcage-functions.loadbalancer.server.scheme=http

        - traefik.http.routers.eppcage-storage.rule=Host(`eppcage-storage.numeria.com.br`)
        - traefik.http.routers.eppcage-storage.entrypoints=websecure
        - traefik.http.routers.eppcage-storage.tls=true
        - traefik.http.routers.eppcage-storage.tls.certresolver=letsencryptresolver
        - traefik.http.services.eppcage-storage.loadbalancer.server.port=9199
        - traefik.http.services.eppcage-storage.loadbalancer.server.scheme=http

        - traefik.http.routers.eppcage-ui.rule=Host(`eppcage-ui.numeria.com.br`)
        - traefik.http.routers.eppcage-ui.entrypoints=websecure
        - traefik.http.routers.eppcage-ui.tls=true
        - traefik.http.routers.eppcage-ui.tls.certresolver=letsencryptresolver
        - traefik.http.services.eppcage-ui.loadbalancer.server.port=4000
        - traefik.http.services.eppcage-ui.loadbalancer.server.scheme=http
