Skip to content

feat: managed application deployment (WordPress + WooCommerce trial) - #82

Draft
mrgoonie wants to merge 40 commits into
mainfrom
feat/managed-application-deployment
Draft

mrgoonie wants to merge 40 commits into
mainfrom
feat/managed-application-deployment

Conversation

@mrgoonie

@mrgoonie mrgoonie commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Draft. Managed application deployment, first trial on WordPress + WooCommerce (#66). Must not merge before the v0.1.0-alpha tag; needs its own security review.

What is in it so far

  • pkg/managedapp: the sisf-app.yaml contract (runtime image pinned by digest, content bundle, data volumes, Owner-declared dependencies such as the database, checks, sensitive-change policy). Strict parsing.
  • sisf adopt: writes the Spec from a Compose project (WordPress detector) or a Go program; refuses plain-text secrets without printing them.
  • pkg/managedapp/checkrun, sisf app check: HTTP journeys (health, home, catalogue, sandbox purchase); results carry measured facts only.
  • pkg/appbundle, sisf app bundle: reproducible bundle from pinned archives checked by sha256; nothing is executed; traversal, links, devices and size bombs refused; data-volume mountpoints included.
  • sisf app advisories: pinned advisory snapshot scan (finds CVE-2020-35489 in Contact Form 7 5.3.1).
  • pkg/deploy, adapters/deploy/compose, internal/dockerfilter: artifact = (image digest, bundle digest) via PairDigest, signing payload v3; bundle loaded once into a digest-named read-only volume by a never-started loader; the deploy role of the Docker filter enforces the mount rules.
  • ADR 0027 (proposed). feat(release): follow main for the commit to build on and stop an unreleasable run before QA #77 landed first with its own 0026, so this one is 0027.
  • Trial shop: examples/woocommerce-app, mirrored to the private repo bestagentkits/sisf-trial-woocommerce.

Evidence

  • 3/3 onboarding cycles deployed, seeded (100 products, 20 customers, 50 orders), verified and completed a sandbox purchase; identical bundle digest and orders checksum each time. The home latency check failed in 2/3 under host load from unrelated containers; the bound was not relaxed. Report: plans/reports/onboarding-261113-2023-three-cycles.md.

Still to come in this PR

Supervisor wiring, fault injection, good/failing/sensitive updates, backup/restore, an AI fix with independent QA, 72h observation. Decisions are recorded in plans/261113-1443-managed-application-deployment/decisions.md.

Not edited (proposal for the Owner)

DECISIONS.md should index ADR 0027.

Release smoke on real Docker (2026-11-16)

examples/woocommerce-app/bin/release-smoke.sh runs the shop through the factory's own deploy path (deploy-role Docker filter, Compose backend, edge, release pipeline) on OrbStack. Passed on run 10; report in plans/reports/smoke-261116-1435-managed-shop-real-docker-release.md.

  • Good update (WooCommerce 11.2.1 to 11.2.2): closed after the 5/25/100% windows, the observed revision is the v2 pair. A sandbox purchase through the edge succeeded afterwards.
  • Failing update (the shop plugin calls a missing function): 5% window 20/20 server errors, 25% window 100/100, rolled back with cause BlockRolledBack to v2; the edge then serves v2. The test now requires that cause, so a rollback for low traffic no longer passes.
  • Data: the 50 original orders keep their sha256, orders 50 to 51 (the purchase), products and customers unchanged; a mariadb-dump restored into a copy matches the live database.
  • Not yet covered: the supervisor wiring of this path, the hourly prober, fault injection, the AI fix and the 72h observation.
  • A 100% failing canary still reaches 25% before rollback because two breaching windows are needed (120 customer 500s instead of 20). That is the shared release policy, so it goes to its own issue.

… deployment

Signed-off-by: Goon <duy@wearetopgroup.com>
…s over

Signed-off-by: Goon <duy@wearetopgroup.com>
sisf adopt reads a Compose project or a Go program and writes sisf-app.yaml. Runtime, data, dependencies and secrets come from Compose for every stack; what one stack knows lives only in its detector (WordPress, Go program). Secret values are never copied: a plain-text password is refused by name.

Signed-off-by: Goon <duy@wearetopgroup.com>
…d facts

Signed-off-by: Goon <duy@wearetopgroup.com>
Build a managed application's content bundle in trusted factory code: parse
the lockfile, fetch each pinned archive and check its sha256 before reading
it, unpack it under its kind's directory, apply prune paths, copy repository
sources, and write a reproducible tar with its digest. Entries that escape,
link or are not plain files are refused, and sizes are bounded while read.

Classify lockfile changes against the Owner-approved baseline, and let the
supervisor verify a candidate-influenced bundle tar and its digest.

Signed-off-by: Goon <duy@wearetopgroup.com>
…ules

Signed-off-by: Goon <duy@wearetopgroup.com>
…app bundle

Signed-off-by: Goon <duy@wearetopgroup.com>
…ies to

Signed-off-by: Goon <duy@wearetopgroup.com>
…ndle

Signed-off-by: Goon <duy@wearetopgroup.com>
…bundle

Signed-off-by: Goon <duy@wearetopgroup.com>
… volume

A managed application's revision is a pair: the runtime image the Owner
pinned and a content bundle assembled by trusted code. This makes the pair
deployable through the Compose backend and the Docker request filter
without any host path.

Shared contract change in pkg/deploy/deploy.go: Artifact gains Bundle, a
sha256 digest that is empty for an image-only artifact. When it is set,
Validate requires the image on one line and Digest equal to
PairDigest(image, bundle) = sha256("sisf.pair.v1\n" + image + "\n" +
bundle), so the release record binds the pair. SigningPayload binds the
bundle last and moves to version 3; every earlier signature stops
verifying.

The Compose backend loads each bundle once into a named volume,
<factory>-bundle-<12 hex>: it creates the volume, creates a loader of the
runtime image that is never started, uploads the verified tar into it,
and removes the loader, with the anonymous volumes its image declares, on
every path. Loads are serialised. A failed load also removes the volume,
and a loader left by a load that was cut off makes the next Stage load the
bundle again. Revisions mount the volume read-only at the
configured target, run as the configured uid:gid and get the configured
environment and data volumes. Image-only artifacts are unchanged.

The deploy role of the filter enforces the mount rule itself. A revision
mounts at most one bundle volume, read-only, at the bundle target, plus
only the configured data volumes. A loader mounts only its bundle's
volume read-write, has no command, environment or network, and is never
started; only a loader may be removed with its anonymous volumes. Uploads
go only into a stopped loader at the fixed path and are streamed within a
size bound. Volumes are created only as labelled bundle
volumes with no driver options. A user must be a numeric uid:gid other
than root, and the environment must match the configured list exactly.
The runner role is unchanged and refuses every new endpoint.

Signed-off-by: Goon <duy@wearetopgroup.com>
Signed-off-by: Goon <duy@wearetopgroup.com>
Signed-off-by: Goon <duy@wearetopgroup.com>
…review

Signed-off-by: Goon <duy@wearetopgroup.com>
…tored builds still verify

Signed-off-by: Goon <duy@wearetopgroup.com>
…ine before release

Signed-off-by: Goon <duy@wearetopgroup.com>
…dles that match their digest

Signed-off-by: Goon <duy@wearetopgroup.com>
…s image and bundle

Signed-off-by: Goon <duy@wearetopgroup.com>
… Docker

Signed-off-by: Goon <duy@wearetopgroup.com>
…dled for a managed application

Signed-off-by: Goon <duy@wearetopgroup.com>
…he accepted set

Signed-off-by: Goon <duy@wearetopgroup.com>
…ervisor's probe reads

Signed-off-by: Goon <duy@wearetopgroup.com>
…e bytes the supervisor holds

Signed-off-by: Goon <duy@wearetopgroup.com>
…ore releasing it

Signed-off-by: Goon <duy@wearetopgroup.com>
…ch release

Signed-off-by: Goon <duy@wearetopgroup.com>
…ed by container name

Signed-off-by: Goon <duy@wearetopgroup.com>
… real traffic

Signed-off-by: Goon <duy@wearetopgroup.com>
…w that counts it

Signed-off-by: Goon <duy@wearetopgroup.com>
… unhealthy, not unjudged

Signed-off-by: Goon <duy@wearetopgroup.com>
…ld on

Signed-off-by: Goon <duy@wearetopgroup.com>
…ec through one derivation shared with the deploy filter

Signed-off-by: Goon <duy@wearetopgroup.com>
… supervisor

Signed-off-by: Goon <duy@wearetopgroup.com>
@mrgoonie

Copy link
Copy Markdown
Contributor Author

Release-side wiring of a managed application (commits ac5465b, 9788d87)

  • managedapp.Spec.Revision(Binding) derives a revision once: image, port, user, env, bundle mount, the install's data volumes and the secrets volume read-only. compose.Config.UseRevision and dockerfilter.Config.AdmitRevision read that one value; sisf install docker-filter and the supervisor take the same --app-spec, --app-volume, --app-secrets-volume.
  • Supervisor with --app-spec (compose only): bundles from the trust volume, appbundle.PairObserver as the release observer, and the Spec's read-only checks (health, home, catalogue) as the synthetic suite for a low-traffic release. The purchase is never sent to a live revision; --synthetic-program is refused beside --app-spec. New flags --deploy-host-suffix and --deploy-ready-timeout.
  • Tests: the shop staged through a filter built from the same Spec; a revision that drifts by one entry (writable secrets, extra env, another volume) is refused by the filter; misconfigurations refused (local backend, relative Spec, binding without Spec, unbound volume); read-only checks pass and fail a release and never send a write.
  • Real Docker: the smoke now builds its filter and backend from the shared derivation and passed (2026-11-19, 110 s test): good update closed, failing update rolled back by its 5xx rate (5%: 20/20, 25%: 100/100), original orders unchanged, backup restore matches. 2 of 3200 requests got 502 from the edge, around a revision switch; to be looked at with the canary issue release: a canary that fails every request still advances a step before rollback #89.
  • Decisions L (72h topology: supervisor and edge native on the Mac, revisions in OrbStack, reached at <container>.orb.local) and M (one derivation) are in plans/261113-1443-managed-application-deployment/decisions.md.

Still open: a candidate build that yields a bundle into the supervisor's store, and the change gate on the release path (a Core upgrade must need a signed approval there, not only in the unit test). Until then a factory with --app-spec refuses every build, as it did.

…n Owner change only on the Owner's approval of its build

Signed-off-by: Goon <duy@wearetopgroup.com>
Signed-off-by: Goon <duy@wearetopgroup.com>
…it to the issue

Signed-off-by: Goon <duy@wearetopgroup.com>
Signed-off-by: Goon <duy@wearetopgroup.com>
…nce its tests pass

Signed-off-by: Goon <duy@wearetopgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant