services:
  rmaps-sync:
    build: .
    container_name: rmaps-sync
    restart: unless-stopped
    environment:
      - PORT=3001
      # VAPID keys for push notifications
      - VAPID_PUBLIC_KEY=BNWACJudUOeHEZKEFB-0Wz086nHYsWzj12LqQ7lsUNT38ThtNUoZTJYEH9lttQitCROE2G3Ob71ZUww47yvCDbk
      - VAPID_PRIVATE_KEY=${VAPID_PRIVATE_KEY:-x3yCse1Q4rbZ1XLgnJ1KpSuRlw2ccHDW0fMcKtQ1qcw}
      - VAPID_SUBJECT=mailto:push@rmaps.online
      # Automatic location request interval (ms) - 0 to disable
      - LOCATION_REQUEST_INTERVAL=60000
    labels:
      - "traefik.enable=true"
      # HTTP router (redirects to HTTPS via Cloudflare)
      - "traefik.http.routers.rmaps-sync.rule=Host(`sync.rmaps.online`)"
      - "traefik.http.routers.rmaps-sync.entrypoints=web"
      - "traefik.http.services.rmaps-sync.loadbalancer.server.port=3001"
    networks:
      - traefik-public
    healthcheck:
      test: ["CMD", "wget", "-q", "--spider", "http://localhost:3001/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

networks:
  traefik-public:
    external: true
