# Back up (https://unmissed.dev/docs/back-up)

Everything lives in Postgres, except the key that unlocks your signing secrets. Save both:

```sh
dir=~/unmissed-backups/$(date +%Y%m%d-%H%M%S)
mkdir -p -m 700 "$dir"
docker compose exec -T postgres pg_dump -U unmissed -Fc unmissed > "$dir/unmissed.dump"
docker compose exec -T app cat /data/app_key > "$dir/app_key"   # not needed if you set APP_KEY yourself
```

Store `app_key` apart from the dump, for example in a password manager. Without it, sources that check signatures stop accepting webhooks after a restore.

## Restore [#restore]

Start from a fresh install that has never been started. Copy your `.env` over and add the saved key as `APP_KEY=...` (skip that if `.env` already sets it), then:

```sh
docker compose up -d --wait postgres
docker compose exec -T postgres pg_restore -U unmissed -d unmissed --no-owner --single-transaction < unmissed.dump
docker compose up -d
```

If the restore prints an error, nothing was loaded: fix it and run it again.