Logs, restarts and repairs
This page is for you when something on your site misbehaves. After reading it you can find the unhappy service, read its log, restart it, repair the install step by step, and reset a member's forgotten password.
The usual order: run sudo blackbranch status to find which service is unhappy, read its log, restart it, and repair the install if that does not help.
Reading a service's log
To see the last 200 lines of the chat service's log:
sudo blackbranch logs stream-api
To keep following it as new lines arrive (press Ctrl+C to stop):
sudo blackbranch logs stream-api -f
| Service | Look here when |
|---|---|
web |
A page of the site fails or shows an error |
stream-api |
Chat, alerts, points, payments or the Admin Panel's settings misbehave |
stream-ingest |
Chat from Twitch, Kick, YouTube or Streamplace stops arriving, or the chat bot is silent |
synapse |
Community rooms or direct messages fail |
mas |
Signing in or signing up fails |
caddy |
The site does not answer at all, or certificates fail in direct mode |
cloudflared |
Tunnel mode, and the site does not answer from outside |
postgres |
The database will not start |
migrate |
An update or start stopped at "the database migrations failed" |
Docker keeps each service's log in at most three files of 10 MB, so logs never fill the disk. Older lines are gone once the files roll over. Logs stay on the server and are sent nowhere.
The server's own jobs (backups, checks, updates, the site's requests) write to the system journal instead. Last night's backup:
sudo journalctl -u blackbranch-backup -n 50
The weekly restore check:
sudo journalctl -u blackbranch-verify -n 50
The nightly update check:
sudo journalctl -u blackbranch-update -n 80
The daily check of disk, backups and certificates, and the alerts it sent:
sudo journalctl -u blackbranch-check -n 50
An update started from the Admin Panel:
sudo journalctl -u 'blackbranch-update@*' -n 80
Requests from the site:
sudo journalctl -u blackbranch-requests -n 50
Restarting
sudo blackbranch restart web
This restarts one service and waits up to three minutes for it to be healthy. It then says so, or stops with "did not come back healthy".
The Admin Panel can restart stream-api, stream-ingest and web too. That is for settings the Admin Panel marks as applying at the next restart.
Docker restarts a service that crashes by itself. A service you stopped stays stopped, even across a reboot, until something starts it. sudo blackbranch up starts everything.
To restart the whole server, reboot it with sudo reboot. Everything comes back on its own, and an update that was running is finished or undone at boot.
Repairs, from lightest to heaviest
| Step | What it does | When |
|---|---|---|
sudo blackbranch render |
Writes the configuration of the router, the homeserver and its sign-in service again from .env and the switches, and restarts what changed |
The Doctor says a rendered file differs, or a federation or sign-up change did not apply |
sudo blackbranch up |
Brings everything to its configured state in order, and waits for all of it to be healthy | Services are stopped or out of step, or after a restore |
sudo blackbranch migrate |
Applies any database changes now | The Doctor says the database is not at this release's version |
| Run the installer again | Puts the files of the release you run back exactly, keeps .env, and runs up |
Files on the server were damaged or edited |
| Restore a backup | Puts back the databases, media and keys from a snapshot | Data was lost or damaged |
To run the installer again, use the copy that belongs to the release you run:
sudo /opt/blackbranch/release/install/install.sh
On a server that is already installed, the installer only repairs. It refuses to change the release, the domain or the front door.
Hand edits do not last
The files in /opt/blackbranch/rendered/ are generated. They are written again whenever the install starts with blackbranch up (which updates and restores also run), when setup finishes, and when the federation or sign-up switch changes. Any hand edit is overwritten then, and until then the Doctor flags the difference. Make lasting changes in the Admin Panel, with sudo blackbranch set, or in .env.
Using Docker Compose directly
You can also use Docker Compose yourself. Name the install's folder, so Compose finds the install and its .env:
sudo docker compose --project-directory /opt/blackbranch ps
cd /opt/blackbranch fails with "Permission denied" for your own account, because only root can open the folder. The option avoids it. For anything that changes something, the blackbranch command is safer: it waits for health and checks its work.
Resetting a password
With a mail server set (Admin Panel → Site → Site, card Mail), a member resets a forgotten password themselves with the sign-in page's "Forgot password?" link, once their account has an address. Without one (a new install), or for an account with no address, the member asks you, and you set a new password on the server through the homeserver's sign-in service (MAS).
-
Type this and press Enter. Nothing seems to happen: the shell is waiting for the password.
read -rs NEWPW -
Type the new password and press Enter. It is not shown as you type.
-
Run this, with
caseyreplaced by the member's user name: the part of their Matrix ID without the@and without:example.com.sudo docker compose --project-directory /opt/blackbranch exec mas mas-cli manage set-password casey "$NEWPW" -
Forget the password in your shell:
unset NEWPW
read -rs keeps the password off the screen and out of your shell history. If MAS refuses the password as too weak, choose a longer one.
Give the member their new password through a private channel, and ask them to change it.
A blackbranch command for this is on the way. Until it arrives, the steps above are the way to do it (sudo blackbranch user only makes or removes admins so far).
A member changing their own password
A member who is signed in changes their password on the sign-in service's account page, not on the site. The steps are on Your account. The page is at https://matrix.example.com/auth/account/, with your own domain.
Next: Backups and restore