# Upgrade and maintenance Commands below run in the install directory: ```bash cd /opt/mailsafehouse/deploy ``` ## Upgrade Run the installer again: ```bash curl -fsSL https://mailsafehouse.com/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 ```bash 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`: ```bash sudo chown 10001:10001 /srv/backups ``` ```yaml # /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: ```bash 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 ```bash sudo docker compose down # stops it; data and backups are kept ``` To remove everything, **including every backup**: ```bash 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").