ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
580 stars 25 forks source link

Trying to backup to SMB Share #8

Closed MiranoVerhoef closed 2 years ago

MiranoVerhoef commented 2 years ago

Description

I've tried to get SMB working but i just can't figure it out because it keeps asking for my Config file

Schermafbeelding 2022-02-21 om 11 50 25

Error:

2022-02-21 11:49:53 [INFO]:unifi_protect_backup.unifi_protect_backup: Starting... 2022-02-21 11:49:53 [INFO]:unifi_protect_backup.unifi_protect_backup: Checking rclone configuration... 2022-02-21 11:49:53 [DEBUG]:unifi_protect_backup.unifi_protect_backup: rclone found: /usr/bin/rclone Traceback (most recent call last): File "/usr/local/bin/unifi-protect-backup", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1137, in call return self.main(args, kwargs) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke return __callback(args, **kwargs) File "/usr/local/lib/python3.9/site-packages/unifi_protect_backup/cli.py", line 60, in main loop.run_until_complete(event_listener.start()) File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/usr/local/lib/python3.9/site-packages/unifi_protect_backup/unifi_protect_backup.py", line 209, in start await self._check_rclone() File "/usr/local/lib/python3.9/site-packages/unifi_protect_backup/unifi_protect_backup.py", line 282, in _check_rclone raise ValueError(f"rclone does not have a remote called {remote}") ValueError: rclone does not have a remote called remote

ep1cman commented 2 years ago

Do you have an rclone.conf file in your config directory? If so could you share that too (obviously redacting any secrets)?

MiranoVerhoef commented 2 years ago

Hello,

I just made some changes and i'm now getting this:

2022-02-21 12:14:32 [INFO]:unifi_protect_backup.unifi_protect_backup: Starting... 2022-02-21 12:14:32 [INFO]:unifi_protect_backup.unifi_protect_backup: Checking rclone configuration... 2022-02-21 12:14:32 [DEBUG]:unifi_protect_backup.unifi_protect_backup: rclone found: /usr/bin/rclone 2022-02-21 12:14:32 [INFO]:unifi_protect_backup.unifi_protect_backup: Connecting to Unifi Protect... 2022-02-21 12:14:32 [INFO]:unifi_protect_backup.unifi_protect_backup: Setting up purge task... 2022-02-21 12:14:32 [INFO]:unifi_protect_backup.unifi_protect_backup: Listening for events...

is this enough for it to backup?

Schermafbeelding 2022-02-21 om 12 17 08

My config:

Changes in docker :SMB:/mnt/remotes/Backup/ProtectBackup/

I made this file on the config location:

Schermafbeelding 2022-02-21 om 12 19 05

And it seems to record. Did i setup everything correctly?

MiranoVerhoef commented 2 years ago

Another update,

It says saved succesfully but my directory doesnt seem to get filled:

Schermafbeelding 2022-02-21 om 12 22 26 Schermafbeelding 2022-02-21 om 12 22 47
MiranoVerhoef commented 2 years ago

Keeping you updated. It made a location as stated above in de docker container instead of a connection to my NAS

So i made a Path that connects /ProtectBackup/ to my NAS and made a change in my template:

Schermafbeelding 2022-02-21 om 12 27 06

This fixed it and its now writing to my NAS.

Thank you for this amazing product!

MiranoVerhoef commented 2 years ago

Is there a way to keep a max of 30 days of footage?

It's a requirement for my country (NL)

ep1cman commented 2 years ago

Ok so what you are trying to do if I understand correctly is to save the clips locally to your unraid instance?

If that is correct then I have a few observations:

1) I wouldn't name your rclone remote "SMB" because it won't actually be using SMB, because it is of type=local all rclone is doing is copying files. So for example:

[local]
type = local

2) The rclone destination when using the local type, will be a path INSIDE the container. For example local:/clips

3) You will then need to create a path in unraid to map the path from the previous step to your unraid array: Host path = /mnt/user/{your path} Container path = /clips

ep1cman commented 2 years ago

Is there a way to keep a max of 30 days of footage?

It's a requirement for my country (NL)

Set the container variable RCLONE_RETENTION to the value 30d

MiranoVerhoef commented 2 years ago

Ok so what you are trying to do if I understand correctly is to save the clips locally to your unraid instance?

If that is correct then I have a few observations:

  1. I wouldn't name your rclone remote "SMB" because it won't actually be using SMB, because it is of type=local all rclone is doing is copying files. So for example:
[local]
type = local
  1. The rclone destination when using the local type, will be a path INSIDE the container. For example local:/clips
  2. You will then need to create a path in unraid to map the path from the previous step to your unraid array: Host path = /mnt/user/{your path} Container path = /clips

You almost got it.

I have the following hardware:

  1. UDM Pro
  2. Synology NAS
  3. Unraid Server

The way it's working currently:

The unraid server hosts the docker that captures the images using your amazing tool (Thank you again!). The unraid server got a NFS connection setup to the Synology NAS

I made a Path config in the docker that maps /ProtectBackup to my Synology NAS

I then made a config that just copies the footage to the selected drive as mentioned

MiranoVerhoef commented 2 years ago

Just changed the naming sceme to "local" instead of "SMB"

ep1cman commented 2 years ago

Im glad you got it working! If you continue to face issues feel free to re-open this, or open a new issue.

Just to let you know there will be a new release later today that has some improvements to stability, so keep an eye out for that!

ep1cman commented 2 years ago

Hi, Just wanted to point out there is now an official unraid docker in community apps