kiwimato / unifi-protect-arm64

Run UniFi Protect in Docker on ARM64 hardware
6 stars 0 forks source link

fixes and new build with latest Protect 2.7.34 #3

Closed kiwimato closed 1 year ago

gurkburk76 commented 1 year ago

Is there anything you can do to enable a start of the container without having 100G+ ? i haven't actually tried and see what happens but the attached ssd i have seems to be on the fritz and bad sector count increasing and i personally do not record on this machine, i just use the RTSP URL and hand it over to frigate so i don't need much space at all :)

kiwimato commented 1 year ago

Is there anything you can do to enable a start of the container without having 100G+ ? i haven't actually tried and see what happens but the attached ssd i have seems to be on the fritz and bad sector count increasing and i personally do not record on this machine, i just use the RTSP URL and hand it over to frigate so i don't need much space at all :)

I remember seeing this thread: https://github.com/markdegrootnl/unifi-protect-arm64/issues/12 you could attach to the container, get that file locally and then mount it to overwrite it

btw if you don't need to record, then why not use the RTSP directly from the camera without the NVR? Or you want to use the NVR to upgrade and etc?

gurkburk76 commented 1 year ago

Because ubiquiti are aholes and FORCE you to adopt their later hardware stuff to their cloud controller, you USED to be able to log into their cameras and get a RTSP stream and run it standalone like that. I have my older G3 bullets standalone thankfully. I got this newer wifi camera (G3 instant) that i though i'de use as standalone before realising this stupid shenedigans from their part.

gurkburk76 commented 1 year ago

Anyway, sorry or the small rant, but these obvious cash grab things really make me twich :)

Would it be possible to apply a patch to change mbToKeepFree to something like 1024 ? Like you did when we tried to get it running on x86 hardware? I tend to forget to enter the container and adjust things when restarting and trying stuff out :)

Also, importing a backup does not seem to work, is this a known issue? Might want to write about it in main rep. i guess.

kiwimato commented 1 year ago

@gurkburk76 look, I understand, that's why I'm doing this as well. I refuse to buy their NVRs and hope will make it easier for other people do it too. I don't know other alternatives, because if I did I would gladly switch. Aand I'm not rich enough to create a company to compete with them. Only upside I see is that their EOL tactic made usable devices much cheaper because people started selling them all of a sudden. Downside is that the're no updates for them, especially security ones..

In any case, I modified the file as the guy suggested there and uploaded a new image here: ghcr.io/kiwimato/unifi-protect-arm64:storage-test Please test it and let me know how it works, if it's all good I will include the changes here as well since it might help other people also.

About the backup I didn't know, but that's a good catch, I will try to look into it when I have some time. I'm curious if it works in Mark's version.

gurkburk76 commented 1 year ago

Cool I'll try it this weekend. Regarding protect, it would seem that i upgraded to. 74 iirc via the web interface (it actually worked somehow) and then exported a backup, within this backup there is a version file and i tried importing this later backup to the version that comes with the container and that did not work. It silently fails. My workaround was to change the version file to one that has the correct data hehe.

Den lör 17 juni 2023 13:01Mihai @.***> skrev:

@gurkburk76 https://github.com/gurkburk76 look, I understand, that's why I'm doing this as well. I refuse to buy their NVRs and hope will make it easier for other people do it too. I don't know other alternatives, because if I did I would gladly switch. Aand I'm not rich enough to create a company to compete with them. Only upside I see is that their EOL tactic made usable devices much cheaper because people started selling them all of a sudden. Downside is that the're no updates for them, especially security ones..

In any case, I modified the file as the guy suggested there and uploaded a new image here: ghcr.io/kiwimato/unifi-protect-arm64:storage-test Please test it and let me know how it works, if it's all good I will include the changes here as well since it might help other people also.

About the backup I didn't know, but that's a good catch, I will try to look into it when I have some time. I'm curious if it works in Mark's version.

— Reply to this email directly, view it on GitHub https://github.com/kiwimato/unifi-protect-arm64/pull/3#issuecomment-1595709106, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI5TRVJ2K7GB773AUY7SSY3XLWFBJANCNFSM6AAAAAAZG6ZH34 . You are receiving this because you were mentioned.Message ID: @.***>

