Liking cljdoc? Tell your friends :D

hive-compose.promote.stack-run

Pure parts of running a stack (hc-6): run ids, the ProjectSpec each instance and consumer is brought up with (see hive-compose.port/IStackEngine), readiness, what a release spares, and which runs the reaper takes.

Placement rules (decision 20261122141106-2d375c4f):

  • a SHARED instance runs under its provider's own compose project with the project's own files and NO stack override: it is the same container a section up of that project runs, so neither a second stack nor a section ever recreates it. Its stack membership lives in the state file (:stacks), not in labels;
  • a PRIVATE instance runs under <provider-project>-<consumer>-<run> with an override putting hive.run / hive.stack / hive.instance on every service of its closure;
  • a CONSUMER (a project or a section with containers) runs under <consumer-project>-<run>, labelled hive.run / hive.stack / hive.consumer, attached only to its view network, its wiring env passed into its containers by name (values stay in memory until spawn). Instances join view networks with docker network connect --alias, so nothing is recreated for a new consumer.

Every created network and every container a stack run creates under a run-scoped compose project carries hive.run. No IO.

Pure parts of running a stack (hc-6): run ids, the ProjectSpec each
instance and consumer is brought up with (see hive-compose.port/IStackEngine),
readiness, what a release spares, and which runs the reaper takes.

Placement rules (decision 20261122141106-2d375c4f):
- a SHARED instance runs under its provider's own compose project with the
  project's own files and NO stack override: it is the same container a
  section `up` of that project runs, so neither a second stack nor a section
  ever recreates it. Its stack membership lives in the state file
  (`:stacks`), not in labels;
- a PRIVATE instance runs under `<provider-project>-<consumer>-<run>` with
  an override putting hive.run / hive.stack / hive.instance on every
  service of its closure;
- a CONSUMER (a project or a section with containers) runs under
  `<consumer-project>-<run>`, labelled hive.run / hive.stack /
  hive.consumer, attached only to its view network, its wiring env passed
  into its containers by name (values stay in memory until spawn).
Instances join view networks with `docker network connect --alias`, so
nothing is recreated for a new consumer.

Every created network and every container a stack run creates under a
run-scoped compose project carries hive.run. No IO.
raw docstring

claim-live?clj

(claim-live? claim now claim-ttl-ms)

True while claim holds at now: the one law sections use (promote.swarm/claim-end), with no swarm roster asked. A wave claim holds until its :until, any other while renewed within claim-ttl-ms.

True while `claim` holds at `now`: the one law sections use
(`promote.swarm/claim-end`), with no swarm roster asked. A wave claim holds
until its :until, any other while renewed within `claim-ttl-ms`.
sourceraw docstring

consumer-compose-projectclj

(consumer-compose-project settings consumer run)

The compose project consumer consumer runs under in run: <its project's compose name>-<run> for a project, <compose name>-<slug target>-<run> for a section <project>/<target>, so two sections of one project in one run never share a compose project (nor its override).

The compose project consumer `consumer` runs under in `run`:
`<its project's compose name>-<run>` for a project, `<compose name>-<slug
target>-<run>` for a section `<project>/<target>`, so two sections of one
project in one run never share a compose project (nor its override).
sourceraw docstring

consumer-labelclj

source

consumer-labelsclj

(consumer-labels run stack-id consumer)

hive.run, hive.stack and hive.consumer of consumer in run of stack-id.

hive.run, hive.stack and hive.consumer of `consumer` in `run` of `stack-id`.
sourceraw docstring

consumer-project-idclj

(consumer-project-id consumer)

The project id of a project or section consumer <project>[/<target>].

The project id of a project or section consumer `<project>[/<target>]`.
sourceraw docstring

consumer-specclj

(consumer-spec settings run stack-id consumer services wiring injected wait?)

ProjectSpec of consumer in run: services (its closure), the whole Wiring env for compose (wiring), only the injected variable names (what the stack adds: endpoints, tenancy, HIVE_RUN_ID, OTLP) passed into its containers, its labels, and its view network as its only network.

ProjectSpec of `consumer` in `run`: `services` (its closure), the whole
Wiring env for compose (`wiring`), only the `injected` variable names (what
the stack adds: endpoints, tenancy, HIVE_RUN_ID, OTLP) passed into its
containers, its labels, and its view network as its only network.
sourceraw docstring

container-consumer?clj

(container-consumer? consumer)

True when consumer runs containers of its own: a project or a section, not a stack's own needs (stack:) nor a suite (suite:, run by hc-8).

True when `consumer` runs containers of its own: a project or a section,
not a stack's own needs (`stack:`) nor a suite (`suite:`, run by hc-8).
sourceraw docstring

held-by-othersclj

(held-by-others runs run)

#{[compose-project service]} the instances of every live run but run keep alive (runs {run StackPlan}).

