Repository navigation
v2.5.0 — the database lives beside the config
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.dbbeside the config file:
/config/plex-auto-genres.dbin the image,config/plex-auto-genres.dbnext to
config/config.jsonoutside Docker.--db/PAG_DBstill point anywhere. /configis the only volume the compose file needs (/postersstays optional). It
holds everything worth keeping, so it is the one to back up.- The container checks at every start that
/configwill survive, and warns when it
will not: onlyconfig.jsonmounted 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/logscounts; - a file at
/config/plex-auto-genres.dbis not one of this app's databases; /configwould 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.