RealOrangeOne / docker-lsyncd

Docker container for lsyncd
https://hub.docker.com/r/theorangeone/lsyncd
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

lsyncd stops synchronizing after initial sync #19

Open malfroid opened 6 months ago

malfroid commented 6 months ago

Context: using docker-lsyncd to synchronize a folder on my home network NAS to a cloud VPS. After starting the docker, initial sync works without any problems.

Problem: after starting the docker, new files in the source folder are not synchronized to the target. Expected: after a delay of 15 seconds, new files start synchronizing to the target.

lsyncd.lua config:

sync {
  default.rsyncssh,
  source="/media/clips",
  host="my.domain.com",
  targetdir="/home/myuser/clips",
  delay = 15,
  rsync = {
    compress = true,
    whole_file = false
  },
  ssh = {
    port = 22,
    identityFile = "/config/.ssh/id_rsa",
    options = {
      UserKnownHostsFile = "/config/.ssh/known_hosts"
    },
    _extra = { "--F /config/.ssh/config" }
  }
}

Docker logs: _lsyncd-frigate_logs.txt

(redacted my actual domain and username)

RealOrangeOne commented 6 months ago

How are your directories mounted into the container - it's possible lsyncd isn't picking up that there are any changes.

If you make a change to a watched file, try checking inside the container whether the change is reflected.

malfroid commented 6 months ago

My source directory is a CIFS mounted network share on the docker host. It is passed to the lsyncd container via a volume. My docker compose configuration looks like the below:

services:
  lsyncd-frigate:
    container_name: lsyncd-frigate
    image: theorangeone/lsyncd
    volumes:
      - "/mnt/nas-recordings/lsyncd-config/lsyncd.lua:/config/lsyncd.lua"
      - "/mnt/nas-recordings/clips:/media/clips"
      - "/mnt/nas-keys/id_rsa:/config/.ssh/id_rsa"
      - "/mnt/nas-keys/id_rsa.pub:/config/.ssh/id_rsa.pub"
      - "/mnt/nas-keys/known_hosts:/config/.ssh/known_hosts"
      - "/mnt/nas-keys/config:/config/.ssh/config"
    environment:
      - TZ
    networks:
      - bridge_kasper
    restart: always

networks:
  bridge_kasper:
    external: true

I ran the following inside the container to look at number of files in the source container:

$ ls /media/clips/ | wc -l
443

On the target, I count only 358 files.

After restarting the lsyncd-frigate container, the initial sync when the container starts brings the target folder to 443 files.

Some additional context: the Frigate network video recorder software creates new image files in the clips folder on my local NAS in my home network. I would like to sync these images to a folder on my cloud VPS.