kelinger / OmniStream

Deployment and management tools for an entire streaming platform that can reside on a server (local, remote, hosted, VPS) with media files stored on cloud services like Google Drive or Dropbox.
MIT License
33 stars 10 forks source link

Moving from google drive to local NAS with NFS share #70

Open mahogl opened 1 year ago

mahogl commented 1 year ago

Since google killed the unlimited storage plan, i have now moved my media library to a local NAS solution running Truenas Scale. But i have been so happy with OmniStream that would love to continue to use it locally.

I have installed at Debian linux machine that would be hosting Omnistream, but i have run into a problem when i try to mount my nfs share into the rclone.

rclone.conf [glocal] type = alias remote = /data/solsky/

plexsus@roger:/data/solsky$ df -h 192.168.1.100:/mnt/tank/data/solsky 72T 40T 32T 56% /data/solsky /data/solsky 16E 0 16E 0% /home/plexsus/OmniStream/mnt/glocal uploadcache:unsynced:glocal 1.1P 61G 1.1P 1% /home/plexsus/OmniStream/mnt/cloud

plexsus@roger:/data/solsky$ rclone lsd glocal: -1 2023-09-18 20:38:59 -1 media

But the folder "/home/plexsus/OmniStream/mnt/glocal" is for some reason empty, but if i look in the local mount "/data/solsky" i see the media folder. And also in omni menu when i configure rclone and media directory it does find the directory.

What i think is the problem is some kind of permission issue, i have changed the user "plexsus" uid/grp to 3000 to match what i have configured in Truenas. and on the local mount i can read/write files without problem.

From what i read in another case you have migrated to a local NAS aswell @kelinger, so when you have the time i would realy apricate if you could share some of your experience on how to move from cloud storage to local storage with Omnistream. I think that would help alot other user also, since many are moving from cloud to local storage at the moment.

Thanks again for the excellent work you do with Omnistream

Best Regards, Marius

kelinger commented 1 year ago

Yes, like you, I migrated to a local NAS (Synology in my case). I also found that NFS was more complicated than it should be. For one, Rclone doesn't natively support NFS (which would have been the ultimate solution). I mounted the NFS share to the host running OmniStream and then used aliases and local definitions but this really made OmniStream more unwieldy. This also meant that I would have to make a lot of changes to OmniStream and the menus to truly support this. Docker also doesn't work well (in my opinion) with volumes that come from other mounts as Docker ends up passing the empty folder that was created FOR the mount, not the mount itself. I had to get around this with OmniMount but that required using some Docker magic.

So, to make sure this doesn't become a huge response, the short answer is: i got it working with OmniStream using SMB instead of NFS.

If your media is shared as SMB as well as NFS, you can create two entries in your Rclone config like I did:

[SynologySMB]
type = smb
host = 192.168.1.21
user = kelinger
pass = <removed>
idle_timeout = 0s

[OmniSynology]
type = alias
remote = SynologySMB:OmniStream

The "SynologySMB" entry defines the connection to the NAS while the "OmniSynology" alias is what I'm configuring in OmniStream as my remote. Note that the line remote = SynologySMB:OmniStream tells Rclone to use that SMB connection to the Synology and the name of the share on Synology is "OmniStream" (since you likely have other things shared on your NAS).

This got me up and running and allowed OmniStream to function the same as the cloud (Google) storage option. Of course, it was faster.

Unfortunately, this had one side effect: updates that occur outside of the mount (such as if you add or change files outside of OmniStream or the TurboSync process itself, which is kind of essential to the whole setup) they aren't reflected back to the mount for up to 96 hours. Google sent us a notification when changes occurred; SMB did not. So, the one last thing you need to do is add this line to vfs.conf inside the "omnimount" config directory: DIRCACHE=10s

This will override the default setting.

Now, even better news: I'm about 90% complete with a new OmniMount that will natively support NFS. The changes to OmniStream are finished and already posted and there are three new variables added to the OmniStream configs that manage this process. What will happen is that it will override the mount process so that it is mounted using native Linux NFS instead of Rclone but then it still uses the overlay process for managing the downloads and changes with a delayed sync back to the NAS every 15 minutes (like it is today with Google or whomever else you may have used).

These variables don't do anything yet on the published versions of OmniStream and OmniMount but the actual process is in a testing phase right now. This means I should be able to release it in the next couple days.

mahogl commented 1 year ago

Thank you so much for the info, i will test it out with SMB configuration.

The new version with nfs support looks very promising. Let me know when it is ready for testing and i will test it out.

Once again thank you for the good development of OmniStream

mahogl commented 1 year ago

