Berth

Living in a closet

Berth is built to run for months without anyone looking at the screen.

  • Crashed apps restart. An app that exits is restarted with backoff (1 second, growing to 60). After 10 crashes without 10 healthy minutes in between, Berth gives up: the app is marked crashed, its URL answers 503, you get a notification, and it stays down until you deploy or berth restart it. Databases are restarted whenever they're down.
  • Reboots come back. When berthd starts, it starts Apple's container system, then the databases, then every app, oldest first.
  • Network glitches fix themselves. Apple's container network occasionally loses its route to the internet (builds fail, apps can't reach outside APIs) while the Mac itself is fine. berthd checks every 5 minutes, and after two failures in a row restarts the container system. Apps are down for about 6 seconds and you get a notification. Set "auto_heal_network": false in ~/.berth/config.json if you'd rather just be told.
  • Full disks don't happen. Berth refuses to deploy with less than 2 GB free rather than filling the boot volume.

Notifications

berth notify:set https://hooks.slack.com/services/…    # Slack, Discord or ntfy.sh
berth notify:set off

You hear about deploys that succeed or fail, apps or workers stuck crash-looping, scheduled jobs that fail, and nightly or off-Mac backups that fail. notify:set sends a test message first.

Reboots and FileVault

This is the one real trade-off. With FileVault on, macOS turns off automatic login, and after a power cut the Mac sits at a password screen before anything (Berth included) can start. So pick one:

  • FileVault on (the default, and what I'd do). Crashes and restarts recover on their own. For planned reboots, like macOS updates, use berth reboot: it unlocks the disk for exactly one boot (fdesetup authrestart), so the Mac comes back with nobody there. After an unplanned power cut someone has to type the password. A small UPS makes that rare.
  • Unattended (berth init --unattended). FileVault off, automatic login on (init shows you where). Power cuts recover with nobody home, but the disk, secrets and all, isn't encrypted.

berth doctor tells you which mode you're in and whether it's set up right.

Keeping it tidy

berth doctor             # checks everything Berth relies on and prints a fix for each problem
berth doctor --images    # and which base images have updates
berth gc                 # clear out old release images, expired dumps and leftover build files

Edit this page on GitHub (it's a section of the README)