DocCyblade / tkl-mayan-edms

Turnkey Linux - Mayan EDMS
https://www.turnkeylinux.org/mayan-edms
Other
4 stars 12 forks source link

Feature: add default upload folder #61

Closed DocCyblade closed 3 years ago

DocCyblade commented 7 years ago

Would be a good start to add a default upload folder and user so that it's easy to setup watch and stage folders. This would ensure permissions would be setup right.

DocCyblade commented 7 years ago

As this is a good idea, I am not going to implement this as of yet.

DocCyblade commented 7 years ago

For my own install at home, I will be using the watch folders. The issue is getting the data to the watch folder in a safe way, and ensure both the upload user and the www-data user has r/w to the uploaded files. There a few ways I can think of doing this

  1. Use a upload user in Linux and scp the files. Change the home dir for the upload user to the upload folder. Make sure the group is www-data and set the setgid so that the group ID is set for new folders. Need to make sure when uploading our UMASK is set to that owner and group has r/w
  2. Same as the above, except setup ACLs to keep permissions correct.
  3. Use SAMBA and ACL to host the dir
  4. Create a script/service can pull files from a upload folder into watch folders (ensures correct modes)
  5. Create Mayan/Django Plugin or find one as a starting point to upload files to specific folders

Not sure the best TKL way.

As for what I will do until this feature gets added if at all, I will be setting up folders on my mac file server, and using scheduled tasks running a script that will upload the files to the mayan server via transmit.

JedMeister commented 7 years ago

Here's another thought, not sure if it's a good one or not...!?

You could have a user accessible directory to upload files. Then have cron job that runs every minute or so that rsyncs from the upload directory to the "proper" watch folder. The rsync could ignore the permissions of the uploaded files (so they'd always just inherit the permissions of the directory they're rsynced into).

Assuming that the files are auto deleted from the watch folder once they're added to Mayan rsync could also clean up the upload directory too?!

Using rsync (instead of something else like mv or cp) would also mean that it would use minimal resources as is would only copy anything that has changed.

OTOH maybe a clunky way to do it if one of your suggestions works better...

DocCyblade commented 7 years ago

@JedMeister - I like the rsync idea, kinda of what I was thinking in number 4. I think I will proceed in that direction. I would like to create a service of sorts so it can be "started" or enabled/disabled.