services:
  syncthing:
    image: syncthing/syncthing:latest
    container_name: syncthing
    hostname: agap
    restart: unless-stopped
    volumes:
      - /mnt/misc/syncthing/config:/var/syncthing/config
      - /mnt/misc/syncthing/data:/var/syncthing
    ports:
      - "127.0.0.1:8384:8384"   # web UI (proxied by Caddy)
      - "22000:22000/tcp"        # sync protocol TCP
      - "22000:22000/udp"        # sync protocol UDP
      - "21027:21027/udp"        # local discovery

  relay:
    image: syncthing/relaysrv:latest
    container_name: syncthing-relay
    restart: unless-stopped
    env_file: relay.env
    entrypoint: ["/bin/sh", "-c", "exec /bin/strelaysrv -listen=:22067 -status-srv=:22070 -pools= -token=$$RELAY_TOKEN"]
    volumes:
      - /mnt/misc/syncthing/relay-keys:/keys
    ports:
      - "22067:22067/tcp"   # relay protocol
      - "22070:22070/tcp"   # status/metrics