#{[compose-project service]} the instances of every live run but `run`
keep alive (`runs` {run StackPlan}).
sourceraw docstring

idle-runsclj

(idle-runs stacks now {:keys [ttl-ms orphan-ttl-ms claim-ttl-ms]})

Runs of stacks ({run entry}) the reaper takes down at now: no live claim, and idle past the TTL since :last-touch (the orphan TTL once its last claim ended, :orphaned-at). ttls {:ttl-ms :orphan-ttl-ms :claim-ttl-ms}. An entry with :idle-action :none is never reaped.

Runs of `stacks` ({run entry}) the reaper takes down at `now`: no live
claim, and idle past the TTL since `:last-touch` (the orphan TTL once its
last claim ended, `:orphaned-at`). `ttls` {:ttl-ms :orphan-ttl-ms
:claim-ttl-ms}. An entry with `:idle-action :none` is never reaped.
sourceraw docstring

instance-overridesclj

(instance-overrides settings ip caps facts)

{service {mem_limit cpus environment}} (string keys) that caps instance ip (hc-16a): its answering services get caps (InstanceCaps) and, when they run a JVM (:jvm?, else detected from the image in facts {service {:image :java-tool-options}}), JAVA_TOOL_OPTIONS with the heap flag merged under the service's own options (the compose file's, else the provider project's env). The JVM flag goes only where a mem_limit is written. The closure services (:closure of caps, {service bytes}, see resources/with-closure) get a mem_limit too, unless their own compose file sets one (:mem-limit in facts), and the flag when their image is a JVM. Services that need nothing are left out.

{service {mem_limit cpus environment}} (string keys) that caps instance `ip`
(hc-16a): its answering services get `caps` (InstanceCaps) and, when they
run a JVM (`:jvm?`, else detected from the image in `facts` {service
{:image :java-tool-options}}), JAVA_TOOL_OPTIONS with the heap flag merged
under the service's own options (the compose file's, else the provider
project's env). The JVM flag goes only where a mem_limit is written. The
closure services (`:closure` of `caps`, {service bytes}, see
resources/with-closure) get a mem_limit too, unless their own compose file
sets one (`:mem-limit` in `facts`), and the flag when their image is a JVM.
Services that need nothing are left out.
sourceraw docstring

instance-specclj

(instance-spec settings ip wait?)

ProjectSpec of planned instance ip (a StackPlan instance, with :instance/needs its depends_on closure when known): a shared one as its provider project runs it, a private one labelled over its whole closure.

ProjectSpec of planned instance `ip` (a StackPlan instance, with
`:instance/needs` its depends_on closure when known): a shared one as its
provider project runs it, a private one labelled over its whole closure.
sourceraw docstring

mark-preexistingclj

(mark-preexisting marks running runs run section-held)

