Upgrade and maintenance

Commands below run in the install directory:

cd /opt/mailsafehouse/deploy

Upgrade

Run the installer again:

curl -fsSL https://raw.githubusercontent.com/crimpac/mailsafehouse/main/install.sh | bash

It finds the existing install, shows the plan, and then replaces the program files (the old ones move to /opt/mailsafehouse.previous), rebuilds and restarts. It keeps deploy/.env, deploy/secrets/, deploy/compose.override.yaml and all data. Database updates run on start. Check Jobs first: an upgrade stops running backups (they resume at the next run).

Changes you made to compose.yaml or Caddyfile are replaced; the installer says so, and your copy stays in /opt/mailsafehouse.previous. Put your own changes in compose.override.yaml instead, which is kept.

Everyday commands

sudo docker compose ps                 # what is running
sudo docker compose logs -f api worker # logs
sudo docker compose restart            # restart everything

Store backups on another disk

Mount the disk on the host (for example at /srv/backups), give it to the application’s user, and point the backup volume at it in compose.override.yaml:

sudo chown 10001:10001 /srv/backups
# /opt/mailsafehouse/deploy/compose.override.yaml
services:
  api:
    volumes: ["/srv/backups:/repo"]
  worker:
    volumes: ["/srv/backups:/repo"]

Then sudo docker compose up -d. Do this before creating the repository, or move the repository’s files across first.

Back up the backup server

To rebuild the server after losing it you need:

  • deploy/secrets/master_key and deploy/.env;

  • the repository (the backup disk or volume) and its recovery kit;

  • a copy of the database, which holds the catalog of what is in the repository:

    sudo docker compose exec -T postgres pg_dump -U s365b -Fc s365b > mailsafehouse-db.dump
    

Keep these copies away from the server, and away from Microsoft 365.

Uninstall

sudo docker compose down        # stops it; data and backups are kept

To remove everything, including every backup:

sudo docker compose down --volumes
sudo rm -rf /opt/mailsafehouse /opt/mailsafehouse.previous

Then delete the Mail Safehouse app registrations in Entra ID (App registrations, names starting with “Mail Safehouse”).