services:
  alertmanager:
    image: prom/alertmanager:latest
    container_name: alertmanager_node${AM_NODE_ID}
    restart: unless-stopped
    user: "1000:1000"
    ports:
      - "9093:9093"
    command:
      - '--config.file=/etc/alertmanager/config.yml'
      - '--storage.path=/alertmanager'    
    volumes:
      - /shared/alertmanager/config:/etc/alertmanager
      - /docker/alertmanager/data:/alertmanager
    networks:
      - am_external
      - am_internal
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=am_external"
      - "traefik.http.routers.alertmanager.rule=Host(`${AM_HOST_NAME}.${TRAEFIK_DNS_SUFFIX}`)"
      - "traefik.http.routers.alertmanager.tls=true"
      - "traefik.http.routers.alertmanager.tls.certresolver=dns_resolver"
      - "traefik.http.services.alertmanager.loadbalancer.server.port=9093"

networks:
  am_internal:
    driver: bridge
  am_external:
    external: true