services:
  syncthing:
    extends:
      file: ${TEMPLATES_PATH}
      service: default
    image: syncthing/syncthing:2.0.16
    container_name: syncthing
    volumes:
      - ${EXTERNAL_STORAGE}/notes/Obsidian-sync:/var/syncthing-data/Obsidian-sync
      - ${EXTERNAL_STORAGE}/media/pictures/to-sort:/var/syncthing-data/picture-phone
      - ${INFRA_PATH}/syncthing/data:/var/syncthing
    ports:
      - 8384:8384 # Web UI
      - 22000:22000/tcp # TCP file transfers
      - 22000:22000/udp # QUIC file transfers
      - 21027:21027/udp # Receive local discovery broadcasts
    networks:
      - ip4net
      - ip6net
    labels:
      # Traefik
      - "traefik.enable=true"
      - "traefik.http.routers.syncthing.rule=Host(`syncthing.${LOCAL_DOMAIN}`)"
      - "traefik.http.routers.syncthing.entrypoints=https"
      - "traefik.http.routers.syncthing.tls=true"
      - "traefik.http.routers.syncthing.service=syncthing-svc"
      - "traefik.http.services.syncthing-svc.loadbalancer.server.port=8384"
