Skip to main content

Module stack

Module stack 

Source
Expand description

Stacks: a compose file deployed to the isb serve daemon, which keeps it running the way docker swarm keeps a stack running, on one host.

The daemon’s desired state is a file per stack under its state directory, and every instance it creates carries user.isb.stack, user.isb.service, user.isb.slot and user.isb.rev. Both survive a daemon restart, so a new daemon picks up exactly where the last one stopped. Apps never depend on the daemon being alive: they are supervised inside their guests (see crate::supervise) and start with the host.

  • A service has deploy.replicas slots. Each slot holds one instance, named <stack>-<service>-<slot>-<id>.
  • A service’s revision is a hash of everything that shapes an instance. An instance whose revision is not the current one is replaced, in batches, per deploy.update_config.
  • Published host ports are served by the daemon’s load balancer (crate::balance), which only sends traffic to healthy replicas, so a start-first rollout has no gap.

Re-exports§

pub use controller::Controller;
pub use secrets::SecretBinding;

Modules§

controller
The reconciler behind isb serve: one worker thread per service keeps its replicas created, current, running, healthy and in the load balancer.
failure
Why a replica did not come up.
migrate
Upgrading stored stacks whose definitions held secret values.
secrets
A stack’s secrets: references into its org’s store, by name and version.

Structs§

StackDef
A deployed stack, as the daemon stores it.
Store
Where stack definitions live: $XDG_STATE_HOME/isb (else ~/.local/state/isb), one 0600 file per stack under stacks/.

Constants§

LABEL_REV
LABEL_SERVICE
LABEL_SLOT
LABEL_STACK
Instance config keys (without user.) that tie an instance to its stack.

Functions§

instance_name
<stack>-<service>-<slot>-<id>, checked against incus’ 63-character limit.
local_deploy_args
Resolve the paths the local CLI sends with a deploy: the project’s own directory, so relative binds and file: secrets work as with isb up.
new_id
A short random id for a new instance.
now_secs
qualified
A stack’s name qualified by its org: web in the default org, alpha/web in org alpha. The controller keys everything by it.
split_qualified
The org and name of a qualified stack name.
validate_stack_name
Valid stack name: what an instance name prefix allows.