Have it up and running with SMB now, works just like it did with Google Drive. Let med know when you want me to test out the new NFS functionality.

Thanks again for the guidance to get in the right direction

kelinger commented 1 year ago

@mahogl

Run omni edit and set values for these three variables (if they do not exist in your config file, then update everything first as this would indicate you're using the older version). Note that my values are shown here:

############################
#      NFS OVERRIDES       #
############################

USENFS=true
NFSREMOTE=192.168.1.21:/volume1/OmniStream
NFSLOCAL=nfs

USENFS=true will tell OmniMount to NOT use Rclone for mounting but, instead, use the native NFS driver. NFSREMOTE= sets the server and share for the NFS volume. The IP address is that of my Synology NAS while the path after the colon is where my files are stored. NFSLOCAL=nfs is just telling OmniMount where to create the mount (I creatively call mine "nfs").

Note that this still uses MergerFS to create the .../mnt/cloud directory. So, if you only make the above changes, everything else should remain unchanged. You don't really need to ever access the .../mnt/nfs directory nor add it to any containers since the true volume being used is still the cloud one.

I'd suggest making these changes after an omni down so that you can make sure you bring up a clean system with the right shares.

mahogl commented 1 year ago

Tried to get it to work, but for some reason it will not mount the nfs share, if i do it outside of omnimount it works as i should.

Here are the output from the omnimount log: rclone v1.64.0 omnimount | - os/version: debian 12.1 (64 bit) omnimount | - os/kernel: 6.1.0-12-amd64 (x86_64) omnimount | - os/type: linux omnimount | - os/arch: amd64 omnimount | - go/version: go1.21.1 omnimount | - go/linking: static omnimount | - go/tags: none omnimount | omnimount | mergerfs v2.37.1 omnimount | omnimount | https://github.com/trapexit/mergerfs omnimount | https://github.com/trapexit/support omnimount | omnimount | ISC License (ISC) omnimount | omnimount | Copyright 2023, Antonio SJ Musumeci trapexit@spawn.link omnimount | omnimount | Permission to use, copy, modify, and/or distribute this software for omnimount | any purpose with or without fee is hereby granted, provided that the omnimount | above copyright notice and this permission notice appear in all omnimount | copies. omnimount | omnimount | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL omnimount | WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED omnimount | WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE omnimount | AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL omnimount | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR omnimount | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER omnimount | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR omnimount | PERFORMANCE OF THIS SOFTWARE. omnimount | omnimount | omnimount | Starting vnstat omnimount | No interfaces found in database, adding available interfaces... omnimount | Interface "eth0" added with 10000 Mbit bandwidth limit. omnimount | -> 1 new interface found. omnimount | Limits can be modified using the configuration file. See "man vnstat.conf". omnimount | Unwanted interfaces can be removed from monitoring with "vnstat --remove". omnimount | omnimount | Configuration: omnimount | MERGEMOUNT=cloud omnimount | RCLONESERVICE=OmniTruenas omnimount | RCLONEMOUNT=OmniTruenas omnimount | UNSYNCED=unsynced omnimount | UPLOADCACHE=uploadcache omnimount | USENFS=true omnimount | NFSREMOTE=192.168.1.100:/mnt/tank/data/test omnimount | NFSLOCAL=nfs omnimount | MEDIA=media omnimount | TURBOMAX=20 omnimount | LOCAL=nfs omnimount | Adding group omniuser' (GID 3000) ... omnimount | Done. omnimount | Adding useromniuser' ... omnimount | Adding new user omniuser' (3000) with groupomniuser (3000)' ... omnimount | Creating home directory /home/omniuser' ... omnimount | Copying files from/etc/skel' ... omnimount | Adding new user omniuser' to supplemental / extra groupsusers' ... omnimount | Adding user omniuser' to groupusers' ... omnimount | Cleaning up leftovers omnimount | Starting services omnimount | VFSMAX=100G omnimount | VFSAGE=48h omnimount | VFSPOLL=5m omnimount | VFSREAD=2G omnimount | VFSCACHE=yes omnimount | DIRCACHE=10s omnimount | NFS enabled omnimount | rmdir: failed to remove '/mnt/OmniTruenas': No such file or directory omnimount | mount.nfs: rpc.statd is not running but is required for remote locking. omnimount | mount.nfs: Either use '-o nolock' to keep locks local, or start statd. omnimount | mount.nfs: Protocol not supported omnimount | touch: cannot touch '/mnt/nfs/media/omnimounted': No such file or directory omnimount | Mounter failed omnimount exited with code 0

It does complain about rpc.statd but it is running: plexsus@roger:/$ sudo systemctl status rpc-statd ● rpc-statd.service - NFS status monitor for NFSv2/3 locking. Loaded: loaded (/lib/systemd/system/rpc-statd.service; enabled-runtime; preset: enabled) Active: active (running) since Sun 2023-09-24 18:05:10 CEST; 16s ago Process: 56830 ExecStart=/sbin/rpc.statd (code=exited, status=0/SUCCESS) Main PID: 56831 (rpc.statd) Tasks: 1 (limit: 23939) Memory: 496.0K CPU: 5ms CGroup: /system.slice/rpc-statd.service └─56831 /sbin/rpc.statd

Sep 24 18:05:10 roger systemd[1]: Starting rpc-statd.service - NFS status monitor for NFSv2/3 locking.... Sep 24 18:05:10 roger rpc.statd[56831]: Version 2.6.2 starting Sep 24 18:05:10 roger rpc.statd[56831]: Flags: TI-RPC Sep 24 18:05:10 roger systemd[1]: Started rpc-statd.service - NFS status monitor for NFSv2/3 locking..

mahogl commented 1 year ago

I had some more time to troubleshoot the problem today, and i think i figured out a couple of things. Enabling NFSv4 was needet to make it possible to mount in the Omnimount docker instance, i still have a permission issue on the NFS share, so i had to give "other" rwe" access.

image

When i look in the omnimount log there is a reference to a omniuser, is this the user that i used to access the nfsshare and not the user i created to run Omnistream? (plexsus)

Refrence: omnimount | rclone v1.64.0 omnimount | - os/version: debian 12.1 (64 bit) omnimount | - os/kernel: 6.1.0-12-amd64 (x86_64) omnimount | - os/type: linux omnimount | - os/arch: amd64 omnimount | - go/version: go1.21.1 omnimount | - go/linking: static omnimount | - go/tags: none omnimount | omnimount | mergerfs v2.37.1 omnimount | omnimount | https://github.com/trapexit/mergerfs omnimount | https://github.com/trapexit/support omnimount | omnimount | ISC License (ISC) omnimount | omnimount | Copyright 2023, Antonio SJ Musumeci trapexit@spawn.link omnimount | omnimount | Permission to use, copy, modify, and/or distribute this software for omnimount | any purpose with or without fee is hereby granted, provided that the omnimount | above copyright notice and this permission notice appear in all omnimount | copies. omnimount | omnimount | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL omnimount | WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED omnimount | WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE omnimount | AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL omnimount | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR omnimount | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER omnimount | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR omnimount | PERFORMANCE OF THIS SOFTWARE. omnimount | omnimount | omnimount | Starting vnstat omnimount | No interfaces found in database, adding available interfaces... omnimount | Interface "eth0" added with 10000 Mbit bandwidth limit. omnimount | -> 1 new interface found. omnimount | Limits can be modified using the configuration file. See "man vnstat.conf". omnimount | Unwanted interfaces can be removed from monitoring with "vnstat --remove". omnimount | omnimount | Configuration: omnimount | MERGEMOUNT=cloud omnimount | RCLONESERVICE=OmniTruenas omnimount | RCLONEMOUNT=OmniTruenas omnimount | UNSYNCED=unsynced omnimount | UPLOADCACHE=uploadcache omnimount | USENFS=true omnimount | NFSREMOTE=192.168.1.100:/mnt/tank/data/solsky omnimount | NFSLOCAL=nfs omnimount | MEDIA=media omnimount | TURBOMAX=20 omnimount | LOCAL=nfs omnimount | Adding group omniuser' (GID 3000) ... omnimount | Done. omnimount | Adding useromniuser' ... omnimount | Adding new user omniuser' (3000) with groupomniuser (3000)' ... omnimount | Creating home directory /home/omniuser' ... omnimount | Copying files from/etc/skel' ... omnimount | Adding new user omniuser' to supplemental / extra groupsusers' ... omnimount | Adding user omniuser' to groupusers' ... omnimount | Cleaning up leftovers omnimount | Starting services omnimount | VFSMAX=100G omnimount | VFSAGE=48h omnimount | VFSPOLL=5m omnimount | VFSREAD=2G omnimount | VFSCACHE=yes omnimount | DIRCACHE=10s omnimount | NFS enabled omnimount | rmdir: failed to remove '/mnt/OmniTruenas': No such file or directory omnimount | omnimount | Startup complpete omnimount | 2023/09/27 15:48:01 NOTICE: Serving remote control on http://127.0.0.1:5572/

But for now it is working, but i would like to know how to fix the permission part to access the files correctly