- commit
- 8a4d86f5fca0558977956e21bacae13293e900d7
- parent
- d895e52dd21fde676ee004589825675b49496849
- author
- dami <gazey55@gmail.com>
| M | Dockerfile | 5 | ++++- |
| M | deploy.md | 6 | ++++-- |
@@ -32,4 +32,7 @@ VOLUME ["/data"]
3232 EXPOSE 80803333 # warm the module cache so the first request is not a cold compile3434 RUN deno cache _fresh/server.js || true35-CMD ["sh", "-c", "mkdir -p /data && exec deno serve -A --host 0.0.0.0 --port ${PORT} _fresh/server.js"]35+# MOSAIC_ROLE=nightly turns the same image into the scheduled push job:36+# generate tomorrow's field and POST it to the app (MOSAIC_NIGHTLY_ARGS37+# carries --host/--rings/--jobs/--band); anything else serves the site.38+CMD ["sh", "-c", "if [ \"$MOSAIC_ROLE\" = nightly ]; then exec deno task push-day --tomorrow $MOSAIC_NIGHTLY_ARGS; fi; mkdir -p /data && exec deno serve -A --host 0.0.0.0 --port ${PORT} _fresh/server.js"]@@ -39,12 +39,14 @@ IMAGE=$(fly status -a mosaic-daily | grep -o 'registry.fly.io/mosaic-daily:deplo
3939 fly machine run "$IMAGE" -a mosaic-daily --name mosaic-nightly --region dfw \4040 --vm-size performance-4x --schedule daily --restart no \4141 -e MOSAIC_PUSH_TOKEN="$(cat ~/.config/mosaic/push-token)" \42- -e MOSAIC_DATA=/tmp/nightly/ -e MOSAIC_GOMEMLIMIT=512MiB -e MOSAIC_DAILY= -e MOSAIC_ENGINE=/app/engine/bin/mosaic-engine \43- sh -c 'cd /app/site && deno task push-day --tomorrow --host https://mosaic-daily.fly.dev --rings all --jobs 4 --band 24'42+ -e MOSAIC_DATA=/tmp/nightly/ -e MOSAIC_GOMEMLIMIT=512MiB -e MOSAIC_DAILY= \43+ -e MOSAIC_ROLE=nightly -e MOSAIC_NIGHTLY_ARGS='--host https://mosaic-daily.fly.dev --rings all --jobs 4 --band 24'4444 fly machine start mosaic-nightly -a mosaic-daily # run it now, by hand4545 fly machine logs mosaic-nightly -a mosaic-daily # wall clock, push result4646 ```4747 48+(The image's CMD reads MOSAIC_ROLE: `nightly` runs the push, anything49+else serves; flyctl parses a positional `sh -c` as its own `-c`.)4850 A scheduled machine runs once a day at about the time it was created,4951 so create (or recreate) it at the hour you want the push to land; it5052 stops when the command exits.