Preexistence marks ({provider-project #{service}}) after a run found running ({provider-project #{service}}: what of its shared instances' footprints ran before it started). A running service is the world's, and marked, unless another live run's instance holds it (runs, {run StackPlan}, this run excluded; the last of them releases it) or an active section holds it (section-held, {compose-project #{service}}, which keeps and releases it). Shared instances run under their provider's compose project, so running keys are both provider and compose project. A mark of a running service is never cleared, so whichever run leaves last never removes what ran before the runs; only reconcile-preexisting drops the mark of one that no longer runs. Pure; computed against the state current inside the swap, under the stack lock.

Preexistence marks ({provider-project #{service}}) after a run found
`running` ({provider-project #{service}}: what of its shared instances'
footprints ran before it started). A running service is the world's, and
marked, unless another live run's instance holds it (`runs`, {run
StackPlan}, this run excluded; the last of them releases it) or an active
section holds it (`section-held`, {compose-project #{service}}, which
keeps and releases it). Shared instances run under their provider's
compose project, so `running` keys are both provider and compose project.
A mark of a running service is never cleared, so whichever run leaves
last never removes what ran before the runs; only `reconcile-preexisting`
drops the mark of one that no longer runs. Pure; computed against the
state current inside the swap, under the stack lock.
sourceraw docstring

not-readyclj

(not-ready health services)

{service {:state :health}} of services that are not ready in health (absent ones as {:state "missing"}).

{service {:state :health}} of `services` that are not ready in `health`
(absent ones as {:state "missing"}).
sourceraw docstring

otel-capabilityclj

source

otlp-envsclj

(otlp-envs resolution run)

The extra-envs-fn for promote.wiring/wirings: a consumer bound to an otel instance in resolution gets the OTLP env (endpoint on its view network: http://<alias>:4317, the bound instance's first alias, which is the name it joins that network under; with its protocol as a pair, service name and hive.run.id). A consumer bound to none gets nothing: no endpoint nobody answers.

The extra-envs-fn for `promote.wiring/wirings`: a consumer bound to an
`otel` instance in `resolution` gets the OTLP env (endpoint on its view
network: `http://<alias>:4317`, the bound instance's first alias, which
is the name it joins that network under; with its protocol as a pair,
service name and hive.run.id). A consumer bound to none gets nothing: no
endpoint nobody answers.
sourceraw docstring

preexisting-ofclj

(preexisting-of marks step)

[service] marked preexisting for the provider project of release step ({:project ..}): every down step spares them, whichever instance or run.

[service] marked preexisting for the provider project of release `step`
({:project ..}): every down step spares them, whichever instance or run.
sourceraw docstring

ready?clj

(ready? health services)

True when every one of services has a container in health ({service {:state :health}}) that runs and is :healthy or has no healthcheck (:none).

True when every one of `services` has a container in `health`
({service {:state :health}}) that runs and is :healthy or has no
healthcheck (:none).
sourceraw docstring

reconcile-preexistingclj

(reconcile-preexisting marks probed running runs run)

Preexistence marks with those a run's probe disproves dropped. probed is #{[provider-project service]}: the footprints of the run's shared instances, which the probe read. running is {provider-project #{service}}: what of them ran. A mark of a probed service that does not run, and that no other live run's instance holds (runs {run StackPlan}, run excluded), is the world's no longer: whoever removed it took it back, so this run starts it and owns it, and its down releases it. A mark of a running service, or of one outside the probe, stays. Pure; computed inside the swap, under the stack lock.

Preexistence marks with those a run's probe disproves dropped. `probed`
is #{[provider-project service]}: the footprints of the run's shared
instances, which the probe read. `running` is {provider-project
#{service}}: what of them ran. A mark of a probed service that does not
run, and that no other live run's instance holds (`runs` {run StackPlan},
`run` excluded), is the world's no longer: whoever removed it took it
back, so this run starts it and owns it, and its down releases it. A
mark of a running service, or of one outside the probe, stays. Pure;
computed inside the swap, under the stack lock.
sourceraw docstring

run-idclj

(run-id stack-id hex)

The RunId of a new run of stack stack-id: its id lower-cased with every char outside [a-z0-9] dropped, cut to 30, then hex (6 lowercase hex chars): "shop" -> "shop3f9a1c". A stack id with no such char yields "run<hex>".

The RunId of a new run of stack `stack-id`: its id lower-cased with every
char outside [a-z0-9] dropped, cut to 30, then `hex` (6 lowercase hex
chars): "shop" -> "shop3f9a1c". A stack id with no such char yields
"run<hex>".
sourceraw docstring

spare-stack-heldclj

(spare-stack-held step held)

Section release step step (promote.plan: {:project :services ..}) with the services live stack instances keep alive (held, hc-4 stack/stack-held: {compose-project #{service}}) moved from :services to :kept as [:stack]: a section down or reap never stops a stack's instance.

Section release step `step` (promote.plan: {:project :services ..}) with
the services live stack instances keep alive (`held`, hc-4
`stack/stack-held`: {compose-project #{service}}) moved from :services to
:kept as [:stack]: a section down or reap never stops a stack's instance.
sourceraw docstring

sparing-preexistingclj

(sparing-preexisting step preexisting)

Release step step (hc-4 instance-release) with the services that ran before this run brought them up (preexisting, [service]) moved from :services to :kept as :preexisting: a run never removes what it did not start.

Release step `step` (hc-4 instance-release) with the services that ran
before this run brought them up (`preexisting`, [service]) moved from
:services to :kept as :preexisting: a run never removes what it did not
start.
sourceraw docstring

stack-needs-per-consumerclj

(stack-needs-per-consumer stack)

{consumer Needs}: the stack's own :stack/needs as extra needs of each of its container consumers, so a capability the stack needs (otel) is bound by every consumer and joins every view network. Empty when the stack needs nothing.

{consumer Needs}: the stack's own `:stack/needs` as extra needs of each of
its container consumers, so a capability the stack needs (otel) is bound
by every consumer and joins every view network. Empty when the stack
needs nothing.
sourceraw docstring

whole-project?clj

(whole-project? ip step)

True when release step of a private instance takes its whole compose project down: it is private and nothing of it is kept.

True when release `step` of a private instance takes its whole compose
project down: it is private and nothing of it is kept.
sourceraw docstring

with-overridesclj

(with-overrides spec overrides)

ProjectSpec spec carrying overrides (from instance-overrides) as :service-overrides, unchanged when there are none.

ProjectSpec `spec` carrying `overrides` (from `instance-overrides`) as
`:service-overrides`, unchanged when there are none.
sourceraw docstring

without-providedclj

(without-provided services ips)

services of a consumer minus what its own provided instances (ips, hc-4 :consumer/provider-of) run, their depends_on closures included: a consumer step never re-ups an instance it provides.

`services` of a consumer minus what its own provided instances (`ips`,
hc-4 `:consumer/provider-of`) run, their depends_on closures included: a
consumer step never re-ups an instance it provides.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close