Self-hosting

Updating

Getting a new version, what happens to the database when you do, and going back if you need to.

Updating Hubstruct means pulling its new images and starting them. The database is updated by the migrator on start.

Updating

From the folder with your Compose file:

Terminal
# 1. A fresh backup of the database, every time.
docker compose exec -T postgres \
  pg_dump -U tagging -d mediadb -Fc > backups/before-update-$(date +%F).dump

# 2. The new images.
docker compose pull

# 3. Start them.
docker compose up -d

On start, the migrator applies any database changes the new version brings, then exits, and everything else starts once it's done. Open pages show A new version of Hubstruct is ready with Reload, so you can switch when it suits you.

Check that everything came back:

Terminal
docker compose ps
docker compose logs migrator

What the migrator does

The migrator keeps a record of the database changes (migrations) it has applied. On every start it applies, in order, the ones not yet recorded, then exits with success. If one fails, it exits with an error, and nothing that uses the database starts, so Hubstruct never runs against a half-changed database.

Most updates have no migration, and the migrator finishes in a second. Some change large tables and take a few minutes; the release notes say so.

Pinning a version

The Compose file uses the latest images by default. To update only when you decide, pin a version in .env:

.env
HUBSTRUCT_VERSION=1.4.2

and change it when you want to move.

Going back

If an update goes wrong:

  1. Set HUBSTRUCT_VERSION back to the version you had.
  2. Restore the dump you took before updating, as in Backups. An older version can't use a database a newer one has changed.
  3. docker compose up -d.

Updating the models

The models update separately:

  • The models are pinned in the models image, and update with Hubstruct: a release that changes one downloads it on its first start.

A new model writes differently from the old one, but Hubstruct doesn't redo existing descriptions or tags by itself. Retry a step on the media you want redone.