Files
menu/ansible
tanshu 1923c80298 Stop the health wait from failing a healthy deploy, and clear a stale address
The first real deploy left the site on 502 and this is why. podman builds an OCI
image by default and drops the Docker HEALTHCHECK instruction, so the app
container has no State.Health at all; the role waited on that field, exhausted
its retries and failed the play, so the caddy role never ran and Caddy kept
proxying menu.hopsngrains.com to the old nginx container that is now gone.

The wait now asks the app itself: docker exec node -e fetch /healthz, which needs
no healthcheck and no DNS. And because the address may still be claimed by the
snippet the retired nginx-menu playbook wrote, the caddy role drops that marker
before writing its own - two blocks for one address make Caddy refuse the config,
and a refused reload quietly leaves the old proxy in place.

check-site also asked for the font the old design used, so it would have failed a
healthy site; it checks one we ship.
2026-09-22 23:44:54 +05:30
..

The menu deployment

Lives here, beside the app it deploys. One run deploys a Site: it starts the app's container and points the Site's web address at it. There is no older system to keep serving, so there is no staged rollout and nothing to retire — deploying an earlier tag is the rollback.

The app's data root is the directory the old static menus were served from (/var/lib/menu.<site>), on purpose, so the app inherits the location instead of a second one. The app only reads and writes data/ and site.env inside it. If you later want the old menu files gone, delete those files — not the directory, which now holds the live content.

What lives where

Thing Where
Name, tagline, icon, categories, menus on the server under /var/lib/menu.<site>/data — the admin edits them
Theme colours config/<site>.site.json in the repo, baked into the image
Admin password hash, session secret /var/lib/menu.<site>/site.env (untracked, mode 600)
Which image tag runs -e tag=<tag>
Which Site is deployed the inventory entry in hosts
The web address it serves host: in vars/<site>.yml

Deploying

From the repo root:

./deploy.sh 2026-09-22                 # checks, podman build+push, then deploys
SKIP_DEPLOY=1 ./deploy.sh 2026-09-22   # build and push only

deploy.sh runs make build-production TAG=<tag>, which builds a multi-arch podman manifest (linux/amd64,linux/arm64) and pushes latest and the tag to registry.tanshu.com/menu-admin. Then it runs this playbook against the Site named by SITE (default hopsngrains).

By hand:

make build-production TAG=2026-09-22
cd ansible
ansible-playbook --inventory=hosts playbook.yml --limit hopsngrains -e tag=2026-09-22

Every Site runs on the same box, so hosts has one entry per Site pointing at the same ansible_host with its own var_file. ansible_host is written as the resolvable name rather than an ssh alias, so the inventory works whatever a machine's ~/.ssh/config says. (ssh on some machines complains about /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf being owned by nobody; that is a local file-permission bug whose fix is sudo chown -R root:root /etc/ssh/ssh_config.d, not something this playbook works around.)

Adding a Site is one line in hosts and a copy of vars/hopsngrains.yml.

Checking it landed

npm run check-site -- https://menu.hopsngrains.com

Read-only, exits non-zero on failure. Then from a phone: the landing page, a Section page, the page counter, tap-to-zoom, and signing into /admin to publish something.

The admin password

The app starts with the admin disabled while /var/lib/menu.<site>/site.env is missing, and the playbook says so rather than failing. Create it once per Site:

scp scripts/provision-site-env.sh monoco:/tmp/
ssh monoco bash /tmp/provision-site-env.sh /var/lib/menu.hopsngrains.com
ssh monoco docker restart menu-app.hopsngrains.com

Rolling back

Deploy the previous tag:

./deploy.sh <previous-tag>

docker logs menu-app.<site> is where a failed container says why.