ReviewOS

also looking at this

theopenfarm/openfarm.ing

fix: use release-local Bun for scheduled work

#43
Merged chris wants to merge codex/background-runtime-70 into main
4 files +26 -5
bun.lockmodified+3-4
Changes to bun.lock
@@ -29,7 +29,6 @@
2929 },
3030 "overrides": {
3131 "@stacksjs/stx": "0.2.687",
32 "@stacksjs/ts-cloud": "^0.16.11",
3332 "bun-plugin-stx": "0.2.687",
3433 },
3534 "packages": {
@@ -249,7 +248,7 @@
249248
250249 "@stacksjs/ts-cache": ["@stacksjs/ts-cache@0.1.7", "", { "dependencies": { "@stacksjs/clapp": "^0.2.5", "bunfig": "^0.15.11", "clone": "^2.1.2" }, "bin": { "cache": "./dist/bin/cli.js" } }, "sha512-NsbR7cqKrB7NMk1PmYbOLpRgaiUvhelCcDHW1cpnQyMh6Od6VpKBxNAQfDzm74R0pT7rhFxxG5tW8r4vWjC5/Q=="],
251250
252 "@stacksjs/ts-cloud": ["@stacksjs/ts-cloud@0.16.11", "", { "dependencies": { "@stacksjs/ts-xml": "^0.1.2", "@ts-cloud/aws-types": "0.16.11", "@ts-cloud/core": "0.16.11", "hash-wasm": "^4.12.0" }, "bin": { "cloud": "./dist/bin/cli.js" } }, "sha512-hwlaIdNKmz2vrT0Xb+pb19Rj8juiKzyFVO+S6s9h0yLpT9wDeAR0QpjL9ovN6mhou4RoaD6UGpEmopfbmu77PA=="],
251 "@stacksjs/ts-cloud": ["@stacksjs/ts-cloud@0.16.70", "", { "dependencies": { "@stacksjs/ts-xml": "^0.1.2", "@ts-cloud/aws-types": "0.16.70", "@ts-cloud/core": "0.16.70", "hash-wasm": "^4.12.0" }, "bin": { "cloud": "./dist/bin/cli.js" } }, "sha512-c60FiHVxOs+b0ruAYQW2uGfWBy3VIEJquxK4BIvmxC85PWndjX8id2C/jYxAqSfz+kisdSbiKK63mzyhLOngQA=="],
253252
254253 "@stacksjs/ts-css": ["@stacksjs/ts-css@0.3.19", "", { "dependencies": { "@stacksjs/clapp": "^0.2.0", "bunfig": "^0.15.17" }, "bin": { "cssx": "./dist/bin/cssx.js", "ts-css": "./dist/bin/cli.js" } }, "sha512-IHqTpD39cnjI+FbCdS4lxS0rFxLPXE48FJg5jIM7cjcGXKzmMKRBwNc4ti7IpcKRUc1Db/N5vsNuYbe6Yae3bw=="],
255254
@@ -319,9 +318,9 @@
319318
320319 "@ts-charts/time-format": ["@ts-charts/time-format@0.2.7", "", { "dependencies": { "@ts-charts/time": "0.2.7" } }, "sha512-iYipyprcy3V9P7lz6SwYt5zXCGI2VoGE2fXuCmVQ22g5sS7jPP+9odiOQQKhQYS44mX2+mIuPeSWfR5mGg160Q=="],
321320
322 "@ts-cloud/aws-types": ["@ts-cloud/aws-types@0.16.11", "", {}, "sha512-9drmb9Y/DEiW+vIU+In6abY5GiR5u3AIJjtxgQu1DoBI5thdhKJmEXoDSY40jkK5u6JjzShbx0qB1QosHPdtvQ=="],
321 "@ts-cloud/aws-types": ["@ts-cloud/aws-types@0.16.70", "", {}, "sha512-yNQEXMTe+Vu6AAN0W1/Dskz67MW9HxG+VxRGmffxa908Jk4LoB1opmn39EUd/LCCg1/IAP3hbjNkWRUH/ftc5g=="],
323322
324 "@ts-cloud/core": ["@ts-cloud/core@0.16.11", "", { "dependencies": { "@ts-cloud/aws-types": "0.16.11" } }, "sha512-U9qLyk64lhq41hFrA1XaLbnwJJQKCK9IXgPFcXnA0orzGuXDDatOxG9NpTE48agT7eZimPfPDwC0VAU2mgb1Jw=="],
323 "@ts-cloud/core": ["@ts-cloud/core@0.16.70", "", { "dependencies": { "@ts-cloud/aws-types": "0.16.70" } }, "sha512-Zf8R+O1nMU1uGwewSPQE1O/LYruioaklTwpwTYvk7MqBsre8DbkILQPJwmzDQBmtOOjUUr07GKR67I2LaI6ing=="],
325324
326325 "@ts-videos/mp4": ["@ts-videos/mp4@0.1.2", "", { "peerDependencies": { "ts-videos": "0.1.2" } }, "sha512-pZoSg84mEKPS2006/5vb45z6xQDAsLo2fnTEDwNdBwwzfsmj+y4M7+8mY057KFpxk6WlqIekgcEKslWeb/W/xQ=="],
327326
config/cloud.tsmodified+3-0
Changes to config/cloud.ts
@@ -737,6 +737,9 @@ export const tsCloud: TsCloudConfig = {
737737 domain: 'openfarm.ing',
738738 // Native ts-cloud resolves this release-local executable for systemd.
739739 start: `${appRuntime} storage/framework/runtime/production/serve.js`,
740 // One scheduler owns app/Scheduler.ts for both main and API.
741 scheduler: true,
742 backgroundBun: 'pantry/.bin/bun',
740743 port: 3060,
741744 /*
742745 * This site's share of a shared box.
docs/guide/deployment.mdmodified+20-0
Changes to docs/guide/deployment.md
@@ -134,6 +134,26 @@ the same runtime. This does not upgrade the shared server's
134134Bun or Pantry binaries. A runtime installation or version-check failure stops
135135startup.
136136
137### Scheduled work
138
139The main site explicitly owns the single scheduler for `app/Scheduler.ts`.
140The API does not start another copy. Native ts-cloud 0.16.70 runs this scheduler
141with `backgroundBun: 'pantry/.bin/bun'`, using the physical release directory
142for its executable, working directory and child-command `PATH`.
143
144The native deployment stops background work before replacing an existing
145release directory. After activation it reconciles the services before pruning
146old releases, so a running task retains its admitted runtime and assets until
147it stops. A refused stop fails deployment rather than removing those assets.
148The runtime entry validates executable identity and containment before loading
149application work. A same-ID replacement that fails after draining may require
150a recovery deploy to restart background work.
151
152The app consumes the maintained public package through its normal dependency
153lockfile. It does not override ts-cloud with an older release or rewrite
154installed packages or host units. This scheduler creates planning records;
155it does not dispatch aircraft or mark a physical mission complete.
156
137157## preStart
138158
139159`catalog:sync` publishes content from `app/Support/content/` on every deploy.
package.jsonmodified+0-1
Changes to package.json
@@ -112,7 +112,6 @@
112112 "better-dx": "^0.2.37"
113113 },
114114 "overrides": {
115 "@stacksjs/ts-cloud": "^0.16.11",
116115 "@stacksjs/stx": "0.2.687",
117116 "bun-plugin-stx": "0.2.687"
118117 },