ChuckPa / PlexDBRepair

Database repair utility for Plex Media Server databases
Other
881 stars 43 forks source link

Add support for TrueNAS Scale #127

Closed cscattaglia917 closed 9 months ago

cscattaglia917 commented 9 months ago

Leveraging other tools like Heavyscript(https://github.com/Heavybullets8/heavy_script) - one can easily access the running Plex container on a TrueNAS SCALE environment and run the DBRepair.sh script from inside the container environment. Since TrueNAS SCALE is using Kubernetes, the "Docker" checks on line 595 do not work. Checking for "kube" in the /proc/1/cgroup file resolves this issue.

I made this small adjustment on my own and can create a PR, but don't see a "contribute" branch as specified in Contributing.md..

   elif [ "$(grep docker /proc/1/cgroup | wc -l)" -gt 0 ] || [ "$(grep 0::/ /proc/1/cgroup)" = "0::/" ] ||
        [ "$(grep libpod /proc/1/cgroup | wc -l)" -gt 0 ] ||
        [ "$(grep kube /proc/1/cgroup | wc -l)" -gt 0 ]; then

Full output of /proc/1/cgroup from inside the Plex container:

0::/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-pod9e6de528_d1fe_4948_bc8e_d4252b239e6d.slice/cri-containerd-995b7b5965f98bf4baa954b729ce23c484b777c5d7dd1e5749d6dd0dfb535f36.scope

I stored the DBRepair.sh script inside my config directory and I was able to enter into the container via Heavyscript, and run the DBRepair.sh from within the container to stop PMS, run the auto option, and start PMS with this small modification. Thanks for your hard work creating the actual "repair" portion! :)

ChuckPa commented 9 months ago

Don't you love the inconsistent use of cgroups v1 and cgroups v2 ?

If I add the grep kube to the container detection, are there any pathname changes/additions required ? (confirming my understanding)

cscattaglia917 commented 9 months ago

If I add the grep kube to the container detection, are there any pathname changes/additions required ? (confirming my understanding)

No pathname changes/additions required - I just added that one line to the container detection check 👍

ChuckPa commented 9 months ago

Thank you.

I will update this over the weekend and add support.

ChuckPa commented 9 months ago

Changes implemented:

  1. DBRepair.sh
  2. Contributing documentation updated
  3. README.md updated
  4. Release Notes updated

Please check the work?

This will become v1.05.00

https://github.com/ChuckPa/PlexDBRepair/tree/chuckpa/add-kubernetes-support

cscattaglia917 commented 9 months ago

Thanks! Looks good!

ChuckPa commented 9 months ago

DBRepair v1.05.00 released