gurkburk76 commented 1 year ago
root@DietPi:~/docker# cat start_protect_local_sdcard.sh
docker run -d --name unifi-protect  \
    --privileged \
    --tmpfs /run \
    --tmpfs /run/lock \
    --tmpfs /tmp \
    -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
    -v /protect/srv:/srv \
    -v /protect/data:/data \
    -v /protect/persistent:/persistent \
    --network host \
    -e STORAGE_DISK=/dev/mmcblk0p1 \
    ghcr.io/kiwimato/unifi-protect-arm64:storage-test

root@DietPi:~/docker# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
root@DietPi:~/docker# ./start_protect_local_sdcard.sh
Unable to find image 'ghcr.io/kiwimato/unifi-protect-arm64:storage-test' locally
docker: Error response from daemon: Head "https://ghcr.io/v2/kiwimato/unifi-protect-arm64/manifests/storage-test": unauthorized.
See 'docker run --help'.
gurkburk76 commented 1 year ago

Maybe i'm doing soemthing wrong or you need to let ppl access it?

root@DietPi:~/docker# docker login -u REDACTED -p REDACTED 
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded <--- important part i'de guess :)
root@DietPi:~/docker# docker pull ghcr.io/kiwimato/unifi-protect-arm64:storage-test
Error response from daemon: Head "https://ghcr.io/v2/kiwimato/unifi-protect-arm64/manifests/storage-test": unauthorized
kiwimato commented 1 year ago

@gurkburk76 sorry about that, can you try again? I just made the repo public.

I assumed the repo is already public since nobody complained, but I guess they just built their own images intead

gurkburk76 commented 1 year ago

It seems to work fine, it also runs the latest protect and unifios so i guess that's good, until i have to go back to 2.0.x of the original container since it updated my camera.. ;) (mostly kidding, i hope i won't have to do that)

There is also quite a bit less debug spam when i'm in the container and watching logs.

kiwimato commented 1 year ago

What version did you upgrade to? I'll I thought we already have the latest version upgraded.

Btw, are you running everything from the MicroSD card? Please keep in mind they tend to die quite fast on Pi, depends on how much you write to them(even logs etc) and what quality they are. Best practice is to move it to tmpfs somehow and make the card readonly once you make all the changes. But again, it really depends on the usage, so I would suggest making a backup once you have everything running, just in case it dies. https://hackaday.com/2022/03/09/raspberry-pi-and-the-story-of-sd-card-corruption/

About the logs I noticed that that they're not sent to systemctl anymore as they used to, but you can still find them in /data/ulp-go/log* and /data/ulp-core/logs if you need them.

gurkburk76 commented 1 year ago

in your image (ghcr.io/kiwimato/unifi-protect-arm64:storage-test) there is UNVR v3.1.9 + protect 2.7.34 Yes, i'm runnig it off the sdcard but i'm also using zram and ramlog (dietpi featues to not slam the sd card) and if that dosen't work out i''ll just plug in a regular drive. Could try to make it read only i guess as i an redirecting logs to RAM.

In the original docker container i belive it's UNVR (unifiOS) 3.0.x and protect 2.7.18.

kiwimato commented 1 year ago

I updated to the latest 2.8.28 version of Unifi Protect from the Unifi UI, and it seems to have worked, so far I couldn't see any issues. https://community.ui.com/releases/UniFi-Protect-Application-2-8-28/fd22da62-f908-4782-8ed2-d323c8f0fc43?page=2

I think the Applications update works without any issues, but updating the Unifi OS will create problems if we do it from the UI because it might override some changes we have to do to make it work. Please let me know in case you also do it and see any issues, because I could also include the package in the container build, but if this works, it's better IMO.

gurkburk76 commented 1 year ago

How do i know (or see) what images are avail to pull? I'm assuming you tagged this one as :latest or something but how can i actually see them, the tags?

kiwimato commented 1 year ago

Only dev and storage-test tag exist currently, and the latter is the latest, but doesn't have Unifi Protect app updated. I can build it if you want and push it to latest tag, but I'm don't have time to test if it actually works, but if you do, please tell me and I can build it for you.

gurkburk76 commented 1 year ago

No that's fine, i mostly wanted to know how/where to check what images are avail if/when i forget and need to pull it again ;)

kiwimato commented 1 year ago

TIL that you can see all of them here: https://github.com/users/kiwimato/packages/container/package/unifi-protect-arm64

I'm also new to ghcr.io :) I mostly wanted to use ghcr.io instead of Dockerhub to avoid all limitations they have in the past years.