Go back to an earlier Marfa release
Move an install back onto an earlier release, and swap in the copy of the database from before the upgrade when that release can't open it.
Install the earlier release's programs and run its marfa server upgrade, as Go back by hand shows. The upgrade first asks that release whether it opens the database, and changes nothing if it can't. If it opens the database, everything stays, Marfa plugins and connector settings too. On a refusal, swap in the copy: 0.0.109 needs it after 0.0.110, and 0.0.120 after 0.0.121. What each release opens says which releases read which database.
Go back by hand
- Programs you install. Set
MARFA_VERSION. Homebrew ships only its newest release: run~/.local/bin/marfa server upgrade. - Docker from the CLI.
marfa server upgrade --release <version>. Before 0.0.76, move to a new install. - Railway. Deploy the earlier tag.
curl -fsSL https://raw.githubusercontent.com/withmarfa/marfa/main/scripts/install.sh | MARFA_VERSION=0.0.109 sh
marfa server upgrade --dir ~/marfa-serverFor 0.0.85 or earlier, or when a message says the last release can't be told, run that release's marfa server restart, which changes nothing on a database it can't read.
Once the database has changed
Before a schema change, the server saved a copy of the database as marfa.db.before-upgrade. An earlier release that can't open the changed database opens that copy.
Everything written since the copy is lost
The copy's Marfa plugins, types, settings, secrets and mapping come back. A Marfa plugin installed since, or a connector setting changed since, does not. To keep what was written since, export an archive before you swap, and restore it once the earlier release runs: it adds only items the copy lacks. An earlier release can't read every archive, such as one 0.0.110 writes for 0.0.109 (What each release opens).
Stop the server
Run marfa server stop --dir ~/marfa-server.
Swap in the copy
Move marfa.db, marfa.db-wal and marfa.db-shm aside, then copy marfa.db.before-upgrade to marfa.db. A crash, or a stop while the database was open, can leave writes in marfa.db-wal.
mkdir ~/marfa-server/replaced
cd ~/marfa-server/data
mv marfa.db marfa.db-wal marfa.db-shm ~/marfa-server/replaced/
cp marfa.db.before-upgrade marfa.dbmv reports a missing file and moves the rest. Keep the moved files until the instance works.
On Docker's <name>-data volume, docker cp can't remove a file:
docker run --rm --user 65532:65532 -v marfa-data:/data busybox:1.37 sh -c 'cd /data && mkdir replaced && for f in marfa.db marfa.db-wal marfa.db-shm; do [ ! -e "$f" ] || mv "$f" replaced/; done && cp marfa.db.before-upgrade marfa.db'docker cp marfa:/data/replaced .