Updates and rollback
This page is for you as the person who runs the site. After reading it you know how releases reach your server, how to install one, what an update does step by step, and what happens when one fails.
In short: security releases install themselves at your quiet hour, never while you are live. Feature releases wait for you to press Apply. Every update makes a backup first, checks the new release's health, and goes back to the previous release and its data by itself if anything fails.
Release channels
A release is one version number, such as 0.1.0-preview.5. Releases are published on two channels:
| Channel | What it gets |
|---|---|
beta |
Every release so far. Black Branch is in preview, and each preview is published here. |
stable |
The releases that leave preview. The first one is still to come. |
The one-line installer (curl -fsSL https://blackbranch.app/install.sh | sudo bash) sets your server to beta: until the first stable release, it installs the beta. A server installed from a copy of the source follows stable. To receive the previews as updates, switch it to beta:
sudo blackbranch update --channel beta
Your server never moves to an older release. If you switch from beta back to stable, it waits until stable has a release newer than the one you run. The list of published releases is at blackbranch.app/releases.
What a release pins
One release pins everything on your server:
- the source of the install's own services, checked by its size and sha256 fingerprint (the chat and ingest services and the backup tool are built on your server from it);
- every other piece by its exact image digest: the site (one ready-made image, the same for every install), the database, the homeserver and its sign-in service, the router, the tunnel, and the backup tool.
A digest is a fingerprint of an image's content, so a release cannot change underneath you. Two servers on the same release run the same software, byte for byte.
How your server knows a release is genuine
The project announces the newest release of each channel in a feed: https://blackbranch.app/releases/beta.json (or stable.json). The feed is signed with the project's private key, with Ed25519 signatures in the standard DSSE envelope format. Your server checks the signature with the public key it was installed with (BB_RELEASE_KEY in .env), using the release it already runs, so a new release can never vouch for itself. An update never changes which key your server trusts.
Your server refuses:
| Refused | Why |
|---|---|
| A feed signed by any other key | Only the project's key counts |
| A feed for another channel | A beta release cannot reach a stable server by mistake |
| An expired feed | The project signs the feed again regularly with an expiry date. A network in between that keeps showing your server an old feed, to hold a security release back, is caught once that feed expires. |
| A feed older than one it already read | The same trick, caught at once: the server remembers the newest feed it has seen on each channel |
| A release older than the one it runs | No downgrades through the channel |
| A release on another major version of Postgres | Moving the database to a new Postgres major version is always its own announced step |
| A download that does not match the signed size and fingerprint, or that holds links, special files or anything outside its one folder | It is not the release the feed names |
BB_UPDATE_FEED in .env is the folder the feed is read from (https://blackbranch.app/releases). If it is a plain http address, the Doctor shows amber: the signature still protects the content, but a network in between could hold releases back until the feed expires.
When updates happen
The server reads the feed every night, 45 minutes after the quiet hour.
| Release | What happens |
|---|---|
| Security | Installs itself after the nightly check, never while you are live. If the stream is live, it checks every minute and waits until the stream ends, for up to six hours, then tries again the next night. If the chat service cannot say whether you are live, it counts as not live, because the release may be the fix. |
| Feature | Waits for you. Admin Panel → Updates shows it with its notes and an Apply button. Apply asks first, then a backup is made and the site is down for a few minutes. While the stream is live the button is disabled, and the server refuses an Apply sent anyway. |
You can also install either kind from the server with sudo blackbranch update.
🖼 Image: Admin Panel → Updates showing a feature release on offer with its notes and the Apply button.
Commands
| Command | What it does |
|---|---|
sudo blackbranch update --check |
Reads the feed and says: up to date, a release available (security or feature), or published but refused here, and why |
sudo blackbranch update --dry-run |
Also downloads and checks the release, and runs its settings file changes on a copy. Changes nothing. |
sudo blackbranch update |
Reads the feed and, if there is a newer release, asks before installing it. --yes skips the question. |
sudo blackbranch update --apply <version> |
Installs exactly that release, if the signed feed still names it |
sudo blackbranch update --channel beta |
Switches the channel, then checks the feed |
What an update does, step by step
Nothing live changes until step 6. A failure before that leaves the server exactly as it was, and the update is recorded as "not applied" with the reason.
- Read and check the signed feed.
- Check there is room. It needs about 5 GB free where Docker keeps its data, because the new release's images are downloaded beside the running ones. If there is not enough, it stops before downloading.
- Download the release's source, check its size and fingerprint against the signed feed, check what is inside, and unpack it into
/opt/blackbranch/releases/<version>/. - Check
.envagainst the new release, on a copy. It runs the release's own changes to the settings file, and stops, naming the value, if the result holds a value the release does not know or lacks one it needs. - Download every image by digest, build the release's own images, check that the new configuration can be produced, and start the new site beside the running one to check it answers. The running site keeps serving meanwhile.
- Stop the site, the chat and ingest services and the homeserver, and back up. The site is down from here, usually for well under a minute and at most a few minutes. The backup comes after the stop on purpose: anything written while the update downloaded and built is in it.
- Switch: point the install at the new release, put the updated
.envin place, and start it. This applies the database changes, starts the homeserver, the chat and ingest services, and the site. - Check health (the same check as
sudo blackbranch health: the Doctor checks an update can affect, a live chat connection, and a sign-in round trip). Then the services are restarted twice and checked again, because some problems only show on a restart. Last, every platform chat reader that ran before the update must run again.
If every check passes, the update is recorded. The release from two updates ago is removed (its folder and images), so the one before stays ready to go back to. Admin Panel → Updates shows each step while it runs, then the result.
Rollback is automatic
If anything fails after step 6, the server goes back by itself:
- It stops the services, points the install back at the previous release, and puts back the previous
.envand files. - It restores the databases and media from the backup it made in step 6, so nothing written before the update is lost.
- It runs the previous release's health check.
A release that rolled back is not tried again by the nightly timer. It waits for a newer release, or for you to install it by hand with sudo blackbranch update --apply <version>.
There is one exception. If the only thing that failed was a platform chat reader (Twitch, Kick, YouTube or Streamplace did not start after the update), the timer tries the same release again on the next nights, three attempts in all. After the third it stops and says the release is parked.
The result shows in Admin Panel → Updates, in the Doctor's row The last update finished, and in sudo blackbranch status. When an update goes back, cannot go back cleanly, or stops before it finishes, the server also sends an alert to the ntfy topic or email command you set (Alerts from the server).
| Result | Meaning | What to do |
|---|---|---|
| updated | The new release passed its health check, and again after two restarts | Nothing |
| not applied | Stopped before anything live changed. The reason is given. | Fix the reason (often disk space), or wait for the next release |
| rolled back | The new release failed. The server is back on the previous release, with its data from right before the update. | Nothing is lost. Post the output of sudo blackbranch doctor --report in the Discord. |
| rollback failed | Going back did not finish cleanly | Run sudo blackbranch status and sudo blackbranch doctor. The backup made before the update brings the data back: sudo blackbranch restore <snapshot> --yes. The snapshot id is in the result and in sudo blackbranch backup list. |
| interrupted | The update was cut off (below) | Read sudo blackbranch status. If the site does not answer, restore the snapshot made before the update, then run sudo blackbranch up. |
If an update is cut off
- Stopped politely (a shutdown, or
systemctl stop): the update gets up to 30 minutes to tidy up. During step 6 it starts the site again on the release in use. From step 7 on, it goes back as above. - Cut off hard (a power loss): at the next boot, a service on the server finishes the job. If the update had already switched, it goes back to the previous release and its data. If it had only stopped the site for its backup, it starts the site again. Every
blackbranch updatealso does this first.
An install made from a copy of the source runs a release called local. It can still take a published release through the channel: the update replaces it like any other.
Next: Moving to a new server