Skip to content

fly: deploy Op + local-fly starter example (#744) - #759

Merged
lex00 merged 1 commit into
mainfrom
fly-example-744
Jul 11, 2026
Merged

lex00 merged 1 commit into
mainfrom
fly-example-744

Conversation

@lex00

@lex00 lex00 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Closes #744 (Phase 3 — the integration proof). A fly deploy Op composing boot → build → flyApply → wait → teardown, and a runnable examples/local-fly/ that deploys an App + Machine offline against the mudflaps emulator (#740) and, by dropping one override, against a real Fly org.

Deploy Op composite (lexicons/fly/src/composites/fly-deploy.ts)

flyDeploy() builds the five-phase Op, plus typed step builders (flapsUp/flapsDown/flyApplyStep) that wrap the generic activity() builder tagged with the activity names the fly lexicon exports (src/op/activities). The core registry resolves them by name when a project lists the fly lexicon — so these give gcpApply()-style DX with no packages/core change.

Emulator  flapsUp()      boot ghcr.io/intentius/mudflaps:0.3.0
Build     build:fly      → the serialized flaps plan
Apply     flyApply       create App + Machine, wait each to started via /wait
Verify    httpCheck      GET the app's machines, assert started
Teardown  flapsDown()    stop + remove the container

Example (examples/local-fly/)

One App + one Machine (src/infra.ts), ops/fly.op.ts = export default flyDeploy({ app }), chant.config.ts (lexicons: ["fly", "temporal"]), package/tsconfig, and a README walking the loop. The machine carries no manual metadata — the serializer stamps managed-by: chant (D2).

D3 — local vs real Fly

The endpoint defaults to local mudflaps (http://localhost:4280). One-line change to target a real org: flyDeploy({ app, endpoint: null }) + FLY_API_TOKEN. flyApply's resolveEndpoint then falls through to FLY_FLAPS_BASE_URL / https://api.machines.dev with the bearer token.

Verification

  • Full Op loop runs green end-to-end against live mudflaps: Emulator → Build → Apply (machine created) → Verify (started) → Teardown, "ok": true.
  • examples/examples.test.ts — describeExample("local-fly", …) build-validates the serialized plan (App app_name, Machine config + managed-by: chant) and asserts the Op's five phases compile. Docker isn't used in CI (mirrors the getting-started deploy Op's compile-only validation).
  • examples (174) + fly (83) suites pass. No packages/core change.

Note: like the trio, dist/ is gitignored and CI validates via in-process build() (a source-checkout chant bin can't run the loop due to a pre-existing module-duplication quirk that affects all examples equally; a real npm install runs it).

🤖 Generated with Claude Code

The integration proof for the epic: a fly deploy Op composing
boot → build → flyApply → wait → teardown on the local executor, and a
runnable examples/local-fly/ that deploys an App + Machine offline against
the mudflaps emulator (#740) and, by dropping the endpoint override, against a
real Fly org.

- lexicons/fly/src/composites/fly-deploy.ts — flyDeploy() builds the 5-phase Op
  plus typed step builders (flapsUp/flapsDown/flyApplyStep) that wrap the generic
  activity() builder, tagged with the activity names the fly lexicon exports from
  src/op/activities. The core registry resolves them by name when a project lists
  the fly lexicon, so these give gcpApply()-style DX with no core change.
- examples/local-fly/ — one App + one Machine (src/infra.ts), ops/fly.op.ts
  (export default flyDeploy({ app })), chant.config.ts (lexicons: fly, temporal),
  package.json/tsconfig/README. `chant run fly` boots mudflaps, builds, applies,
  verifies the machine reached started, tears down. README walks the loop and the
  one-line change to target real Fly (endpoint: null + FLY_API_TOKEN).
- examples/examples.test.ts — describeExample("local-fly", ...) build-validates
  the serialized plan (App app_name, Machine config + managed-by: chant) and
  asserts the Op's five phases compile. Docker is not used in CI (mirrors the
  getting-started deploy Op's compile-only validation).

Verified: the full Op loop runs green end to end against live mudflaps
(Emulator → Build → Apply → Verify started → Teardown, ok:true); examples and
fly suites pass. No packages/core change. Endpoint defaults to local mudflaps;
D3 real-Fly path is a one-line override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lex00
lex00 merged commit 6d61292 into main Jul 11, 2026
5 checks passed
@lex00
lex00 deleted the fly-example-744 branch July 11, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fly lexicon: Fly deploy Op + local-fly starter example (App+Machine end-to-end)

1 participant