clone

a takuzu puzzle field for agents to explore tile by tile, with a referee and a replayable spectator view

deploy: the nightly machine

dami committed 6d8b7bb
commit
6d8b7bb97bc96ea7c27d74d6e020146a1cbc1b55
parent
0cff06655bcb6c24a236b4c39bd439a521e9d120
author
dami <gazey55@gmail.com>
1 file changed, +39 -14
Mdeploy.md53++++++++++++++++++++++--------
M deploy.md +39 -14
@@ -1,21 +1,28 @@
11 # Deploying the daily22 3-One machine on Fly.io runs the Deno site with the Go engine as a4-subprocess for judging only; everything persistent (games, day archives,5-the days index, pushed fields) lives on the `/data` volume. **The engine6-never generates on that machine** (a chunk process was measured at7-2.1 GB RSS; the machine has 2 GB): each day's field, with its growth8-rings, is generated on the Mac and pushed:3+Two machines on Fly.io, one app:94 10-```11-cd site && deno task push-day 2026-08-28 # tomorrow, before 00:00 UTC12-```5+- **`app`** (shared-cpu-2x, 2 GB, the `/data` volume): serves the site,6+ judges (milliseconds), runs the daily loop. It generates nothing except7+ a small emergency field when a day has no field at rollover8+ (`MOSAIC_GENERATE=1`, `MOSAIC_DAILY_PREPARE=0`). Measured on it:9+ ring 1 of the daily took 40 min at 181 MB peak RSS — far too slow for10+ the nightly, fine for judging.11+- **`mosaic-nightly`** (performance-4x, scheduled `daily`, no volume):12+ runs the app image once a day with the push command — generate13+ tomorrow's field (`--rings all --jobs 4 --band 24`, `GOMEMLIMIT` per14+ chunk) and POST it to `/push/<date>` — then stops. Minutes of15+ performance-4x per day. Created with `fly machine run` (see below); it16+ is not touched by `fly deploy`, so after a deploy that changes the17+ engine or the script, update its image:18+ `fly machine update mosaic-nightly --image <the app's new image> -y`.1319 14-(`--rings 2` by default, 3x3 chunks of G=60 on a G=1000 canvas, ~4 MB,15-~30 min on a loaded Mac, ~3 min idle.) The token is in16-`~/.config/mosaic/push-token` (the `MOSAIC_PUSH_TOKEN` secret on Fly).17-A day with nothing pushed shows "no field for <date> yet" on `/`.18-`MOSAIC_GENERATE=1` would let the box generate; it is off in fly.toml.20+Rollover prefers the pushed field, then one the app prepared itself21+(only if `MOSAIC_DAILY_PREPARE=1`), then the emergency field, which `/`22+announces. `/status` reports whether tomorrow's field is pushed.23+24+The Mac can still push by hand (`deno task push-day <date>`, token in25+`~/.config/mosaic/push-token`).1926 2027 ## First time2128
@@ -25,10 +32,28 @@ fly volumes create mosaic_data --region ams --size 1
2532 fly deploy2633 ```2734 35+## The nightly machine36+37+```38+IMAGE=$(fly status -a mosaic-daily | grep -o 'registry.fly.io/mosaic-daily:deployment-[A-Z0-9]*' | head -1) # or mosaic-daily:deployment-...39+fly machine run "$IMAGE" -a mosaic-daily --name mosaic-nightly --region dfw \40+ --vm-size performance-4x --schedule daily --restart no \41+ -e MOSAIC_PUSH_TOKEN="$(cat ~/.config/mosaic/push-token)" \42+ -e MOSAIC_DATA=/tmp/nightly/ -e MOSAIC_GOMEMLIMIT=512MiB -e MOSAIC_DAILY= \43+ --command 'deno task push-day --tomorrow --host https://mosaic-daily.fly.dev --rings all --jobs 4 --band 24'44+fly machine start mosaic-nightly -a mosaic-daily # run it now, by hand45+fly machine logs mosaic-nightly -a mosaic-daily # wall clock, push result46+```47+48+A scheduled machine runs once a day at about the time it was created,49+so create (or recreate) it at the hour you want the push to land; it50+stops when the command exits.51+2852 ## Every time2953 3054 ```3155 fly deploy56+fly machine update mosaic-nightly --image <new image> -y -a mosaic-daily # if the engine or push script changed3257 ```3358 3459 ## Configuration (fly.toml [env])