Gronis / docker-seafile-client

Run a seafile client inside docker which can sync files from seafile repositories
MIT License
18 stars 12 forks source link

Syncing only works one way on Synology NAS #12

Closed andrekrit closed 2 years ago

andrekrit commented 2 years ago

Any idea what's going on? Syncing only works from Seafile to NAS, but not from NAS to Seafile. In other words, uploading does not work. I see the following errors in the log.

sync-mgr.c(580): Repo 'Documents' sync state transition from  'synchronized' to 'committing'.                                                
repo-mgr.c(2221): Failed to stat myfile.odt.part:  No such file or directory.                                                     
cdc.c(239): CDC: failed to open /ds-data/Documents/myfile.odt.                                                                   
 ../common/fs-mgr.c(906): Failed to chunk file with CDC.     
repo-mgr.c(1277): Failed to index file /ds-data/Documents/myfile.odt.                                                            
repo-mgr.c(3946): All events are processed for repo xxx.                                                   
sync-mgr.c(573): Repo 'Documents' sync is finished but with error: Error when indexing                                                      
sync-mgr.c(580): Repo 'Documents' sync state transition from  'committing' to 'error'.                

Syncing (one-way) continues after this, but there is no retry of this failed upload. I've tried with different files, even from within the Docker container. The NAS created files are always displayed on the NAS, but they're never uploaded to Seafile.

andrekrit commented 2 years ago

Ok, after posting the error, I realized that it might be a permissions issue and did an experiment. In the container, I created a test file while logged in as the seafile user. The uploaded then worked as expected. What would your recommendation be for modifying rights / perms on the NAS so that files created are accessible by the seafile process?

Gronis commented 2 years ago

Hi @andrekrit, thanks for reporting!

You can set SEAFILE_UID and SEAFILE_GID environment variables to make sure seafile client is using a specific user id and group id. That way, you can choose the same user id and group id as the owner of the files you like to sync.

Hope this helps.

andrekrit commented 2 years ago

Thanks for the quick response, much appreciated. Glad to see that I was heading in the right direction. Eventually I had to use the uid and gid of an admin account to get it working. Using the id's of the (normal) user to which the directory belongs to which seafile writes, didn't work.