saltyorg / Saltbox

Ansible-based solution for rapidly deploying a Docker containerized cloud media server.
https://docs.saltbox.dev
GNU General Public License v3.0
571 stars 65 forks source link

Implement Plex DB Repair into Saltbox #135

Closed vpatel9202 closed 1 year ago

vpatel9202 commented 1 year ago

Describe the problem Plex database problems are relatively common and kind of a pain in the ass to deal with, requiring manually stopping the docker and then running through the steps laid out by the Plex team. It does usually fix the problem, however.

Describe any solutions you think might work There's a ton of scripts and solutions on Github and elsewhere that work with specific Plex configurations so this is not really a problem that needs to be solved--it only needs to be implemented into the Saltbox project. For example, this repo handles the repair in a fairly robust way.

Additional context I realize one could just use the repo above to do everything I mentioned, but I think there are some benefits to rolling it into the Saltbox project. For one thing, if you have multiple Plex instances, it would be possible to run a database repair on all of them simultaneously.

You may point out that DB repair is not required often enough to implement this feature as well, but there are two other benefits to running the repair more often:

  1. I've noticed a huge improvement in browsing speed on all platforms after running a repair, with a gradual taper over time as changes occur, so repairing once every few weeks seems to keep things snappy.
  2. Once DB gets sufficiently large, the built-in "Optimize Database" feature in Plex is highly unreliable. On many occasions, it just simply doesn't work. Even if it is functioning properly, it slows down browsing quite a bit while it performs the optimization and it takes a long time to do so. Doing a manual recovery takes only a minute or so.
saltydk commented 1 year ago

plex-db already does vacuum and re-index which would serve as a decent replacement of the optimize database thing you're talking about here. I am not interested in automating Plex Database recovery though as that can cause data loss that the user would then not be aware of as opposed to when manually running the suggested script where they would have a higher chance of reading the error output.

vpatel9202 commented 1 year ago

That's a good point, makes sense. Appreciate it.