version: '3.9'
services:
  # Enhanced Blackbox monitoring for Vaultwarden
  vaultwarden-health-check:
    image: prom/blackbox-exporter:v0.24.0
    command:
      - --config.file=/etc/blackbox_exporter/blackbox.yml
    volumes:
      - ./vaultwarden-blackbox.yml:/etc/blackbox_exporter/blackbox.yml:ro
    networks:
      - monitoring-network
    ports:
      - "9116:9115"
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9115/-/healthy"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    deploy:
      resources:
        limits:
          memory: 128M
          cpus: '0.1'
        reservations:
          memory: 64M
          cpus: '0.05'
      placement:
        constraints:
          - node.role == manager

networks:
  monitoring-network:
    external: true
  caddy-public:
    external: true
