also looking at this
fix: use release-local Bun for scheduled work
#43
4 files
+26
-5
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -29,7 +29,6 @@ | ||
| 29 | 29 | }, |
| 30 | 30 | "overrides": { |
| 31 | 31 | "@stacksjs/stx": "0.2.687", |
| 32 | "@stacksjs/ts-cloud": "^0.16.11", | |
| 33 | 32 | "bun-plugin-stx": "0.2.687", |
| 34 | 33 | }, |
| 35 | 34 | "packages": { |
| @@ -249,7 +248,7 @@ | ||
| 249 | 248 | |
| 250 | 249 | "@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=="], |
| 251 | 250 | |
| 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=="], | |
| 253 | 252 | |
| 254 | 253 | "@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=="], |
| 255 | 254 | |
| @@ -319,9 +318,9 @@ | ||
| 319 | 318 | |
| 320 | 319 | "@ts-charts/time-format": ["@ts-charts/time-format@0.2.7", "", { "dependencies": { "@ts-charts/time": "0.2.7" } }, "sha512-iYipyprcy3V9P7lz6SwYt5zXCGI2VoGE2fXuCmVQ22g5sS7jPP+9odiOQQKhQYS44mX2+mIuPeSWfR5mGg160Q=="], |
| 321 | 320 | |
| 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=="], | |
| 323 | 322 | |
| 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=="], | |
| 325 | 324 | |
| 326 | 325 | "@ts-videos/mp4": ["@ts-videos/mp4@0.1.2", "", { "peerDependencies": { "ts-videos": "0.1.2" } }, "sha512-pZoSg84mEKPS2006/5vb45z6xQDAsLo2fnTEDwNdBwwzfsmj+y4M7+8mY057KFpxk6WlqIekgcEKslWeb/W/xQ=="], |
| 327 | 326 | |
| @@ -737,6 +737,9 @@ export const tsCloud: TsCloudConfig = { | ||
| 737 | 737 | domain: 'openfarm.ing', |
| 738 | 738 | // Native ts-cloud resolves this release-local executable for systemd. |
| 739 | 739 | 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', | |
| 740 | 743 | port: 3060, |
| 741 | 744 | /* |
| 742 | 745 | * This site's share of a shared box. |
| @@ -134,6 +134,26 @@ the same runtime. This does not upgrade the shared server's | ||
| 134 | 134 | Bun or Pantry binaries. A runtime installation or version-check failure stops |
| 135 | 135 | startup. |
| 136 | 136 | |
| 137 | ### Scheduled work | |
| 138 | ||
| 139 | The main site explicitly owns the single scheduler for `app/Scheduler.ts`. | |
| 140 | The API does not start another copy. Native ts-cloud 0.16.70 runs this scheduler | |
| 141 | with `backgroundBun: 'pantry/.bin/bun'`, using the physical release directory | |
| 142 | for its executable, working directory and child-command `PATH`. | |
| 143 | ||
| 144 | The native deployment stops background work before replacing an existing | |
| 145 | release directory. After activation it reconciles the services before pruning | |
| 146 | old releases, so a running task retains its admitted runtime and assets until | |
| 147 | it stops. A refused stop fails deployment rather than removing those assets. | |
| 148 | The runtime entry validates executable identity and containment before loading | |
| 149 | application work. A same-ID replacement that fails after draining may require | |
| 150 | a recovery deploy to restart background work. | |
| 151 | ||
| 152 | The app consumes the maintained public package through its normal dependency | |
| 153 | lockfile. It does not override ts-cloud with an older release or rewrite | |
| 154 | installed packages or host units. This scheduler creates planning records; | |
| 155 | it does not dispatch aircraft or mark a physical mission complete. | |
| 156 | ||
| 137 | 157 | ## preStart |
| 138 | 158 | |
| 139 | 159 | `catalog:sync` publishes content from `app/Support/content/` on every deploy. |