Pure stack planning (hc-4). A Resolution (what the capability resolver
answers) becomes a StackPlan for one run: every instance under a compose
project (the provider's own name when shared, <provider>-<consumer>-<run>
when private), its services and docker labels; every consumer on its own
view network hive-<run>-<consumer>, joined by the instances it is bound to
under their original service names (network aliases, never an env
rewrite); and a start order. Then: a terraform-plan style diff against what
already runs, the image lockfile value, and a refcounted release of
instances across stacks, generalising promote.plan to services spanning
compose projects. Decision 20261122141106-2d375c4f. No IO here.
Pure stack planning (hc-4). A Resolution (what the capability resolver answers) becomes a StackPlan for one run: every instance under a compose project (the provider's own name when shared, `<provider>-<consumer>-<run>` when private), its services and docker labels; every consumer on its own view network `hive-<run>-<consumer>`, joined by the instances it is bound to under their original service names (network aliases, never an env rewrite); and a start order. Then: a terraform-plan style diff against what already runs, the image lockfile value, and a refcounted release of instances across stacks, generalising promote.plan to services spanning compose projects. Decision 20261122141106-2d375c4f. No IO here.
(holders active-stacks run instance-id)(holders active-stacks run instance-id active-sections){[compose-project service] [holder]}: every service live stacks other than
instance instance-id of run run keep alive, with who keeps it: [run
instance-id] for a stack instance, [:section profile-id] for an active
section (promote.plan's active map) of that compose project.
{[compose-project service] [holder]}: every service live stacks other than
instance `instance-id` of run `run` keep alive, with who keeps it: [run
instance-id] for a stack instance, [:section profile-id] for an active
section (promote.plan's active map) of that compose project.(instance-footprint ip)What instance plan ip keeps alive, as #{[compose-project service]}: its
services and the depends_on closure they need (:instance/needs).
What instance plan `ip` keeps alive, as #{[compose-project service]}: its
services and the depends_on closure they need (`:instance/needs`).(instance-labels run stack-id iid i)Labels on an instance's containers. A shared instance carries only
hive.instance: a per-run label on a service shared across runs would change
its compose config hash and recreate it on every new run's up, so per-run
ownership of a shared instance lives on the view networks (labels). A
private one carries hive.run, hive.stack, hive.instance and hive.consumer.
Labels on an instance's containers. A shared instance carries only hive.instance: a per-run label on a service shared across runs would change its compose config hash and recreate it on every new run's up, so per-run ownership of a shared instance lives on the view networks (`labels`). A private one carries hive.run, hive.stack, hive.instance and hive.consumer.
(instance-release active-stacks run instance-id)(instance-release active-stacks run instance-id active-sections)The release step for instance instance-id of run run among
active-stacks ({run StackPlan}, the run itself included): the services of
its footprint that no other live stack instance (and, given
active-sections, no active section) keeps alive. An instance another live
stack still binds releases nothing. :kept names, per spared service, who
keeps it. nil when the run has no such instance.
The release step for instance `instance-id` of run `run` among
`active-stacks` ({run StackPlan}, the run itself included): the services of
its footprint that no other live stack instance (and, given
`active-sections`, no active section) keeps alive. An instance another live
stack still binds releases nothing. `:kept` names, per spared service, who
keeps it. nil when the run has no such instance.(labels run stack-id)(labels run stack-id instance-id)Docker labels of what run run of stack stack-id creates; with
instance-id, also the instance label.
Docker labels of what run `run` of stack `stack-id` creates; with `instance-id`, also the instance label.
(lock sp digests)The lockfile value of sp: {instance-id {:image :digest}} from digests,
{[compose-project service] {:image :digest}} as the engine reports it, read
at each instance's own service. Instances with no reported digest are left
out.
The lockfile value of `sp`: {instance-id {:image :digest}} from `digests`,
{[compose-project service] {:image :digest}} as the engine reports it, read
at each instance's own service. Instances with no reported digest are left
out.(lock-path state-file stack-id)Where the lockfile of stack stack-id lives: locks/<stack>.lock.edn
beside the state file state-file.
Where the lockfile of stack `stack-id` lives: `locks/<stack>.lock.edn` beside the state file `state-file`.
(plan-diff sp running)Terraform-plan style summary of sp against running, a set of
{:project <compose project> :service <service>} already up. Per instance in
start order: :mode :shared or :private, :state :running (every service up),
:to-start (none) or :partial, and which services are up and which start.
:summary counts them.
Terraform-plan style summary of `sp` against `running`, a set of
{:project <compose project> :service <service>} already up. Per instance in
start order: :mode :shared or :private, :state :running (every service up),
:to-start (none) or :partial, and which services are up and which start.
`:summary` counts them.(project-compose-name p)The compose project name a Project runs under: :project/name, else the
name compose derives from :project/dir.
The compose project name a Project runs under: `:project/name`, else the name compose derives from `:project/dir`.
(render-diff {:keys [stack run instances consumers summary]})diff (plan-diff) as printable text: one line per instance (= running,
`diff` (plan-diff) as printable text: one line per instance (= running, + to start, ~ partly running), then each consumer's view network and the instances joining it.
(stack-held active-stacks){compose-project #{service}} every live stack instance keeps alive: what a section release (promote.plan, which cannot see stacks) must also spare.
{compose-project #{service}} every live stack instance keeps alive: what a
section release (promote.plan, which cannot see stacks) must also spare.(stack-plan settings resolution run opts)Result<StackPlan> for resolution in run run. settings gives the
provider projects (:compose/projects); opts {:stack id} names the stack
(default "default"). Errors: :compose/invalid-run, :compose/invalid-resolution,
:compose/inconsistent-resolution (a binding to an unknown instance, a
capability mismatch, a private instance bound by another consumer),
:compose/unknown-provider, :compose/name-collision (two consumers slugging
to one view network, two private instances to one compose project),
:compose/alias-clash (two instances answering one alias on one consumer's
network) and :compose/alias-shadows-service (an instance alias equal to one
of the consumer's own service names, given in opts as
{:services {consumer [service]}}, which Docker DNS would shadow) and
:compose/dependency-cycle. A private instance's compose project is always
computed here (<provider compose name>-<slug consumer>-<run>), whatever
the resolution carried.
Result<StackPlan> for `resolution` in run `run`. `settings` gives the
provider projects (`:compose/projects`); `opts` {:stack id} names the stack
(default "default"). Errors: :compose/invalid-run, :compose/invalid-resolution,
:compose/inconsistent-resolution (a binding to an unknown instance, a
capability mismatch, a private instance bound by another consumer),
:compose/unknown-provider, :compose/name-collision (two consumers slugging
to one view network, two private instances to one compose project),
:compose/alias-clash (two instances answering one alias on one consumer's
network) and :compose/alias-shadows-service (an instance alias equal to one
of the consumer's own service names, given in `opts` as
{:services {consumer [service]}}, which Docker DNS would shadow) and
:compose/dependency-cycle. A private instance's compose project is always
computed here (`<provider compose name>-<slug consumer>-<run>`), whatever
the resolution carried.(stack-releases active-stacks run)(stack-releases active-stacks run active-sections)Release steps for taking run run down, instances in reverse start order
against a shrinking set of live stacks, so a service two instances of the
run share goes with the last of them and whatever another stack or
section keeps stays.
Release steps for taking run `run` down, instances in reverse start order against a shrinking set of live stacks, so a service two instances of the run share goes with the last of them and whatever another stack or section keeps stays.
(topo-order deps)Result<[node]>: deps ({node [node]}, every dep a key) in dependency order,
ties broken by sort order so the answer is deterministic. A cycle is an
error naming the nodes on it.
Result<[node]>: `deps` ({node [node]}, every dep a key) in dependency order,
ties broken by sort order so the answer is deterministic. A cycle is an
error naming the nodes on it.(with-needs sp closures)sp with each instance's :instance/needs filled from closures
({[compose-project service] [service]}, the engine's depends_on closure of
the instance's service), so plan-diff and the refcount cover dependencies
too. hc-6 calls it before it persists the plan.
`sp` with each instance's `:instance/needs` filled from `closures`
({[compose-project service] [service]}, the engine's depends_on closure of
the instance's service), so plan-diff and the refcount cover dependencies
too. hc-6 calls it before it persists the plan.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |