diff --git a/mykindlebox/README.md b/mykindlebox/README.md index bb6b7c0..343c690 100644 --- a/mykindlebox/README.md +++ b/mykindlebox/README.md @@ -90,7 +90,7 @@ and reverse-proxies `/api` + `/uploads` to the Node server. The SQLite database and uploaded photos live in the `server-data` Docker volume. To serve on a different host port, set `MYKINDLEBOX_PORT` (e.g. in a `.env` file -next to `docker-compose.yml`, alongside `MYKINDLEBOX_PASSWORD`): +next to `docker-compose.yml`): ```env MYKINDLEBOX_PORT=3000 @@ -100,6 +100,51 @@ Then re-run `docker compose up -d` — the app is served on that port instead of 8080. (Only the host side changes; inside the compose network nginx still listens on 80.) +### Updating an existing deployment + +Compose builds from whatever is checked out on the host, so pull first, then +rebuild. Run from the repo root on the server: + +```bash +# 1. Back up the database (schema migrations run automatically on startup) +cd mykindlebox +docker compose cp server:/app/data ./data-backup-$(date +%F) + +# 2. Pull the latest code +cd .. +git checkout main +git pull +git log --oneline -1 # confirm you're on the commit you expect + +# 3. Rebuild and restart both services +cd mykindlebox +docker compose up --build -d +``` + +**Verify both containers were recreated:** + +```bash +docker compose ps +``` + +Both `client` and `server` should show a recent **CREATED** time (seconds or +minutes ago), and `server` should reach **(healthy)** within ~15 seconds. If +either still shows an old CREATED time, Compose reused a cached image — force +it: + +```bash +docker compose build --no-cache server # or client +docker compose up -d --force-recreate server +``` + +The client and server must be from the same version; a new client against an +old server will fail on login and newer pages. If the server never becomes +healthy, check `docker compose logs server --tail 50`. + +Finally, hard-refresh the browser (Ctrl+Shift+R). On an installed phone PWA, +fully close and reopen the app to pick up the new build. Once everything looks +right, the `data-backup-*` folder can be deleted. + ### Authentication The app uses **user accounts** — everyone shares the same herd; accounts are @@ -116,4 +161,9 @@ last 30 days, surviving server restarts. The herd database (`server/data/`), uploaded photos, and `.env` files are **gitignored** — they are never committed. In production they persist in the -`server-data` volume; back that volume up to preserve your data. +`server-data` volume; back that volume up to preserve your data. A quick +snapshot from a running stack: + +```bash +docker compose cp server:/app/data ./data-backup-$(date +%F) +```