Configuración de Syncthing con docker-compose usando Traefik como reverse proxy con autenticación básica HTTP

Esta configuración usa una instalación de syncthing basada en docker-compose y Traefik como reverse proxy. Se usa autenticación básica HTTP para prevenir el acceso no autorizado a la interfaz web de syncthing. Alternativamente, puedes usar la protección por contraseña integrada.

Ver Configuración simple de docker-compose de Traefik con Lets Encrypt Cloudflare DNS-01 y TLS-ALPN-01 y HTTP-01 challenges para mi configuración HTTPS para Traefik.

docker-compose.syncthing.yml
services:
  syncthing:
    image: syncthing/syncthing
    hostname: Syncthing-Myserver
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - ./syncthing_data:/var/syncthing
    ports: # NOTA: 8384 no se reenvía, esto lo maneja traefik
      - "22000:22000"
      - "21027:21027/udp"
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.syncthing.rule=Host(`syncthing.myserver.net`)"
      - "traefik.http.routers.syncthing.entrypoints=websecure"
      - "traefik.http.routers.syncthing.tls.certresolver=cloudflare"
      - "traefik.http.routers.syncthing.tls.domains[0].main=myserver.net"
      - "traefik.http.routers.syncthing.tls.domains[0].sans=*.myserver.net"
      - "traefik.http.services.syncthing.loadbalancer.server.port=8384"
      - "traefik.http.routers.syncthing.middlewares=syncthing-auth"
      # Auth (esto se comparte con el servidor). NOTA: genera con "htpasswd -n admin" y REEMPLAZA CADA "$" por "$$" EN LA SALIDA!
      - "traefik.http.middlewares.syncthing-auth.basicauth.users=admin:$$apr1$$ehr8oqEZ$$tHoOVLG19oHdUe81IeePo1
"

Echa un vistazo a artículos similares por categoría: Docker Traefik