ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
635 stars 31 forks source link

Docker in Mac - Cannot find rclone remote #44

Closed smshapiro85 closed 2 years ago

smshapiro85 commented 2 years ago

Description

I am trying this out in Docker on a Mac but having trouble with the app finding the rclone remote. Error message:

raise ValueError(f"rclone does not have a remote called `{remote}`")

ValueError: rclone does not have a remote called `unifirclone`

What I Did

Docker script

docker run \
  -e UFP_USERNAME='unifibackup' \
  -e UFP_PASSWORD='REDACTED' \
  -e UFP_ADDRESS='192.168.1.1' \
  -e UFP_SSL_VERIFY='false' \
  -e RCLONE_DESTINATION='unifirclone:/12t-unifi-rclone' \
  -e RCLONE_RETENTION='180d' \
  -v /Users/porterranch/.config/rclone:/data \
  --mount type=bind,source="/Users/porterranch/.config/rclone/rclone.conf",target=/config/rclone.conf \
  -v /Users/porterranch/.config/rclone/:/config \
  ghcr.io/ep1cman/unifi-protect-backup

Rclone Config

[unifirclone]
type = dropbox
client_id = REDACTED
client_secret = REDACTED
token = {"access_token":"REDACTED","token_type":"bearer","refresh_token":"REDACTED","expiry":"2022-08-15T11:05:50.859498-07:00"}

Screenshot of docker inspect window

image

Traceback

Traceback (most recent call last):

  File "/usr/bin/unifi-protect-backup", line 8, in <module>

    sys.exit(main())

  File "/usr/lib/python3.10/site-packages/click/core.py", line 1137, in __call__

    return self.main(*args, **kwargs)

  File "/usr/lib/python3.10/site-packages/click/core.py", line 1062, in main

    rv = self.invoke(ctx)

  File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/usr/lib/python3.10/site-packages/click/core.py", line 763, in invoke

    return __callback(*args, **kwargs)

  File "/usr/lib/python3.10/site-packages/unifi_protect_backup/cli.py", line 109, in main

    loop.run_until_complete(event_listener.start())

  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete

    return future.result()

  File "/usr/lib/python3.10/site-packages/unifi_protect_backup/unifi_protect_backup.py", line 278, in start

    await self._check_rclone()

  File "/usr/lib/python3.10/site-packages/unifi_protect_backup/unifi_protect_backup.py", line 414, in _check_rclone

    raise ValueError(f"rclone does not have a remote called `{remote}`")

ValueError: rclone does not have a remote called `unifirclone`
ep1cman commented 2 years ago

Thanks for your patience, could you try running the following to see if your config file is getting properly loaded:

docker run \
    --rm \
    -v /path/to/rclone.conf:/config/rclone/rclone.conf \
    -e RCLONE_CONFIG='/config/rclone/rclone.conf' \
    --entrypoint rclone \
    ghcr.io/ep1cman/unifi-protect-backup \
    listremotes

This hould list the remotes it has configured, for example I see:

local:
onedrive:
ep1cman commented 2 years ago

Hi,

I just updated the README as there were some issues reported by another user. Please check that out to see if it helps

smshapiro85 commented 2 years ago

@ep1cman yes that did it, thank you.... for anyone who comes back here using Docker, just make sure that the rclone config file target is "/config/rclone/rclone.conf" instead of "/config/rclone.conf."

Here is a copy of my working docker script:

docker run \
  -e UFP_USERNAME='unifibackup' \
  -e UFP_PASSWORD='REDACTED' \
  -e UFP_ADDRESS='192.168.1.1' \
  -e UFP_SSL_VERIFY='false' \
  -e RCLONE_DESTINATION='unifirclone:/12t-unifi-rclone' \
  -e RCLONE_RETENTION='180d' \
  -v /Users/porterranch/.config/rclone:/data \
  --mount type=bind,source="/Users/porterranch/.config/rclone/rclone.conf",target=/config/rclone/rclone.conf \
  -v /Users/porterranch/.config/rclone/:/config \
  ghcr.io/ep1cman/unifi-protect-backup