Appearance
Upgrading Ballast
Upgrading means replacing the ballast program with a newer one and starting it again. Ballast updates its own database the first time the new version starts, and your services, schedules, destinations and snapshots carry on as before.
It takes about five minutes. Do it by hand the first time; there is no automatic ballast install --upgrade yet, on purpose, until this guide has been used enough to trust.
The paths below are the ones ballast install uses (/var/lib/ballast for data, /usr/local/bin/ballast for the program, a systemd service called ballast). If you put things elsewhere, use your own paths.
Before you start
See which version you run now, and that Ballast is healthy:
bashballast version ballast doctorThe first lines of
doctorshow the Ballast version and the database version. Write both down in case you need to go back.Wait until no backup is running. Restarting in the middle of a backup does not lose it (an interrupted backup is shown as amber and the next one runs normally), but it wastes the night's work, so avoid it:
bashballast wait-idle --timeout 30mIf a backup is running and you would rather stop it than wait, run
ballast cancel <service>: the run is recorded as cancelled and the last good backup is kept.This returns as soon as nothing is running. A backup counts as running until Ballast has finished with it completely, including the tidy-up of old snapshots that follows a finished backup (on a remote destination that can take a while). It exits with an error if something is still running after 30 minutes. To only look, without waiting, use
ballast status --running: it prints what is running and exits with 1 if anything is, or prints "Nothing is running." and exits with 0.
Upgrade
Stop Ballast, so nothing starts while you swap the program:
bashsudo systemctl stop ballastCopy the database. This is your way back, so do not skip it:
bashsudo cp -a /var/lib/ballast/ballast.db /var/lib/ballast/ballast.db.before-upgradeIf
ballast.db-walorballast.db-shmfiles sit next to it, copy them too. (They are normally empty once Ballast has stopped cleanly.)Get the new program. To download the latest release into the current folder:
bashARCH=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/') curl -fsSLO "https://github.com/springledev/ballast/releases/latest/download/ballast_linux_$ARCH.tar.gz" curl -fsSLO https://github.com/springledev/ballast/releases/latest/download/checksums.txt sha256sum --check --ignore-missing checksums.txt tar xzf "ballast_linux_$ARCH.tar.gz"For a particular version, replace
latest/downloadwithdownload/v0.8.0, using the version you want.If you build from source instead: update your copy of the Ballast code (for example
git pull, orgit checkouta release tag), then runmakein the Ballast folder and usebin/ballastin the next step.makestamps the version fromgit describe --tags --always --dirty, so a build from a tagged release saysv0.8.0, and a build from any other commit says the commit it came from (with-dirtyadded if you changed files).Keep the old program, then put the new one in place:
bashsudo cp -a /usr/local/bin/ballast /usr/local/bin/ballast.old sudo install -m 0755 ballast /usr/local/bin/ballastStart it and check:
bashsudo systemctl start ballast ballast version ballast doctordoctorshould now show the new Ballast version, a database version the same as or higher than before, and no new red lines. Look at the dashboard (orballast status) the next morning to see that the scheduled backups ran and are green. For a check you can script,ballast status --checkexits with 0 when every service is green.ballast runs <service>(or the History button on the dashboard) lists the past backups of one service.You do not need to sign in to the web UI again. Sign-ins are saved in the database, so restarting or upgrading Ballast no longer signs anyone out (they last up to 30 days). If you go back to an older version below, you may have to sign in again.
If something is wrong: going back
The new version moves the database forward and does not move it back, so going back means putting the copy back too:
bash
sudo systemctl stop ballast
sudo cp -a /usr/local/bin/ballast.old /usr/local/bin/ballast
sudo cp -a /var/lib/ballast/ballast.db.before-upgrade /var/lib/ballast/ballast.db
sudo systemctl start ballast
ballast doctorAny backups made between the upgrade and the rollback are still safely in your destinations. Only Ballast's own record of them is lost, and you can see them with ballast snapshots.
Each database change says in its comment (in internal/store/migrations) whether it can be rolled back by itself. Most only add things an older Ballast ignores, but a few rewrite existing data, so the copy from step 2 is the only method that is always safe.
For maintainers: tagging a release
This section is only for the people who publish Ballast; you do not need it to upgrade. A release is a git tag, and tagging is something the maintainer does by hand; nothing in the code does it:
bash
git tag v0.5.0
git push origin v0.5.0Build after tagging, so make picks the tag up. Until a commit is tagged, builds report the commit instead, never just dev.