Skip to content

v2.5.0 — the database lives beside the config

Choose a tag to compare

@Dim145 Dim145 released this 01 Oct 15:22
· 5 commits to master since this release

The state database moves out of /logs into /config, beside config.json. Upgrading
is a pull and one start with the old /logs mount still in place; after that the mount
can go.

Why

The database holds the only copy of the bindings and the genres decided by hand. It
lived in /logs: a directory whose name says it can be thrown away, and a second volume
to get right. A /logs mounted from the host's /tmp came back empty after a reboot,
and the app opened a new, empty database there without a word. Every binding and every
decision was gone, while config.json and its rules survived.

What changes

  • The database is plex-auto-genres.db beside the config file:
    /config/plex-auto-genres.db in the image, config/plex-auto-genres.db next to
    config/config.json outside Docker. --db / PAG_DB still point anywhere.
  • /config is the only volume the compose file needs (/posters stays optional). It
    holds everything worth keeping, so it is the one to back up.
  • The container checks at every start that /config will survive, and warns when it
    will not: only config.json mounted into it, a tmpfs, or a directory under the host's
    /tmp.

Upgrading

Stop the old container, then start the new one with your /logs mount still in place.
The database moves to /config on its own. It is copied through SQLite, so whatever the
last run left in its WAL comes along, then checked, and the old file is kept as
plex-auto-genres.db.moved. The log says:

Moved the state database from /logs/plex-auto-genres.db to /config/plex-auto-genres.db, beside the config; nothing is written to /logs any more. The old file is kept as plex-auto-genres.db.moved.

Then remove the /logs line from your compose file, and PAG_DB if a tool added it
(2.4's own default is read as unset).

The start stops, with the reason, rather than go on with an empty database when:

  • the old database is still open, because the previous container is still running;
  • it cannot be read or copied, or the copy does not check out. SQLite writes beside a
    database to open it, so a read-only /logs counts;
  • a file at /config/plex-auto-genres.db is not one of this app's databases;
  • /config would not keep it (see above).

An empty database already in /config, from a doctor run before /logs was mounted
for instance, gives way. One that holds anything is never touched: the log names both,
with what each holds, and how to keep the older one.

To go back to 2.4 afterwards, set PAG_DB=/config/plex-auto-genres.db.