The compose engine port. Every method answers a Result.
The compose engine port. Every method answers a Result.
Who talks to a local port right now.
Who talks to a local port right now.
(-peers a ports){port #{peer}}: the remote endpoints ("addr:port") of the TCP
connections accepted on each of local ports, listening sockets left
out. A port nobody is connected to is absent.
{port #{peer}}: the remote endpoints ("addr:port") of the TCP
connections accepted on each of local `ports`, listening sockets left
out. A port nobody is connected to is absent.Optional runner capability: run a host command to completion (hc-9 data
commands declared as :command), unlike IProgramRunner/-start!, which
detaches a long-lived program.
Optional runner capability: run a host command to completion (hc-9 data commands declared as `:command`), unlike `IProgramRunner/-start!`, which detaches a long-lived program.
(-run-command! r argv opts)Result<{:exit 0 :out}>: run argv with opts {:dir path :env {VAR
EnvValue} :timeout-ms n} and wait for it; secret references in :env are
read only now. A non-zero exit is :compose/command-failed carrying :exit
and :stderr.
Result<{:exit 0 :out}>: run `argv` with `opts` {:dir path :env {VAR
EnvValue} :timeout-ms n} and wait for it; secret references in :env are
read only now. A non-zero exit is :compose/command-failed carrying :exit
and :stderr.(-profiles e profile)Result<#{name}>: native compose profiles declared by the profile's project.
Result<#{name}>: native compose profiles declared by the profile's project.
(-projects e)Result<[{:name :status :config-files}]>: every compose project on the host.
Result<[{:name :status :config-files}]>: every compose project on the host.
(-up! e profile services)Result<{:out}>: start services detached. An empty services is a no-op.
Result<{:out}>: start `services` detached. An empty `services` is a no-op.
(-restart! e profile services recreate?)Result<{:out}>: restart the containers of services in place, or, when
recreate?, recreate them (never their depends_on, never volumes). Empty is a no-op.
Result<{:out}>: restart the containers of `services` in place, or, when
`recreate?`, recreate them (never their depends_on, never volumes). Empty is a no-op.(-listed e profile)Result<[service]>: services enabled for profile: the always-on ones plus those of its native compose profiles.
Result<[service]>: services enabled for `profile`: the always-on ones plus those of its native compose profiles.
(-version e)Result<string>: the engine's version, or why it is unavailable.
Result<string>: the engine's version, or why it is unavailable.
(-logs e profile services tail)Result<{:out}>: the last tail log lines of services (all when empty).
Result<{:out}>: the last `tail` log lines of `services` (all when empty).
(-running e profile)Result<#{service}>: services of the profile's project whose containers are running.
Result<#{service}>: services of the profile's project whose containers are running.
(-stop! e profile services)Result<{:out}>: stop services, keeping containers and volumes. Empty is a no-op.
Result<{:out}>: stop `services`, keeping containers and volumes. Empty is a no-op.
(-down! e profile services)Result<{:out}>: remove the containers of services, never volumes. Empty is a no-op.
Result<{:out}>: remove the containers of `services`, never volumes. Empty is a no-op.
(-closure e profile)Result<[service]>: the services profile needs, its depends_on closure included.
Result<[service]>: the services `profile` needs, its depends_on closure included.
Optional engine capability: the addresses the running containers of a project hold on their networks, so the connections they open to the project's own published ports are not taken for use of it.
Optional engine capability: the addresses the running containers of a project hold on their networks, so the connections they open to the project's own published ports are not taken for use of it.
(-addresses e profile)Result<#{ip}>: the network addresses of the running containers of the profile's project.
Result<#{ip}>: the network addresses of the running containers of the profile's project.
Optional engine capability: release a project's containers by name, found by their compose labels, without loading its compose files. What an adopted section runs may come from a file its project does not name, and a file that needs a variable nobody set cannot be loaded at all; neither keeps a release by name from running.
Optional engine capability: release a project's containers by name, found by their compose labels, without loading its compose files. What an adopted section runs may come from a file its project does not name, and a file that needs a variable nobody set cannot be loaded at all; neither keeps a release by name from running.
(-stop-containers! e profile services action)Result<{:out :containers [name]}>: stop (action :stop) or remove
(:down, never volumes) the containers of services in the profile's
compose project, addressed by container name. A service with no
container is skipped. Empty services is a no-op.
Result<{:out :containers [name]}>: stop (`action` :stop) or remove
(:down, never volumes) the containers of `services` in the profile's
compose project, addressed by container name. A service with no
container is skipped. Empty `services` is a no-op.Optional engine capability: which container runs each service now, so a call can say whether it recreated a service or left it alone.
Optional engine capability: which container runs each service now, so a call can say whether it recreated a service or left it alone.
(-container-ids e profile services)Result<{service id}>: the id of the container of each of services in the
profile's compose project, by label (no compose file is loaded). A service
with no container is absent.
Result<{service id}>: the id of the container of each of `services` in the
profile's compose project, by label (no compose file is loaded). A service
with no container is absent.Optional engine capability: how busy the running containers of a project are, so a section working with no client connected (a batch job, a queue worker) can count as use.
Optional engine capability: how busy the running containers of a project are, so a section working with no client connected (a batch job, a queue worker) can count as use.
(-cpu e profile)Result<{service percent}>: the CPU use, in percent of one core, of each running service of the profile's project (the busiest of its containers).
Result<{service percent}>: the CPU use, in percent of one core, of each
running service of the profile's project (the busiest of its containers).Optional engine capability: which containers the daemon runs and what a section's services hold, so a process can be told apart from the containers that own it, and its holdings matched to a section.
Optional engine capability: which containers the daemon runs and what a section's services hold, so a process can be told apart from the containers that own it, and its holdings matched to a section.
(-live-containers e)Result<#{id}>: full ids of every container the daemon reports running.
Result<#{id}>: full ids of every container the daemon reports running.
(-resources e profile services)Result<{:volumes #{name} :ports #{port}}>: the docker volumes (their real
names) mounted by services of the profile's project and the host ports
they publish.
Result<{:volumes #{name} :ports #{port}}>: the docker volumes (their real
names) mounted by `services` of the profile's project and the host ports
they publish.Optional engine capability: run a data command (migrate, seed, reset) inside a running container of a stack instance (hc-9). Never removes a container or a volume.
Optional engine capability: run a data command (migrate, seed, reset) inside a running container of a stack instance (hc-9). Never removes a container or a volume.
(-exec! e target argv opts)Result<{:exit 0 :out}>: docker exec of argv in the running container of
target ({:project compose-project :service svc}), with opts {:env
{VAR EnvValue} :timeout-ms n}; secret references in :env are read only
now. A non-zero exit is :compose/command-failed carrying :exit and
:stderr; no running container is :compose/no-container.
Result<{:exit 0 :out}>: `docker exec` of `argv` in the running container of
`target` ({:project compose-project :service svc}), with `opts` {:env
{VAR EnvValue} :timeout-ms n}; secret references in :env are read only
now. A non-zero exit is :compose/command-failed carrying :exit and
:stderr; no running container is :compose/no-container.Optional engine capability: the depends_on edges of a project, so up can
leave out what the compose file marks required: false. An engine without
it closes over every depends_on entry, as before.
Optional engine capability: the depends_on edges of a project, so `up` can leave out what the compose file marks `required: false`. An engine without it closes over every depends_on entry, as before.
(-dependencies e profile)Result<{service {dep {:required? bool}}}>: the depends_on edges of the services the profile's project defines.
Result<{service {dep {:required? bool}}}>: the depends_on edges of the services the profile's project defines.
Optional engine capability: whether a project directory is there, so a section whose checkout was removed is not used as the source of a recreate.
Optional engine capability: whether a project directory is there, so a section whose checkout was removed is not used as the source of a recreate.
(-dir-exists? e dir)True when dir is an existing directory.
True when `dir` is an existing directory.
Append-only history of test case outcomes across runs (CaseOutcome rows,
see hive-compose.schema), read by hive-compose.promote.flaky.
Append-only history of test case outcomes across runs (CaseOutcome rows, see `hive-compose.schema`), read by `hive-compose.promote.flaky`.
(-append! h rows)Result<{:appended n}>: add rows to the history. Rows are never
rewritten or removed; appending a run again adds its rows again (the
reader keeps one per run). Empty rows is a no-op.
Result<{:appended n}>: add `rows` to the history. Rows are never
rewritten or removed; appending a run again adds its rows again (the
reader keeps one per run). Empty `rows` is a no-op.(-history h query)Result<[row]>: every row recorded, in append order, narrowed by query
{:suite s :project p} (a nil or absent key matches any). An absent
history is [].
Result<[row]>: every row recorded, in append order, narrowed by `query`
{:suite s :project p} (a nil or absent key matches any). An absent
history is [].The host's memory, so a stack plan can be admitted against what is free and the reaper can relieve pressure (hc-16a). Stubbed in tests.
The host's memory, so a stack plan can be admitted against what is free and the reaper can relieve pressure (hc-16a). Stubbed in tests.
(-mem-available m)Result<long>: MemAvailable in bytes (Linux /proc/meminfo), or why it cannot be read. Never a throw.
Result<long>: MemAvailable in bytes (Linux /proc/meminfo), or why it cannot be read. Never a throw.
The host's processes, as a value: what a dead rootless dockerd left
running is read from it (see hive-compose.promote.orphan).
The host's processes, as a value: what a dead rootless dockerd left running is read from it (see `hive-compose.promote.orphan`).
(-snapshot t)Result<Snapshot>: {:manager-pid :subuid :procs}, see
hive-compose.promote.orphan. An error when the table cannot be read
(another OS, no /proc), never a throw.
Result<Snapshot>: {:manager-pid :subuid :procs}, see
`hive-compose.promote.orphan`. An error when the table cannot be read
(another OS, no /proc), never a throw.Optional runner capability: what a started program left behind once its process is gone, so a program that dies right after start can say why. A runner without it reports the death alone.
Optional runner capability: what a started program left behind once its process is gone, so a program that dies right after start can say why. A runner without it reports the death alone.
(-exit-code r pid)The exit code of pid, started by this runner and since exited; nil while
it lives or when this runner did not start it (a pid kept across a restart).
The exit code of `pid`, started by this runner and since exited; nil while it lives or when this runner did not start it (a pid kept across a restart).
(-log-tail r log n)[line]: the last n non-blank lines of the program log log, [] when it is absent.
[line]: the last `n` non-blank lines of the program log `log`, [] when it is absent.
Host programs: the processes a section runs outside compose.
Host programs: the processes a section runs outside compose.
(-alive? r pid)True while the process pid lives.
True while the process `pid` lives.
(-facts r dir)Result<{file-name parsed}>: the build files of dir (shadow-cljs.edn, deps.edn, bb.edn as EDN; project.clj as true).
Result<{file-name parsed}>: the build files of `dir` (shadow-cljs.edn, deps.edn, bb.edn as EDN; project.clj as true).
(-halt! r pid)Result<{:pid :stopped?}>: terminate the process group pid leads. Halting a dead pid succeeds.
Result<{:pid :stopped?}>: terminate the process group `pid` leads. Halting a dead pid succeeds.
(-listening? r port)True when something accepts connections on local port.
True when something accepts connections on local `port`.
(-nrepl-port r dir)The port in dir's .nrepl-port file, nil when absent.
The port in `dir`'s .nrepl-port file, nil when absent.
(-start! r program log)Result<{:pid}>: start resolved program detached, leading its own process group, output appended to log.
Result<{:pid}>: start resolved `program` detached, leading its own process group, output appended to `log`.
Optional engine capability: the host ports the running containers of a project publish, so connections to them can count as use.
Optional engine capability: the host ports the running containers of a project publish, so connections to them can count as use.
(-published e profile)Result<{service #{port}}>: the host ports published by the running containers of the profile's project.
Result<{service #{port}}>: the host ports published by the running containers of the profile's project.
Optional engine capability: what services of a project run, so a stack
can tell a JVM image and keep its own JVM flags (hc-16a). An engine
without it is treated as knowing nothing: only :jvm? true injects.
Optional engine capability: what services of a project run, so a stack can tell a JVM image and keep its own JVM flags (hc-16a). An engine without it is treated as knowing nothing: only `:jvm? true` injects.
(-service-facts e profile services)Result<{service {:image string :java-tool-options string? :mem-limit
MemSize?}}>: the image each of services runs, the JAVA_TOOL_OPTIONS
and the memory limit its compose file sets.
Result<{service {:image string :java-tool-options string? :mem-limit
MemSize?}}>: the image each of `services` runs, the JAVA_TOOL_OPTIONS
and the memory limit its compose file sets.Optional engine capability: what a stack run needs beyond sections. View networks (one per consumer and run), compose projects brought up with labels and networks a stack adds, and what runs under given labels.
A ProjectSpec is {:project name :dir path :files [path] :services [svc]
:env {VAR EnvValue} :container-env [VAR] :labels {k v} :networks [name]
:wait? bool :wait-timeout-s n :all? bool}. :env is the environment of
the compose process (interpolation; its secret references read only when
containers are created); :container-env names the variables of :env
passed into every service of :services; :labels land on every
container of :services; with :networks those services attach to these
external networks instead of the project's default one (so Docker DNS on
them is never ambiguous; list every service that must reach another). An engine applies labels, networks and
container-env through a generated compose override (compose has no label
flag); a spec with none of them runs the project's own files untouched.
Optional engine capability: what a stack run needs beyond sections. View
networks (one per consumer and run), compose projects brought up with
labels and networks a stack adds, and what runs under given labels.
A ProjectSpec is {:project name :dir path :files [path] :services [svc]
:env {VAR EnvValue} :container-env [VAR] :labels {k v} :networks [name]
:wait? bool :wait-timeout-s n :all? bool}. `:env` is the environment of
the compose process (interpolation; its secret references read only when
containers are created); `:container-env` names the variables of `:env`
passed into every service of `:services`; `:labels` land on every
container of `:services`; with `:networks` those services attach to these
external networks instead of the project's default one (so Docker DNS on
them is never ambiguous; list every service that must reach another). An engine applies labels, networks and
container-env through a generated compose override (compose has no label
flag); a spec with none of them runs the project's own files untouched.(-down-project! e spec)Result<{:out}>: remove the containers of spec's :services, or with
:all? the whole compose project (its containers and own networks).
Never volumes.
Result<{:out}>: remove the containers of `spec`'s `:services`, or with
`:all?` the whole compose project (its containers and own networks).
Never volumes.(-network-connect! e network target aliases)Result<{:network :containers [name]}>: connect every container of
target ({:project :service}) to network under aliases. Idempotent: a
container already attached counts as connected.
Result<{:network :containers [name]}>: connect every container of
`target` ({:project :service}) to `network` under `aliases`. Idempotent: a
container already attached counts as connected.(-network-create! e network labels)Result<{:network :created? bool}>: create bridge network network with
labels ({k v}). Idempotent: an existing network answers :created? false.
Result<{:network :created? bool}>: create bridge network `network` with
`labels` ({k v}). Idempotent: an existing network answers :created? false.(-network-rm! e network)Result<{:network :removed? bool :disconnected [container]}>: disconnect
every container still attached to network, then remove it. An absent
network answers :removed? false.
Result<{:network :removed? bool :disconnected [container]}>: disconnect
every container still attached to `network`, then remove it. An absent
network answers :removed? false.(-networks-labelled e labels)Result<[{:name :labels {k v}}]>: every network carrying all labels.
Result<[{:name :labels {k v}}]>: every network carrying all `labels`.
(-running-labelled e labels)Result<[{:name :project :service :labels {k v} :state :health}]>: every
container, running or not, carrying all labels ({k v}). :state is the
docker state string ("running", "exited"), :health one of :healthy
:unhealthy :starting :none.
Result<[{:name :project :service :labels {k v} :state :health}]>: every
container, running or not, carrying all `labels` ({k v}). :state is the
docker state string ("running", "exited"), :health one of :healthy
:unhealthy :starting :none.(-up-project! e spec)Result<{:out}>: compose up -d (--wait when :wait?) of ProjectSpec
spec. Empty :services is a no-op.
Result<{:out}>: `compose up -d` (`--wait` when :wait?) of ProjectSpec
`spec`. Empty `:services` is a no-op.Runs one suite runner to its end under its resource caps (hc-16b): a host
command inside a memory-capped systemd user scope (ulimit -v when no user
manager answers), a container with docker's memory and cpu flags. See
hive-compose.promote.oom for the data.
A value of :env may be a secret reference, read only here, at spawn.
Every answer, ok or error, carries :scrub (fn [text]) -> text: the text
with every value the runner resolved from a reference replaced by that
reference's rendering. The caller passes every text it reads afterwards
(the reports) through it; a runner that resolved references and answers
no :scrub has its reports' free text redacted.
Runs one suite runner to its end under its resource caps (hc-16b): a host command inside a memory-capped systemd user scope (ulimit -v when no user manager answers), a container with docker's memory and cpu flags. See `hive-compose.promote.oom` for the data. A value of `:env` may be a secret reference, read only here, at spawn. Every answer, ok or error, carries `:scrub` (fn [text]) -> text: the text with every value the runner resolved from a reference replaced by that reference's rendering. The caller passes every text it reads afterwards (the reports) through it; a runner that resolved references and answers no :scrub has its reports' free text redacted.
(-run! r spec)Result<{:exit n-or-nil :started-at ms :finished-at ms :output [line]
:timed-out? bool :cap {:mode :systemd|:ulimit|:docker|:none :mem bytes?
:cpus n? :note s?} :oom Finding? :scrub fn}>: run spec (a runner spec,
see hive-compose.promote.suite/runner-spec: :runner :command|:container,
:command, :dir, :env, :timeout-ms, :pull-timeout-ms, :test-id,
:reports-dir (created before the runner starts), :image, :name, :mounts,
:network, :extra-networks, :labels, plus :resources {:mem bytes :cpus n})
and wait for its end. A runner that exits non-zero, is OOM-killed or
times out is an ok answer; an error (carrying :exit nil and :scrub) only
when it could not be started at all: a secret that cannot be read, no
docker, a pull that fails or times out.
Result<{:exit n-or-nil :started-at ms :finished-at ms :output [line]
:timed-out? bool :cap {:mode :systemd|:ulimit|:docker|:none :mem bytes?
:cpus n? :note s?} :oom Finding? :scrub fn}>: run `spec` (a runner spec,
see `hive-compose.promote.suite/runner-spec`: :runner :command|:container,
:command, :dir, :env, :timeout-ms, :pull-timeout-ms, :test-id,
:reports-dir (created before the runner starts), :image, :name, :mounts,
:network, :extra-networks, :labels, plus :resources {:mem bytes :cpus n})
and wait for its end. A runner that exits non-zero, is OOM-killed or
times out is an ok answer; an error (carrying :exit nil and :scrub) only
when it could not be started at all: a secret that cannot be read, no
docker, a pull that fails or times out.The agents working beside the addon and the channel that reaches them.
The agents working beside the addon and the channel that reaches them.
(-agents s)Result<[{:agent/id :agent/status :agent/cwd}]>: the live agents of the swarm, or an error when no swarm answers (no host).
Result<[{:agent/id :agent/status :agent/cwd}]>: the live agents of the
swarm, or an error when no swarm answers (no host).(-notify! s event data)Result<{:channel :direct|:broadcast ..}>: tell the swarm about event (a
keyword) with data ({:message string ..}). With :to (an agent id) in
data the notice is meant for that agent alone: :direct when it went to
it, :broadcast (with :fallback? true) when no directed channel resolved.
A notice that cannot be delivered is an error, never a throw.
Result<{:channel :direct|:broadcast ..}>: tell the swarm about `event` (a
keyword) with `data` ({:message string ..}). With `:to` (an agent id) in
`data` the notice is meant for that agent alone: :direct when it went to
it, :broadcast (with :fallback? true) when no directed channel resolved.
A notice that cannot be delivered is an error, never a throw.A Toxiproxy server's REST API (hc-12 fault injection). A proxy is {:name :listen :upstream :enabled :toxics [toxic]}, a toxic {"name" "type" "stream" "toxicity" "attributes"} as toxiproxy writes it. Every method answers a Result; an unreachable server is an error, never a throw.
A Toxiproxy server's REST API (hc-12 fault injection). A proxy is
{:name :listen :upstream :enabled :toxics [toxic]}, a toxic {"name"
"type" "stream" "toxicity" "attributes"} as toxiproxy writes it.
Every method answers a Result; an unreachable server is an error, never a
throw.(-add-toxic! c proxy-name toxic)Result<toxic>: add toxic to proxy proxy-name, replacing a toxic of
the same name.
Result<toxic>: add `toxic` to proxy `proxy-name`, replacing a toxic of the same name.
(-create-proxy! c proxy)Result<Proxy>: create proxy ({"name" "listen" "upstream"
"enabled"}). Idempotent: an existing proxy of that name with the same
listen and upstream answers itself; a different one is an error.
Result<Proxy>: create `proxy` ({"name" "listen" "upstream"
"enabled"}). Idempotent: an existing proxy of that name with the same
listen and upstream answers itself; a different one is an error.(-list c)Result<{name Proxy}>: every proxy with its toxics.
Result<{name Proxy}>: every proxy with its toxics.
(-remove-toxic! c proxy-name toxic-name)Result<{:removed? bool}>: remove toxic toxic-name; an absent one
answers :removed? false.
Result<{:removed? bool}>: remove toxic `toxic-name`; an absent one
answers :removed? false.(-reset! c)Result<{:reset true}>: remove every toxic and enable every proxy.
Result<{:reset true}>: remove every toxic and enable every proxy.
The traces a stack's services exported, read back from the trace store
(Tempo, ClickHouse ..), so a failed test can be explained by the spans
that carry its test.id. See hive-compose.promote.trace for the data.
The traces a stack's services exported, read back from the trace store (Tempo, ClickHouse ..), so a failed test can be explained by the spans that carry its test.id. See `hive-compose.promote.trace` for the data.
(-find-traces q query)Result<[{:trace/id :trace/root-service :trace/root-name :trace/start-ms
:trace/duration-ms}]>: the traces with a span matching every entry of
(:attrs query) ({"hive.run.id" "r1" "test.id" "t"}) that started
between :start-ms and :end-ms (epoch ms, both optional), at most
:limit of them. None found is an empty vector, not an error.
Result<[{:trace/id :trace/root-service :trace/root-name :trace/start-ms
:trace/duration-ms}]>: the traces with a span matching every entry of
`(:attrs query)` ({"hive.run.id" "r1" "test.id" "t"}) that started
between `:start-ms` and `:end-ms` (epoch ms, both optional), at most
`:limit` of them. None found is an empty vector, not an error.(-health q)Result<{:ready? true}>: the trace store answers, or why it does not.
Result<{:ready? true}>: the trace store answers, or why it does not.
(-trace q trace-id)Result<{:trace/id :trace/spans [{:span/id :span/parent-id :span/name
:span/service :span/start-ms :span/duration-ms :span/status
:span/status-message :span/attrs}]}>: every span of the trace trace-id
(hex). :span/status is :ok, :error or :unset. A trace the store does not
hold is :trace/not-found.
Result<{:trace/id :trace/spans [{:span/id :span/parent-id :span/name
:span/service :span/start-ms :span/duration-ms :span/status
:span/status-message :span/attrs}]}>: every span of the trace `trace-id`
(hex). :span/status is :ok, :error or :unset. A trace the store does not
hold is :trace/not-found.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 |