@intentius/chant-lexicon-fly 0.91.0 → 0.94.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +27 -0
  2. package/dist/components/fly-release.d.ts +51 -4
  3. package/dist/components/fly-release.d.ts.map +1 -1
  4. package/dist/composites/catalog.d.ts.map +1 -1
  5. package/dist/composites/fly-site.d.ts +86 -0
  6. package/dist/composites/fly-site.d.ts.map +1 -0
  7. package/dist/index.d.ts +3 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/integrity.json +4 -4
  10. package/dist/manifest.json +1 -1
  11. package/dist/op/activities/fly-release-step.d.ts +24 -0
  12. package/dist/op/activities/fly-release-step.d.ts.map +1 -0
  13. package/dist/op/activities/fly-rollback-step.d.ts +25 -0
  14. package/dist/op/activities/fly-rollback-step.d.ts.map +1 -0
  15. package/dist/op/activities/index.d.ts +7 -1
  16. package/dist/op/activities/index.d.ts.map +1 -1
  17. package/dist/op/activities/machine-release.d.ts +16 -0
  18. package/dist/op/activities/machine-release.d.ts.map +1 -1
  19. package/dist/op/activities/machines-fake.d.ts +4 -2
  20. package/dist/op/activities/machines-fake.d.ts.map +1 -1
  21. package/dist/op/activities/machines-local-cli.d.ts +20 -0
  22. package/dist/op/activities/machines-local-cli.d.ts.map +1 -0
  23. package/dist/op/activities/machines-local.d.ts +107 -0
  24. package/dist/op/activities/machines-local.d.ts.map +1 -0
  25. package/dist/op/activities/sprite-fs.d.ts +12 -3
  26. package/dist/op/activities/sprite-fs.d.ts.map +1 -1
  27. package/dist/op/activities/sprite-service-converge.d.ts +107 -0
  28. package/dist/op/activities/sprite-service-converge.d.ts.map +1 -0
  29. package/dist/op/activities/sprite-services.d.ts +2 -2
  30. package/dist/op/activities/sprites-fake.d.ts +18 -1
  31. package/dist/op/activities/sprites-fake.d.ts.map +1 -1
  32. package/dist/op/activities/sprites.d.ts +30 -10
  33. package/dist/op/activities/sprites.d.ts.map +1 -1
  34. package/dist/op/activity-contracts.d.ts +62 -0
  35. package/dist/op/activity-contracts.d.ts.map +1 -0
  36. package/dist/op/builders.d.ts +32 -0
  37. package/dist/op/builders.d.ts.map +1 -1
  38. package/dist/skills/chant-fly-ops.md +67 -0
  39. package/dist/skills/chant-fly-sprites.md +4 -3
  40. package/package.json +11 -4
  41. package/src/components/fly-release.test.ts +135 -1
  42. package/src/components/fly-release.ts +125 -8
  43. package/src/composites/catalog.test.ts +2 -1
  44. package/src/composites/catalog.ts +98 -0
  45. package/src/composites/fly-site.test.ts +66 -0
  46. package/src/composites/fly-site.ts +140 -0
  47. package/src/index.ts +8 -0
  48. package/src/op/activities/fly-release-step.ts +32 -0
  49. package/src/op/activities/fly-rollback-step.ts +33 -0
  50. package/src/op/activities/index.ts +25 -0
  51. package/src/op/activities/machine-release.ts +22 -0
  52. package/src/op/activities/machines-fake.ts +5 -3
  53. package/src/op/activities/machines-local-cli.ts +73 -0
  54. package/src/op/activities/machines-local.test.ts +225 -0
  55. package/src/op/activities/machines-local.ts +437 -0
  56. package/src/op/activities/sprite-exec-options.docker.integration.test.ts +70 -0
  57. package/src/op/activities/sprite-fs.test.ts +55 -0
  58. package/src/op/activities/sprite-fs.ts +14 -5
  59. package/src/op/activities/sprite-service-converge.test.ts +268 -0
  60. package/src/op/activities/sprite-service-converge.ts +268 -0
  61. package/src/op/activities/sprite-services.ts +2 -2
  62. package/src/op/activities/sprites-fake.ts +51 -8
  63. package/src/op/activities/sprites.integration.test.ts +30 -0
  64. package/src/op/activities/sprites.test.ts +20 -0
  65. package/src/op/activities/sprites.ts +51 -11
  66. package/src/op/activity-contracts.test.ts +71 -0
  67. package/src/op/activity-contracts.ts +67 -0
  68. package/src/op/builders.ts +32 -0
  69. package/src/skills/chant-fly-ops.md +67 -0
  70. package/src/skills/chant-fly-sprites.md +4 -3
package/README.md CHANGED
@@ -15,6 +15,33 @@ cd examples/local-fly
15
15
  chant run fly # boots mudflaps, applies an App + Machine, waits for started, tears down
