
services:
  wud:
    image: getwud/wud
    container_name: wud-node${WUD_NODE_ID}
    # old? user: "1000:994"
    cpus: 1.0
    mem_limit: "1024m"
    mem_reservation: "256m"
    restart: unless-stopped
    ports:
      - 1000:3000
    networks:
      - wud_external
      - wud_internal
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /shared/wud/etc:/etc/wud
      - /shared/wud/var:/var/lib/wud
    environment:
      - TZ=America/Edmonton
      - WUD_LOG_LEVEL=INFO
      - WUD_TRIGGER_SMTP_EMAIL_SIMPLETITLE="Updates for ${HOSTNAME} - New ${kind} found for ${name}"
      - WUD_WATCHER_LOCAL_SOCKET=/var/run/docker.sock

      - WUD_AUTOUPDATE=${WUD_AUTOUPDATE}
      - WUD_WATCHER_LOCAL_WATCHBYDEFAULT=${WUD_WATCH}

      - WUD_REGISTRY_LSCR_PRIVATE_USERNAME=${WUD_LSCR_USER}
      - WUD_REGISTRY_LSCR_PRIVATE_TOKEN=${WUD_GITHUB_TOKEN}
      - WUD_REGISTRY_GHCR_PRIVATE_USERNAME=${WUD_GITHUB_USER}
      - WUD_REGISTRY_GHCR_PRIVATE_TOKEN=${WUD_GITHUB_TOKEN}
      - WUD_REGISTRY_HUB_PUBLIC_LOGIN=${WUD_DOCKERHUB_USERNAME}
      - WUD_REGISTRY_HUB_PUBLIC_TOKEN=${WUD_DOCKERHUB_TOKEN}
      - WUD_REGISTRY_CUSTOM_CODEBERG_URL=https://codeberg.org
      - WUD_REGISTRY_CUSTOM_CODEBERG_LOGIN=${WUD_CODEBERG_USERNAME}
      - WUD_REGISTRY_CUSTOM_CODEBERG_PASSWORD=${WUD_CODEBERG_TOKEN}

      - WUD_TRIGGER_SMTP_EMAIL_FROM=wud@mapletree.email
      - WUD_TRIGGER_SMTP_EMAIL_TO=${WUD_SMTP_TO}
      - WUD_TRIGGER_SMTP_EMAIL_HOST=172.16.201.12
      - WUD_TRIGGER_SMTP_EMAIL_PORT=2525
      - WUD_TRIGGER_SMTP_EMAIL_TLS_ENABLED=${WUD_SMTP_TLS}
      - WUD_TRIGGER_SMTP_EMAIL_TLS_VERIFY=${WUD_SMTP_TLS_VER}
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=wud_external"
      
      # Router
      - "traefik.http.routers.wud.rule=Host(`${WUD_HOSTNAME}.${TRAEFIK_DNS_SUFFIX}`)"
      - "traefik.http.routers.wud.entrypoints=websecure"
      - "traefik.http.routers.wud.tls=true"
      - "traefik.http.routers.wud.tls.certresolver=dns_resolver"
      
      # Service
      - "traefik.http.services.wud.loadbalancer.server.port=3000"

networks:
  wud_internal:
    driver: bridge
  wud_external:
    external: true

