Skip to content

Native local-deploy targets: AWS (floci) + vanilla k8s (k3d) as Ops #704

Closed

Description

@lex00

Goal

Ship reusable Ops for the two local-deploy targets that have no open questions —
emulated AWS via floci and vanilla k8s via k3d — so "deploy chant locally, no
cloud account" is a first-class flow. Azure and GCP are gated on feasibility research
and tracked separately (see the companion research issue).

Why Ops, not a lexicon

An Op (packages/core/src/op/) is an imperative, phased procedure with primitives like
kubectlApply, helmInstall, waitForStack — exactly "provision, wait, apply, tear
down." k3d and Floci are backends you provision and point an apply at, not resource
catalogs to serialize. Placement follows the capability-relocation seam: the Floci
activity lives in the aws lexicon; the k3d activity is cloud-agnostic (core or the
k8s lexicon).

Target 1 — floci (emulated AWS)

Already feasible: chant's cfn-deploy honors AWS_ENDPOINT_URL
(lexicons/aws/src/components/cloud-executor.ts), and floci emulates the CloudFormation
control plane (/_localstack/health reports cloudformation). This work packages the
boot/teardown that test/components-aws-e2e.sh and test/adopt-alb-services-e2e.sh
already do by hand.

  • flociUp / flociDown activities (in the aws lexicon):
    • docker run -d --rm -p <port>:4566 floci/floci:<pin>; port configurable
      (E2E uses 4599 to avoid clashing with anything on 4566).
    • Mount /var/run/docker.sock when ECR is needed — floci ≥ 1.5.30 starts a real
      backing container for the ECR registry.
    • Health-check GET /_localstack/health until cloudformation is ready.
    • Export AWS_ENDPOINT_URL=http://localhost:<port> and dummy creds
      (AWS_ACCESS_KEY_ID=test, AWS_SECRET_ACCESS_KEY=test, AWS_REGION).
    • flociDown: docker rm -f the container.
  • local-aws.op.ts composing: boot → wait-ready → apply (existing component /
    cfn-deploy path, unchanged) → teardown.

Target 2 — k3d (vanilla k8s)

No unknowns; real Kubernetes, kubectl apply unchanged.

  • k3dUp / k3dDown activities (core or k8s lexicon):
    • k3d cluster create <name> (optional --config <k3d.yaml> for
      ports/registry/agents), merge kubeconfig.
    • k3dDown: k3d cluster delete <name>.
  • local-k8s.op.ts composing: create → wait nodes Ready → kubectlApply an
    existing chant k8s stack → teardown.
  • Enables the GCP feasibility spike in the research issue (Config Connector needs a
    cluster to run on).

Optional

Wire a local lifecycle env so chant lifecycle plan local and the apply naturally
target the local backend.

Reference points

  • packages/core/src/op/{builders,index,local-executor,resource}.ts (Op machinery;
    resource.ts is the Temporal::Op orchestrate binding).
  • lexicons/aws/src/components/cloud-executor.ts (AWS_ENDPOINT_URL injection).
  • test/components-aws-e2e.sh, test/adopt-alb-services-e2e.sh (the bash to replace).

Acceptance criteria

  • flociUp/flociDown + local-aws.op.ts: an existing AWS example
    (e.g. adopt-alb-services) deploys end-to-end via the Op, with bring-up and
    teardown owned by the Op — no hand-written boot bash.
  • k3dUp/k3dDown + local-k8s.op.ts: an existing k8s stack applies to a k3d
    cluster the Op creates and destroys.
  • Activities placed per the seam (Floci in aws, k3d agnostic).
  • The two E2E scripts' boot/teardown steps are replaced by (or thin wrappers over)
    the Ops.

Out of scope

  • Azure (floci-az) and GCP (floci-gcp) — feasibility unknown, see companion research
    issue.
  • The browser/WASM sandbox and hosted agent loop (parked).
  • Real-cloud deploys (same Ops, BYO creds).

Activity

  1. added
    enhancement
    on Jul 7, 2026
  2. lex00 commented on Jul 7, 2026

    @lex00
    ContributorAuthor

    Companion research issue for Azure + GCP feasibility: #705

  3. lex00 commented on Jul 7, 2026

    @lex00
    ContributorAuthor

    Deploy-Op coverage audit (2026-07-07) — reuse vs gaps

    Checked what deploy Ops/apply paths chant already has, so this work extends them rather than rebuilding:

    • AWS — ✅ mature. lexicons/aws/src/components/ ships apply.ts, cloud-executor.ts (honors AWS_ENDPOINT_URL), publish.ts, wait-aws.ts, safety.ts, … and real deploy Ops exist: examples/gitlab-aws-alb-op/ops/alb-deploy.op.ts, lexicons/aws/examples/lifecycle-reconcile-aws/ops/{apply,reconcile}.op.ts. ⇒ the floci-aws Op wraps the existing AWS apply (local emulator bring-up around components/apply.ts), not a new path.
    • k8s — ✅. Core activities kubectlApply/helmInstall/waitForStack; deploy Ops like examples/k8s-gke-microservice/ops/gke-bootstrap.op.ts. ⇒ the k3d Op wraps existing kubectlApply with cluster bring-up.
    • Azure — ❌ gap. The azure lexicon has no components/ dir and no deploy Op — only ops/lexicon-upgrade/azure-upgrade.op.ts (a version bump). Azure deploy today = emit an ARM template and run az deployment by hand (only documented in the chant-azure skills).

    Implication: k3d + floci-aws here are low-risk reuse. But Azure has no first-class apply path at all, so even after the floci-az deployments provider (#705), chant still needs an Azure apply Op/component before local (or real) Azure deploys are usable. Flagged on #705.

  4. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ k3d Op — done in #708 (merged).

    • k3dUp/k3dDown builders (core) + activity impls (temporal lexicon) with idempotent create; k3d merges kubeconfig + switches context so a following kubectlApply targets the cluster.
    • Pure command-builders + unit tests (8).
    • Demo op examples/local-op-quickstart/ops/local-k8s.op.ts: k3d up → apply → wait → down.

    Remaining for this issue: the floci-aws Op (flociUp/flociDown in the aws lexicon, wrapping components/apply.ts + AWS_ENDPOINT_URL).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions