Skip to content

Self-hosting

Backups and upgrades

What to copy to back up a workspace, how an upgrade migrates it, and how to go back.

Last updated:

You will learn#

  • what a complete backup contains and how to take one safely;
  • what an upgrade does to the workspace;
  • how to roll back.

The idea#

Everything is in one directory, the workspace (/data in the container, ~/.stuarty otherwise). A complete backup is that directory. The parts that matter:

PathKeep?
db.sqliteyes: projects, history, jobs, the calendar, users, keys
vault.jsonyes: your credentials, encrypted. It opens only with the master key, which you keep apart
library/yes: your memory notes, prompts and skills
store/yes: your imported originals, by content hash
exports/yes: the files you made
recordings/yes, while a take waits for you to add it
tools/no: install the helpers again
artifacts/, frames/, bitmaps/, audio-previews/no: they are rebuilt from the originals
backups/the database copies the server makes before a migration
logs/optional

On a graceful shutdown the server checkpoints the database, so db.sqlite is self-contained when copied by hand. Never copy the workspace while the server runs: stop the container or the server first, copy, then start it again.

Quick start#

Terminal
docker stop stuarty
docker run --rm -v stuarty:/data -v "$PWD":/backup debian:13.7-slim \
  tar -czf /backup/stuarty-data.tar.gz -C /data .
docker start stuarty

To upgrade, pull the new tag and recreate the container with the same volume and the same APP_KEY:

Terminal
docker pull ghcr.io/alexgalhardo/stuarty:X.Y.Z
docker stop stuarty && docker rm stuarty
# run the same docker run command as before, with the new tag

On start the server checks the database. If migrations are pending and the workspace is not new, it first writes backups/db-<UTC timestamp>-before-<migration>.sqlite and keeps the five newest, then migrates. A project document written by an older version is migrated when it is opened, and the original is kept in the database. Read the changelog before a minor upgrade: a minor release may change a public interface.

To roll back, stop the server, restore the backup (or the backups/db-*-before-*.sqlite file as db.sqlite) and start the older tag. A workspace migrated by a newer version may not open in an older one, which is why you take the backup first. The older version then refuses to start, changes no file and says this workspace was written by a newer version, followed by what it found; the fix is to install a version at least as new, or to restore the backup.

Coming from the former name#

This product had another name up to v0.29.0, and the version numbers continue. Nothing has to be done to keep your projects: the migration page says what is adopted at the first start and what is still read.

What is tested#

Every release candidate is opened against workspaces written by the published releases from v0.3.0 on. The upgrade workflow runs on every pull request labelled release and on every tag, on Linux, Windows and macOS. It downloads the archive of each release, checks it against checksums.txt, lets that release create a workspace with a fixed project (captions, keyframes, a template, trash and restore, an export), and then checks that the new build opens each one, writes a backup before migrating, keeps the five newest backups, loses no project and changes no document. It also checks that each older binary refuses a workspace written by the new build. To run it yourself, from a checkout, with go, ffmpeg, ffprobe, jq and gh installed:

Terminal
bash scripts/upgrade-test.sh v0.5.0 v0.14.0

Without arguments the script tests every published release from v0.3.0 on.

Common mistakes#

  • Backing up only the database. Without store/ your imported media is gone, and without library/ your notes and skills.
  • Using the tag latest on a server you keep. Pin X.Y.Z and move it on purpose.
  • Running the new and the old container on one volume at the same time: the second fails with E_WORKSPACE_LOCKED.
  • Losing APP_KEY: keep it with your other secrets.
  • Backing up vault.json and not the master key (STUARTY_MASTER_KEY, the file named by STUARTY_MASTER_KEY_FILE, or the keychain item of a desktop). The vault cannot be opened without it, and the key is never inside the workspace on purpose: keep it with your other secrets. Without it you connect the accounts again; your projects and media are unaffected.

Next steps#