Ensemble
Guides

Deploying

ens deploy <name> <kit> takes the delivery manifest at ci/<name>/delivery.yml, resolves it against a deploy kit, and runs one of four terminations against it. For local, iterative work, see Local development and ens develop instead — this page covers the full model behind it.

A workload only one kit can deploy (a serverless stack only aws has provisioners for, say) can name it once in .ensemble/config.yaml, so ens deploy <name> and ens develop <name> need no kit argument:

deploy:
  <name>:
    kit: aws

Terminations

Exactly one of these runs per invocation (the default is apply):

Flag What it does
(none) Apply — bring the workload up (or reconcile it to its declared state).
--eject Render the kit's artifact (e.g. a compose.yaml) to the outputs directory and stop. No apply.
--plan Render, then show the intent-diff against the last apply/plan, and stop.
--watch Run the kit's long-lived watch command instead of a one-shot apply, torn down on Ctrl+C. A kit/target with no watch command (e.g. aws) surfaces an error.

--eject and --plan can't be combined with each other or with --watch.

Instances and tearing down

--instance <slug> deploys the manifest as a named instance beside its plain deployment — a branch's preview, say. The instance gets its own deployment name (<repo>-<name>--<slug>), rendered artifact, render cache and operation snapshot, so any number of them run side by side. The slug is a DNS label. A gateway on an ingress network answers there to that deployment name unless its manifest sets alias, so instances sharing a network never answer for each other. Each deploy records where it can be reached (.ensemble/deploy/<name>--<slug>/<kit>.ingress.json: networks, alias, port and hosts) for whatever fronts it. The hostnames an instance answers on are ordinary per-environment values the pipeline puts in the environment — ens doesn't derive them.

ens deploy web compose --instance feat-login
ens destroy web compose --instance feat-login   # or: ens deploy … --destroy

ens destroy runs the kit's own teardown (docker compose down --volumes for compose) and drops the state ens deploy kept for it. It needs no environment values and no render, only that the manifest and kit exist. A kit with no native teardown (aws) reports that instead. Externals, such as the edge network, are never removed.

Previews

A preview is an instance of a manifest built from one branch, reachable at its own hosts, and taken down when the branch is deleted. The platform (source/apps/platform, deployed as ci/platform) runs them: on each push to a branch a manifest tracks, it checks the branch out on its own and runs ens deploy <manifest> <kit> --artifacts local --instance preview-<slug> there; on the branch's deletion, ens destroy with the same instance.

Its values start from one of the manifest's environments — never production: a preview runs whatever its branch holds, and can read every value it is given — with the variables a browser sees set for each preview from templates:

domain = {internal}
dashboard_origin = https://{host:dashboard}

{internal} is the preview's own domain (<slug>.<project>.preview.internal), which only its gateway sees: route hosts under it, the same way the manifest's environments route hosts under their real domain. Each such host is published as one label under the preview domain — dashboard.<internal> as dashboard--<slug>--<project>.ensemble.blue, {internal} itself as <slug>--<project>.ensemble.blue — so one wildcard certificate covers every preview. {host} and {host:<subdomain>} are those public hosts; {slug} and {branch} name the branch.

The platform's router fronts every deployment it makes, previews included: it routes each host a deployment recorded (<kit>.ingress.json, see Instances and tearing down) to that deployment's gateway on the ingress network, asking a preview's gateway for its internal host. Bring the platform up once per host:

export PLATFORM_SECRET_KEY=$(openssl rand -base64 32)   # keep it
export AUTH_SECRET=$(openssl rand -base64 32)
ens deploy platform compose --artifacts local --emulate-externals

The platform reaches GitHub as GitHub Apps of its own. Its Integrations › GitHub page creates one — under your account or an organization, with GitHub asking you to confirm — and then sends you to install it on the repositories to release and deploy. The apps are private, so each can only be installed on its owner's repositories: to reach another account's, add another app owned by it from the same page. Each app clones, fetches and pushes releases with short-lived tokens it is issued, and commits and tags as its own bot. They share one webhook, https://<platform>/hooks/github, for every repository they're installed on: a push to a project's branch syncs it, and a push to or deletion of any branch keeps its previews in step. Projects are added from the repositories any app is installed on, one project per repository, named after it: its id is the repository's name as a DNS label (Material_Dispatcher becomes material-dispatcher, cut to twenty characters), and a second repository of the same name is refused.

The Deployments page lists every compose stack ens deploy left on the machine, whoever ran it. Each is traced to the GitHub repository its checkout's origin points at, so a stack deployed from any clone of a project's repository shows under that project; one whose repository is no project yet offers to add it, and one that can't be traced (no checkout left, or a remote off GitHub) shows as unclaimed.

Nothing the platform answers for is open to everyone. Its own UI and API are behind an idhn guard that lets only signed-in operators through (GitHub's webhooks aside, which verify themselves); every preview is reached only once the previews' guard has let the request through, which signed-in operators and previewers pass. Sign-in is the stack's own khatm, at auth.<domain>, whose cookie is set on the preview domain so one sign-in covers the platform and every preview — and is taken out of every request before it reaches a deployment. Roles come from khatm (khatm users set-role <user> operator|previewer); who holds which is the platform's base policies' (source/ship/platform-policies/base).

The guards, judge, policy builder and khatm are built FROM the images idhn and khatm publish (ghcr.io/ritajhq/…). To build from another registry or a pinned version, give the ship a pack var — source/envs/pack/<ship>.env, read by every pack and passed to the Dockerfile as a build argument:

# source/envs/pack/platform-guard.env
GUARD_IMAGE=registry.example.com/idhn/guard-standalone:0.3.1

A preview runs whatever its branch holds, on the same Docker host as the platform: track only branches whose authors you'd let deploy there.

Resolving releases

  • --artifacts local|published (default published) — whether ${release.<name>} references resolve to a locally-packed image or a published one.
  • --version <version> (default latest) — the released version to resolve published ${release.*} references against.
  • --no-pack — skip packing referenced releases before a local apply (ignored for published artifacts, where packing already happened at release time).
  • --verbose — show a local apply's pack step's own build-tool output (e.g. docker buildx build's progress log) instead of hiding it behind the pack spinner.

Capabilities and externals

  • --accept-capability-gaps — proceed even if the target kit can't satisfy a capability the manifest requests (otherwise ens deploy hard-fails). See Capabilities and classes.
  • --emulate-externals — before applying, stand up a local substitute for each declared external resource the kit knows how to emulate (e.g. docker network create for an external network) instead of assuming it already exists elsewhere. Can't be combined with --eject/--plan.

explain

ens deploy <name> <kit> explain <category.name>

Explains one resource's resolution: which provisioner matched (and why others didn't), each value's provenance, any accepted capability gaps, and the resolved outputs. <resource> is category.name, e.g. databases.primary. Takes the same --artifacts/--version flags as deploy itself, to control which release locator gets resolved.

Choosing a target

Three deploy kits ship with this repo — see Kits for what each one drops:

ens deploy web compose      # docker compose — one host
ens deploy web aws          # CloudFormation — ECS, RDS, Lambda, … in your own account
ens deploy web cloudflare   # Workers, KV and R2, through wrangler

There is no kubernetes kit in this repo.

Full reference

See the ens deploy CLI reference for every flag and ens develop for the local-dev shorthand.