16
16
  ```
17
17
 
18
+ ## Run what a release ships, locally
19
+
20
+ mudflaps and the lexicon's in-memory Machines API (`op/activities/machines-fake.ts`, the default for unit tests) store a Machine's config and run nothing. A release that puts a source tree on a Machine, as `flyRelease` does with `config.files` under `/srv/app` and a start command, can't be checked over HTTP against them. The running mode can: the same in-memory API, with each started Machine run as a process on this host.
21
+
22
+ ```ts
23
+ import { serveLocalMachines } from "@intentius/chant-lexicon-fly/op/activities/machines-local";
24
+
25
+ const fly = await serveLocalMachines({ port: 4280, root: "/tmp/fly" });
26
+ process.env.FLY_FLAPS_BASE_URL = fly.url;
27
+ // ... run the release Op ...
28
+ await fetch(`${fly.machines.endpoint("my-app", "web")}/health`);
29
+ await fly.close(); // stops every Machine's process
30
+ ```
31
+
32
+ Or as a command, for a smoke that runs the release in another process:
33
+
34
+ ```bash
35
+ tsx node_modules/@intentius/chant-lexicon-fly/src/op/activities/machines-local-cli.ts \
36
+ --listen 4280 --root /tmp/fly --publish web=8080
37
+ ```
38
+
39
+ For each started Machine it writes `config.files` at their guest paths, keeps `config.mounts` as directories that outlive instances, runs `init.exec` (or `init.entrypoint` then `init.cmd`) with `config.env`, and runs an `exec` (a migration) with the same env. A create, an update (a new instance) or a `restart` starts the process again; a `stop` or a delete stops it; a process that exits on its own leaves its Machine `stopped`. When the Machine's env sets `PORT` to a service's `internal_port`, the process gets a host port instead: the one `publish` names for it (one port, a port per Machine name, or a function), or a free port kept for that Machine. `endpoint(app, name)` returns it.
40
+
41
+ `root` places guest paths under a host directory, and rewrites the guest paths that the command, an exec and the env name. It can't rewrite a path written into the app's own source, so the app should find its files relative to itself and its data through its env. Without `root`, guest paths are host paths, for a container or box made for the app. No image is pulled: the command runs on this host's binaries.
42
+
43
+ Each process runs in its own process group. `close()` stops them (SIGTERM, then SIGKILL after `stopTimeoutMs`), and they are killed when the host process exits or gets SIGINT, SIGTERM or SIGHUP. A SIGKILL of the host process is the one case that leaves them running.
44
+
18
45
  ## What it does
19
46
 
20
47
  chant is a type system for operations: you describe infrastructure as typed TypeScript, and each lexicon turns those declarations into real provider API calls. This one covers Fly.
@@ -14,7 +14,11 @@
14
14
  * (../op/activities/machine-release.ts):
15
15
  *
16
16
  * 1. upload and start: apply the plan with the Machine serving the release,
17
- * its digest and commit in the Machine's metadata;
17
+ * its digest and commit in the Machine's metadata, and the commit in its
18
+ * `APP_REVISION` env var (#2834, as chud's fly-site.mjs set it), so the
19
+ * app's own `/health` can report it. A caller's `env.APP_REVISION`
20
+ * overrides it. `fly-rollback` restores it for free: it puts back the
21
+ * whole recorded config, env included;
18
22
  * 2. migrate: each migration runs inside the Machine once per environment,
19
23
  * witnessed by a receipt in chant's lifecycle receipt store
20
24
  * (`@intentius/chant/op/lifecycle-receipt-store`), then the Machine restarts
@@ -32,11 +36,13 @@
32
36
  * Each release's Machine config is kept on the lifecycle branch
33
37
  * (../release-store.ts). `fly-rollback` puts back the config of the release
34
38
  * the serving one replaced (or the digest it is given), which is also the
35
- * saga compensation `fly-release` declares.
39
+ * saga compensation `fly-release` declares. Given the source tree of that
40
+ * release (#2800), it checks the archive against its digest before any flaps
41
+ * call and refuses a recorded config that does not carry exactly that tree.
36
42
  */
37
43
  import type { Capability, DeployContext } from "@intentius/chant/components/capability";
38
44
  import type { ReceiptStore, EffectReceiptRef } from "@intentius/chant/op/receipt-store";
39
- import { type MachineRelease } from "../op/activities/machine-release.js";
45
+ import { type MachineFile, type MachineRelease } from "../op/activities/machine-release.js";
40
46
  import { type FlyHttp, type WaitOpts } from "../op/activities/fly-apply.js";
41
47
  import type { MachineConfigStore } from "../release-store.js";
42
48
  /** One migration, run inside the Machine once per environment. */
@@ -48,6 +54,26 @@ export interface FlyMigration {
48
54
  /** A digest of the migration's content. A migration whose content changes fires again. Default: a digest of the command. */
49
55
  sha?: string;
50
56
  }
57
+ /** A source tree a release puts on the Machine. */
58
+ export interface FlySource {
59
+ /** The archive (`sourceArchive`'s `archive`, a `git archive` tar). */
60
+ archive: string;
61
+ /** The sha256 the archive must have (`sha256:...`). */
62
+ digest: string;
63
+ /** The directory the archive holds, stripped from each path (`sourceArchive`'s `dir`). */
64
+ dir?: string;
65
+ /** Where the files go on the Machine. Default `/srv/app`. */
66
+ into?: string;
67
+ /** The command that starts the app, run in `into`: an argv, or a string run with `sh -c`. */
68
+ start: string[] | string;
69
+ }
70
+ /** Most bytes of files, base64, a release puts in a Machine's config (as chud's fly-site.mjs capped them). */
71
+ export declare const SOURCE_FILES_LIMIT: number;
72
+ /** A source tree as Machine files and the start command, once its archive is the approved one. */
73
+ export declare function sourceMachineFiles(source: FlySource): Promise<{
74
+ files: MachineFile[];
75
+ cmd: string[];
76
+ }>;
51
77
  /** Health check after the release serves. */
52
78
  export interface FlyVerify {
53
79
  /** The app's public URL. Without it, only the Machine's state and metadata are checked. */
@@ -70,8 +96,15 @@ export interface FlyReleaseInput {
70
96
  release?: string;
71
97
  /** An image to run in place of the declared one. */
72
98
  image?: string;
73
- /** Env added to the declared Machine's env. */
99
+ /** Env added to the declared Machine's env, over `APP_REVISION` (the commit, #2834) unless this names its own. */
74
100
  env?: Record<string, string>;
101
+ /**
102
+ * A source tree to put on the Machine (#2782), for an app shipped as its
103
+ * own files on a declared runtime image rather than as an image of its own.
104
+ * The archive is read only once its bytes hash to `digest` (the digest the
105
+ * release plan carries), so the Machine never gets a tree nobody approved.
106
+ */
107
+ source?: FlySource;
75
108
  /** Migrations, in order. */
76
109
  migrations?: FlyMigration[];
77
110
  verify?: FlyVerify;
@@ -97,12 +130,21 @@ export interface FlyReleaseOutput {
97
130
  fired: boolean;
98
131
  }>;
99
132
  }
133
+ /** The source tree a rollback puts back (#2800): the archive of the release it goes back to. */
134
+ export type FlyRollbackSource = Omit<FlySource, "start">;
100
135
  export interface FlyRollbackInput {
101
136
  /** Path to the fly build output, naming the App and Machine. */
102
137
  plan: string;
103
138
  machine?: string;
104
139
  /** The release digest to go back to. Default: the one the serving release replaced. */
105
140
  to?: string;
141
+ /**
142
+ * The source tree of the release it goes back to (#2800). The archive is
143
+ * read only once its bytes hash to `digest`, before any flaps call, and the
144
+ * Machine config recorded for `to` must carry exactly that tree under
145
+ * `into`, or the rollback is refused.
146
+ */
147
+ source?: FlyRollbackSource;
106
148
  verify?: FlyVerify;
107
149
  endpoint?: string;
108
150
  wait?: WaitOpts;
@@ -141,6 +183,11 @@ export declare function migrationReceipt(app: string, migration: FlyMigration):
141
183
  export declare function createFlyReleaseCapability(deps?: FlyReleaseDeps): Capability<FlyReleaseInput, FlyReleaseOutput>;
142
184
  /** Build the `fly-rollback` capability. */
143
185
  export declare function createFlyRollbackCapability(deps?: FlyReleaseDeps): Capability<FlyRollbackInput, FlyRollbackOutput>;
186
+ /**
187
+ * How a recorded Machine config's files under `into` differ from a source
188
+ * tree, or undefined when they are the same files with the same bytes. Pure.
189
+ */
190
+ export declare function treeDifference(config: Record<string, unknown>, tree: MachineFile[], into: string): string | undefined;
144
191
  /** The default `fly-release` capability. */
145
192
  export declare const flyReleaseCapability: Capability<FlyReleaseInput, FlyReleaseOutput>;
146
193
  /** The default `fly-rollback` capability. */
@@ -1 +1 @@
1
- {"version":3,"file":"fly-release.d.ts","sourceRoot":"","sources":["../../src/components/fly-release.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAUL,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAA8C,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACrH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3D,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;I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,iDAAgC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/composites/catalog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA6E5C,CAAC"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/composites/catalog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA+K5C,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * FlySite composite: a Fly app that serves one app's releases.
3
+ *
4
+ * It declares the App, the Machine that serves (behind Fly's proxy on 443 and
5
+ * 80), and, when asked for, a Volume the app's data lives on, mounted into the
6
+ * Machine, a public IP, and the app's Secrets. It is the fly lexicon's home
7
+ * for chud's `FlySite` and `ChudLocalSite` sites (ws-056, #2809): a repo that
8
+ * `chant workspace upgrade` takes off the chud lexicon declares its Fly site
9
+ * with it, so `chant workspace graph --composites` lists the site as a
10
+ * composite instance, and a component that names `FlySite` in its
11
+ * `composites` deploys it.
12
+ *
13
+ * The Machine is the one a release ships to: `chant build --lexicon fly`
14
+ * serializes the site into a plan with exactly one Machine, so the
15
+ * `fly-release` steps (a component's deploy, or an Op's `flyRelease`) find it
16
+ * without being told its name. `image` is what the Machine runs until a
17
+ * release puts its own image, or its files and start command, on it.
18
+ */
19
+ import type { Declarable } from "@intentius/chant/declarable";
20
+ export interface FlySiteProps {
21
+ /** The App's name. Fly app names are global. */
22
+ app: string;
23
+ /** The owning org (default: `Fly.OrgSlug`, which the build resolves from `FLY_ORG`). */
24
+ org?: string | Declarable;
25
+ /** Region of the Machine and the Volume (default: `Fly.Region`, from `FLY_REGION`). */
26
+ region?: string | Declarable;
27
+ /** The Machine's name (default: "web"). */
28
+ machine?: string;
29
+ /** The image the Machine runs until a release replaces it. */
30
+ image: string;
31
+ /** The port the app listens on inside the Machine (default: 8080). Fly's proxy sends 443 (TLS) and 80 to it. */
32
+ port?: number;
33
+ /** The Machine's env. */
34
+ env?: Record<string, string>;
35
+ /** Guest CPU kind (default: "shared"). */
36
+ cpuKind?: string;
37
+ /** Guest CPUs (default: 1). */
38
+ cpus?: number;
39
+ /** Guest memory in MB (default: 256). */
40
+ memoryMb?: number;
41
+ /** A Volume for the app's data, mounted at `path`. It outlives releases. Omitted: no Volume. */
42
+ volume?: {
43
+ name: string;
44
+ sizeGb: number;
45
+ path: string;
46
+ };
47
+ /** A public IP of this type (for example "shared_v4"). Omitted: none. */
48
+ ip?: "shared_v4" | "v4" | "v6";
49
+ /**
50
+ * The app's Secrets, by name. An undefined value declares the Secret
51
+ * without a value, so the release checks the app already has it.
52
+ */
53
+ secrets?: Record<string, string | undefined>;
54
+ /** Per-member defaults for fine-grained overrides. */
55
+ defaults?: {
56
+ app?: Partial<Record<string, unknown>>;
57
+ machine?: Partial<Record<string, unknown>>;
58
+ volume?: Partial<Record<string, unknown>>;
59
+ };
60
+ }
61
+ /**
62
+ * Create a FlySite composite. Returns the App and the Machine, and the
63
+ * Volume, IP and Secrets it was asked for.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * import { FlySite } from "@intentius/chant-lexicon-fly";
68
+ *
69
+ * export const flySite = FlySite({
70
+ * app: "notes",
71
+ * region: "iad",
72
+ * image: "node:22-slim",
73
+ * env: { PORT: "8080", APP_DATA: "/data" },
74
+ * volume: { name: "data", sizeGb: 1, path: "/data" },
75
+ * ip: "shared_v4",
76
+ * secrets: { APP_SECRET: process.env.APP_SECRET || undefined },
77
+ * });
78
+ * ```
79
+ */
80
+ export declare const FlySite: import("@intentius/chant").CompositeDefinition<FlySiteProps, {
81
+ ip?: (Declarable & Record<string, string>) | undefined;
82
+ volume?: (Declarable & Record<string, string>) | undefined;
83
+ app: Declarable & Record<string, string>;
84
+ machine: Declarable & Record<string, string>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,CAAC;QACvC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KAC3C,CAAC;CACH;AASD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,OAAO;;;;;EAwCP,CAAC"}
package/dist/index.d.ts CHANGED
@@ -9,6 +9,8 @@ export { flyDeploy, flapsUp, flapsDown, flyApplyStep, LOCAL_FLAPS_ENDPOINT } fro
9
9
  export type { FlyDeployOpts, FlyApplyStepOpts, FlapsStepOpts } from "./composites/fly-deploy.js";
10
10
  export { FlyOtelCollector } from "./composites/fly-otel-collector.js";
11
11
  export type { FlyOtelCollectorProps } from "./composites/fly-otel-collector.js";
12
- export { spriteCreate, spriteExec, spriteCheckpoint, spriteRestore, listCheckpoints, spriteDestroy, spriteDelete, spriteUrl, spriteWriteFile, spriteReadFile, spriteListDir, spriteRemove, spriteApplyNetworkPolicy, spriteApplyServices, spriteServiceCreate, spriteServiceGet, spriteServiceList, spriteServiceStart, spriteServiceStop, spriteServiceDelete, spriteServiceLogs, spriteTaskCreate, spriteTaskRefresh, spriteTaskRelease, spritesUp, spritesDown, flyMachineRelease, flyMachineExec, flyMachineRestart, flyMachineStop, flyMachineVerify, flyMachineRestore, } from "./op/builders.js";
12
+ export { FlySite } from "./composites/fly-site.js";
13
+ export type { FlySiteProps } from "./composites/fly-site.js";
14
+ export { spriteCreate, spriteExec, spriteCheckpoint, spriteRestore, listCheckpoints, spriteDestroy, spriteDelete, spriteUrl, spriteWriteFile, spriteReadFile, spriteListDir, spriteRemove, spriteApplyNetworkPolicy, spriteApplyServices, spriteServiceCreate, spriteServiceGet, spriteServiceList, spriteServiceStart, spriteServiceStop, spriteServiceDelete, spriteServiceLogs, spriteServicesObserve, spriteServiceRestart, spriteTaskCreate, spriteTaskRefresh, spriteTaskRelease, spritesUp, spritesDown, flyMachineRelease, flyMachineExec, flyMachineRestart, flyMachineStop, flyMachineVerify, flyMachineRestore, flyRelease, flyRollback, } from "./op/builders.js";
13
15
  export * from "./generated/index.js";
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAKrC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAK1D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACpG,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKzD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC5G,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAY7E,OAAO,EACL,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,cAAc,EACd,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAm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e,EACf,cAAc,EACd,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,WAAW,GACZ,MAAM,eAAe,CAAC;AAKvB,cAAc,mBAAmB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "21e52887aff88991e224b58e5ebfdbe84a1cde9b59791e336866d6fcfe1f421a",
4
+ "manifest.json": "c950b5f1ac1a62fb371f38c102ff815ff3fb4f5d035666f69fadf321ee095d70",
5
5
  "meta.json": "273f2a523b66f08ca91642dba2592c44765ab59ddf7329998884a0b08c6c3f24",
6
6
  "types/index.d.ts": "63ec7f2eaa8dddd3abb273748c646c4870d99616db53fc04b53edd0588ccf260",
7
7
  "rules/guest-sizing.ts": "bc749d218df8f3cc3d8fbe388205ae96e6b204ae0d6d77e8bf82cb936cc53ff6",
@@ -12,8 +12,8 @@
12
12
  "rules/fly011-mount-references-declared-volume.ts": "4698f73b85954a4094a1445d42336698440bf99a4004c067529c5f9fa1047cc6",
13
13
  "skills/chant-fly.md": "04277509e0abd81869047e66c58a10f4c8eaaa60a56be28bfcbfbe1cce20ad7c",
14
14
  "skills/chant-fly-patterns.md": "9452bf83c9e499b36a01a305a4ef28965725426436df115fd7f21e3a773f98da",
15
- "skills/chant-fly-ops.md": "f50d748b6b01bc5411ac8638847455774cca739fe17a58410799e7d920fea409",
16
- "skills/chant-fly-sprites.md": "21584784e504b88a91cf9806aa9ebab51dbe733b1f8196d4a3af39d1e9a2c602"
15
+ "skills/chant-fly-ops.md": "db5d9c9270c5700bc15951f2f8015360f91d0a18914e286ff7be91b4c2ee450f",
16
+ "skills/chant-fly-sprites.md": "8eb4a3016e83327b8db1c1cd203bc344b5cf0fc6ca3869a34722e4be752b9a40"
17
17
  },
18
- "composite": "c7679ff0e99af94e4d735870f3bd3784ec853ba41c86696855afc3b821196d03"
18
+ "composite": "eb6496183f22a865548584713bf19506e7d6cfb8edec2cc8f9c875b29439c4ee"
19
19
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fly",
3
- "version": "0.91.0",
3
+ "version": "0.94.0",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "Fly"
6
6
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `flyRelease`: the `fly-release` capability (../../components/fly-release.ts)
3
+ * as an Op activity (#2782), so an Op's ship phase runs the same site steps a
4
+ * component's deploy does: upload and start, each migration once per
5
+ * environment under a receipt in chant's lifecycle receipt store, verify, and
6
+ * restore on a failure after the Machine changed.
7
+ *
8
+ * An Op has no environment of its own, so the step names the one it ships to
9
+ * (`environment`); the receipts and the recorded Machine configs are that
10
+ * environment's, as they are for the component.
11
+ *
12
+ * Retrying a release that already serves changes nothing: the apply finds the
13
+ * Machine's config unchanged, and every migration's receipt matches.
14
+ */
15
+ import type { FlyReleaseInput, FlyReleaseOutput } from "../../components/fly-release.js";
16
+ export interface FlyReleaseArgs extends FlyReleaseInput {
17
+ /** The environment the release ships to: its receipts and recorded configs. (`env` is the Machine's env, as for the capability.) */
18
+ environment: string;
19
+ /** The component the release belongs to, for attribution. Default `app`. */
20
+ component?: string;
21
+ }
22
+ export type FlyReleaseResult = FlyReleaseOutput;
23
+ export declare function flyRelease(args: FlyReleaseArgs): Promise<FlyReleaseResult>;
24
+ //# sourceMappingURL=fly-release-step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fly-release-step.d.ts","sourceRoot":"","sources":["../../../src/op/activities/fly-release-step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEtF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,oIAAoI;IACpI,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD,wBAAsB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAKhF"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `flyRollback`: the `fly-rollback` capability (../../components/fly-release.ts)
3
+ * as an Op activity (#2800), so a rollback Op puts an earlier release back on
4
+ * the Machine the way the release Op's `flyRelease` put it there.
5
+ *
6
+ * It restores the Machine config `fly-release` recorded for the release it
7
+ * goes back to (files included), in the environment `environment` names, and
8
+ * checks that the Machine is started with that release. Given `source`, the
9
+ * archive is read only once it hashes to its digest, before any flaps call,
10
+ * and the recorded config must carry exactly that tree, or nothing changes.
11
+ * A release with no recorded config is refused by name.
12
+ *
13
+ * Running it again once the Machine serves the release changes nothing.
14
+ * Migrations are not undone: the data stays where the later release left it.
15
+ */
16
+ import type { FlyRollbackInput, FlyRollbackOutput } from "../../components/fly-release.js";
17
+ export interface FlyRollbackArgs extends FlyRollbackInput {
18
+ /** The environment whose recorded Machine configs are read. */
19
+ environment: string;
20
+ /** The component the release belongs to, for attribution. Default `app`. */
21
+ component?: string;
22
+ }
23
+ export type FlyRollbackResult = FlyRollbackOutput;
24
+ export declare function flyRollback(args: FlyRollbackArgs): Promise<FlyRollbackResult>;
25
+ //# sourceMappingURL=fly-rollback-step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fly-rollback-step.d.ts","sourceRoot":"","sources":["../../../src/op/activities/fly-rollback-step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAExF,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAElD,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAKnF"}
@@ -8,13 +8,19 @@
8
8
  export { flyApply, toApplyResult, flyDelete, applyApp, applyMachine, destroyMachine, deleteApp, listMachines, pruneMachines, waitForMachine, acquireLease, releaseLease, withLease, resolveEndpoint, parsePlan, isAppRequest, isMachineRequest, machineAppSegment, resolveApp, appNameFromRequest, isChantOwned, configEqual, isLeaseConflict, defaultFlyHttp, DEFAULT_FLAPS_BASE_URL, LEASE_NONCE_HEADER, } from "./fly-apply.js";
9
9
  export type { FlyApplyArgs, FlyPlan, FlapsRequest, FlapsMachine, FlyHttp, WaitOpts, ApplyCtx } from "./fly-apply.js";
10
10
  export { flyMachineRelease, flyMachineExec, flyMachineRestart, flyMachineStop, flyMachineVerify, flyMachineRestore, } from "./machine-release.js";
11
- export type { MachineRelease, FlyMachineReleaseArgs, FlyMachineReleaseResult, FlyMachineExecArgs, FlyMachineExecResult, FlyMachineStateArgs, FlyMachineVerifyArgs, FlyMachineRestoreArgs, } from "./machine-release.js";
11
+ export { flyRelease } from "./fly-release-step.js";
12
+ export type { FlyReleaseArgs, FlyReleaseResult } from "./fly-release-step.js";
13
+ export { flyRollback } from "./fly-rollback-step.js";
14
+ export type { FlyRollbackArgs, FlyRollbackResult } from "./fly-rollback-step.js";
15
+ export type { MachineRelease, FlyMachineReleaseArgs, FlyMachineReleaseResult, MachineFile, FlyMachineExecArgs, FlyMachineExecResult, FlyMachineStateArgs, FlyMachineVerifyArgs, FlyMachineRestoreArgs, } from "./machine-release.js";
12
16
  export { flapsUp, flapsDown, flapsRunCommand, flapsRmCommand, flapsExistsCommand, flapsHealthUrl, flapsEndpoint, } from "./flaps.js";
13
17
  export type { FlapsUpArgs, FlapsDownArgs } from "./flaps.js";
14
18
  export { spriteCreate, spriteExec, spriteCheckpoint, spriteRestore, listCheckpoints, spriteDestroy, spriteDelete, spriteUrl, resolveSpritesEndpoint, resolveSpritesToken, defaultSpritesHttp, spriteCreateBody, parseCreateResponse, accumulateExecFrames, parseCheckpointNdjson, pickCheckpointByComment, splitCommand, spriteExecWsUrl, DEFAULT_SPRITES_BASE_URL, } from "./sprites.js";
15
19
  export type { SpritesHttp, SpriteCreateArgs, SpriteCreateResult, SpriteExecArgs, SpriteExecResult, SpriteCheckpointArgs, SpriteCheckpointResult, SpriteRestoreArgs, ListCheckpointsArgs, Checkpoint, SpriteDestroyArgs, SpriteDeleteArgs, SpriteUrlArgs, SpriteUrlResult, } from "./sprites.js";
16
20
  export { spriteServiceCreate, spriteServiceGet, spriteServiceList, spriteServiceStart, spriteServiceStop, spriteServiceDelete, spriteServiceLogs, spriteServiceCreateBody, parseServiceLogNdjson, } from "./sprite-services.js";
17
21
  export type { SpriteService, SpriteServiceState, SpriteServiceCreateArgs, SpriteServiceGetArgs, SpriteServiceListArgs, SpriteServiceStartArgs, SpriteServiceStopArgs, SpriteServiceDeleteArgs, SpriteServiceLogsArgs, SpriteServiceLogsResult, } from "./sprite-services.js";
22
+ export { spriteServicesObserve, spriteServiceRestart, declaredServices, findSpriteEnv, parseServicesList, probeHealth, } from "./sprite-service-converge.js";
23
+ export type { DeclaredSpriteService, SpriteServicesObserveArgs, SpriteServicesObserveResult, SpriteServiceRestartArgs, SpriteServiceRestartResult, } from "./sprite-service-converge.js";
18
24
  export { spriteWriteFile, spriteReadFile, spriteListDir, spriteRemove, spriteFsUrl, defaultSpritesRawHttp, } from "./sprite-fs.js";
19
25
  export type { SpritesRawHttp, SpriteWriteFileArgs, SpriteReadFileArgs, SpriteReadFileResult, SpriteListDirArgs, SpriteDirEntry, SpriteRemoveArgs, } from "./sprite-fs.js";
20
26
  export { spriteApplyNetworkPolicy, spriteApplyServices, validateNetworkRules, networkRulesEqual, validateServices, serviceConfigEqual, } from "./sprite-config.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMlH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,OAAO,EACP,SAAS,EACT,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAQ1D,OAAO,EACL,YAAY,EACZ,UAAU,EACV,gBAAgB,EA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uB,EACvB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMlH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,E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B,EACvB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,WAAW,GACZ,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AAInC,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACX,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAMrB,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,EAC9B,WAAW,EACX,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
@@ -69,8 +69,24 @@ export interface FlyMachineReleaseArgs extends FlapsTarget {
69
69
  image?: string;
70
70
  /** Env to add to the declared Machine's env. */
71
71
  env?: Record<string, string>;
72
+ /**
73
+ * Files the release puts on the Machine, added to the declared ones: a
74
+ * source release's tree (#2782). A declared file at the same path is
75
+ * replaced.
76
+ */
77
+ files?: MachineFile[];
78
+ /** The command the Machine starts, in place of the image's: an argv, or a string run with `sh -c`. */
79
+ cmd?: string[] | string;
72
80
  wait?: WaitOpts;
73
81
  }
82
+ /** One file a Machine's config carries, as the Machines API takes it. */
83
+ export interface MachineFile {
84
+ guest_path: string;
85
+ /** The file's bytes, base64. */
86
+ raw_value: string;
87
+ /** Unix mode, such as 0o755 for an executable. */
88
+ mode?: number;
89
+ }
74
90
  export interface FlyMachineReleaseResult {
75
91
  app: string;
76
92
  machine: {
@@ -1 +1 @@
1
- {"version":3,"file":"machine-release.d.ts","sourceRoot":"","sources":["../../../src/op/activities/machine-release.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAaL,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AAGrB,OAAO,EAA2C,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE1H,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACxG,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAoB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ExC;AAID,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,oBAAoB,EAC1B,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,OAAoC,EAC1C,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC,CAoClD;AAID,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,iGAAiG;IACjG,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,OAAoC,GACzC,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC,CAgBnD"}
1
+ {"version":3,"file":"machine-release.d.ts","sourceRoot":"","sources":["../../../src/op/activities/machine-release.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAaL,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,EAC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H,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,oBAAoB,EAC1B,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,OAAoC,EAC1C,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC,CAoClD;AAID,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,iGAAiG;IACjG,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,OAAoC,GACzC,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC,CAgBnD"}
@@ -6,6 +6,8 @@
6
6
  * call, answered from memory with the response shapes flaps and mudflaps use.
7
7
  * Unit tests inject it where the default client would reach the network; the
8
8
  * docker-gated tests run the same activities against the pinned mudflaps.
9
+ * It runs nothing; ./machines-local.ts is the opt-in mode that runs each
10
+ * started Machine's files and command on this host (#2831).
9
11
  *
10
12
  * Not an activity: nothing in ./index.ts exports it, so `loadActivities`
11
13
  * never binds it.
@@ -43,8 +45,8 @@ export interface MachinesFake {
43
45
  machine(app: string, name: string): FakeMachine | undefined;
44
46
  }
45
47
  export interface MachinesFakeOptions {
46
- /** Answer an exec. Default: exit 0 with no output. */
47
- exec?: (app: string, machine: FakeMachine, command: string[]) => FakeExecResult;
48
+ /** Answer an exec. Default: exit 0 with no output. The running mode (./machines-local.ts) answers it by running the command. */
49
+ exec?: (app: string, machine: FakeMachine, command: string[]) => FakeExecResult | Promise<FakeExecResult>;
48
50
  /** The state a created or updated machine settles in. Default `started`. */
49
51
  settle?: (machine: FakeMachine) => string;
50
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"machines-fake.d.ts","sourceRoot":"","sources":["../../../src/op/activities/machines-fake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,kCAAkC;AAClC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CACzE;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IACrC,qEAAqE;IACrE,KAAK,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC7D,wDAAwD;IACxD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sDAAsD;IACtD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;CAC7D;AAED,MAAM,WAAW,mBAAmB;IAClC,sDAAsD;IACtD,IAAI,CAAC,EAAE,CAAC,GAAG,EAA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MAAM,EAAE,CAAC;IAChB,sDAAsD;IACtD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;CAC7D;AAED,MAAM,WAAW,mBAAmB;IAClC,gIAAgI;IAChI,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1G,4EAA4E;IAC5E,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,CAAC;CAC3C;AAOD,+BAA+B;AAC/B,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CA4GlF"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A local Fly Machines API that runs its Machines (#2831), as a command:
3
+ *
4
+ * tsx node_modules/@intentius/chant-lexicon-fly/src/op/activities/machines-local-cli.ts \
5
+ * [--listen 4280] [--root <dir>] [--publish <port> | --publish <name>=<port> ...] [--log <file>]
6
+ *
7
+ * Point the release activities at it with `FLY_FLAPS_BASE_URL=http://127.0.0.1:4280`.
8
+ * `--publish 8080` publishes every Machine's service on 8080; `--publish web=8080`
9
+ * publishes the Machine named `web` there; with no `--publish` each Machine gets a free
10
+ * port, which the event lines say. SIGINT or SIGTERM stops every Machine's process
11
+ * and exits. See ./machines-local.ts.
12
+ */
13
+ import { type LocalPublish } from "./machines-local.js";
14
+ export declare function parseArgs(argv: string[]): {
15
+ port: number;
16
+ root?: string;
17
+ publish?: LocalPublish;
18
+ log?: string;
19
+ };
20
+ //# sourceMappingURL=machines-local-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machines-local-cli.d.ts","sourceRoot":"","sources":["../../../src/op/activities/machines-local-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEzE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAyB/G"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * A local Fly Machines API that runs its Machines (#2831).
3
+ *
4
+ * ./machines-fake.ts answers the flaps endpoints from memory and runs nothing,
5
+ * and so does mudflaps. That is what unit tests want, and it stays the
6
+ * default. This module is the opt-in running mode: the same in-memory API,
7
+ * with each started Machine run as a process on this host, so a release that
8
+ * puts a source tree on a Machine (`config.files` plus `init.cmd`) can be
9
+ * checked over HTTP.
10
+ *
11
+ * For each Machine the fake holds in state `started`:
12
+ *
13
+ * - `config.files` are written at their `guest_path` (under `root` when one
14
+ * is given), and the files an earlier instance wrote are removed first, as
15
+ * a Machine's root filesystem starts again from its image;
16
+ * - `config.mounts` are directories that outlive instances (a Volume);
17
+ * - `init.exec`, or `init.entrypoint` then `init.cmd`, runs with
18
+ * `config.env`, and an `exec` (a migration) runs its command with the same
19
+ * env;
20
+ * - a service's `internal_port` is published on a host port: when the
21
+ * Machine's env sets `PORT` to an `internal_port`, the process gets the
22
+ * host port instead, since every Machine here shares the host's network.
23
+ *
24
+ * No image is pulled: the command runs on this host's binaries (a Node app
25
+ * runs on this host's Node).
26
+ *
27
+ * A create or an update (a new `instance_id`) starts the process again, a
28
+ * `restart` restarts it, a `stop` or a delete stops it, and a process that
29
+ * exits on its own leaves its Machine `stopped`. Each call answers only after
30
+ * that is done, and a started process is given until its published port
31
+ * accepts a connection, so the next call (a migration's exec, a health check)
32
+ * finds the files and the server.
33
+ *
34
+ * Processes run in their own process group. `close()` stops them all
35
+ * (SIGTERM, then SIGKILL); if the host process exits or is ended by SIGINT,
36
+ * SIGTERM or SIGHUP first, they are killed with it. Only a SIGKILL of the host
37
+ * process can leave them running.
38
+ */
39
+ import { type FakeMachine, type MachinesFake, type MachinesFakeOptions } from "./machines-fake.js";
40
+ /** Where a Machine's service is published: one port for every Machine, a port per Machine name (or `app/name`), or a function. */
41
+ export type LocalPublish = number | Record<string, number> | ((app: string, machine: FakeMachine) => number | undefined);
42
+ export interface LocalMachinesOptions {
43
+ /**
44
+ * A host directory the Machines' guest paths are placed under: `/srv/app`
45
+ * becomes `<root>/srv/app`, in the files written, the mounts, and the
46
+ * command, exec and env strings that name those paths. Default: none, so a
47
+ * guest path is the same path on this host (a container or a box made for it).
48
+ */
49
+ root?: string;
50
+ /** The host port a Machine's service is published on. Default: a free port per Machine, kept for its name. */
51
+ publish?: LocalPublish;
52
+ /** A file the processes' stdout and stderr are appended to. Default: this process's stderr. */
53
+ log?: string;
54
+ /** How long a started process is given to accept a connection on its published port. Default 15s. */
55
+ readyTimeoutMs?: number;
56
+ /** How long a stopped process is given after SIGTERM before SIGKILL. Default 5s. */
57
+ stopTimeoutMs?: number;
58
+ /** What happens, one line at a time (starts, stops, execs). Default: nothing is said. */
59
+ onEvent?: (line: string) => void;
60
+ /**
61
+ * Kill the processes when this process gets SIGINT, SIGTERM or SIGHUP, then raise the signal again if nothing
62
+ * else handles it. Default true; a caller that handles those signals itself (and calls `close()`) passes false.
63
+ */
64
+ handleSignals?: boolean;
65
+ /** Passed to the fake: the state a created or updated Machine settles in. */
66
+ settle?: MachinesFakeOptions["settle"];
67
+ }
68
+ /** A Machine's process, as {@link LocalMachines.processes} reports it. */
69
+ export interface LocalProcess {
70
+ app: string;
71
+ id: string;
72
+ name: string;
73
+ instance: string;
74
+ pid: number | undefined;
75
+ /** The host port its service is published on, when its env names one. */
76
+ port: number | undefined;
77
+ }
78
+ export interface LocalMachines extends MachinesFake {
79
+ /** `http://127.0.0.1:<port>` for the running Machine `name` in `app`, when its service is published. */
80
+ endpoint(app: string, name: string): string | undefined;
81
+ /** The processes running now. */
82
+ processes(): LocalProcess[];
83
+ /** Stop every process and remove its files. Mounts are kept. */
84
+ close(): Promise<void>;
85
+ }
86
+ /** An in-memory Machines API that runs each started Machine on this host. See the module header. */
87
+ export declare function createLocalMachines(options?: LocalMachinesOptions): LocalMachines;
88
+ export interface ServeLocalMachinesOptions extends LocalMachinesOptions {
89
+ /** The port the Machines API listens on. Default 4280, mudflaps' port; 0 picks a free one. */
90
+ port?: number;
91
+ /** Default 127.0.0.1. */
92
+ host?: string;
93
+ }
94
+ export interface ServedLocalMachines {
95
+ /** The flaps base URL, for `FLY_FLAPS_BASE_URL` or an `endpoint` argument. */
96
+ url: string;
97
+ machines: LocalMachines;
98
+ /** Stop every Machine's process, then the server. */
99
+ close(): Promise<void>;
100
+ }
101
+ /**
102
+ * Serve {@link createLocalMachines} over HTTP, where the release activities
103
+ * reach it through `FLY_FLAPS_BASE_URL`. `GET /_mudflaps/health` answers 200,
104
+ * as mudflaps' health check does.
105
+ */
106
+ export declare function serveLocalMachines(options?: ServeLocalMachinesOptions): Promise<ServedLocalMachines>;
107
+ //# sourceMappingURL=machines-local.d.ts.map