version: "3.7"
services:
  resilio-sync:
    image: lscr.io/linuxserver/resilio-sync:2.8.0
    container_name: resilio-sync
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - ${APP_DATA_DIR}/data/config:/config
      - ${APP_DATA_DIR}/data/downloads:/downloads
      - ${APP_DATA_DIR}/data/sync:/sync
    ports:
      - ${APP_PORT}:8888
      - 55555:55555
    restart: unless-stopped
    networks:
      - tipi_main_network
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.resilio-sync-web-redirect.redirectscheme.scheme: https
      traefik.http.services.resilio-sync.loadbalancer.server.port: 8888
      # Web
      traefik.http.routers.resilio-sync-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.resilio-sync-insecure.entrypoints: web
      traefik.http.routers.resilio-sync-insecure.service: resilio-sync
      traefik.http.routers.resilio-sync-insecure.middlewares: resilio-sync-web-redirect
      # Websecure
      traefik.http.routers.resilio-sync.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.resilio-sync.entrypoints: websecure
      traefik.http.routers.resilio-sync.service: resilio-sync
      traefik.http.routers.resilio-sync.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.resilio-sync-local-insecure.rule: Host(`resilio-sync.${LOCAL_DOMAIN}`)
      traefik.http.routers.resilio-sync-local-insecure.entrypoints: web
      traefik.http.routers.resilio-sync-local-insecure.service: resilio-sync
      traefik.http.routers.resilio-sync-local-insecure.middlewares: resilio-sync-web-redirect
      # Local domain secure
      traefik.http.routers.resilio-sync-local.rule: Host(`resilio-sync.${LOCAL_DOMAIN}`)
      traefik.http.routers.resilio-sync-local.entrypoints: websecure
      traefik.http.routers.resilio-sync-local.service: resilio-sync
      traefik.http.routers.resilio-sync-local.tls: true
