Skip to main content

Machine

Struct Machine 

Source
pub struct Machine {
Show 35 fields pub networks: IndexMap<String, u8>, pub more_addresses: IndexMap<String, Vec<u8>>, pub count: Option<u8>, pub aliases: Vec<String>, pub os: Option<String>, pub arch: Arch, pub rate_limit: Option<String>, pub privileged: bool, pub nested_virtualization: bool, pub gpus: Option<Gpus>, pub devices: Vec<Device>, pub read_only: bool, pub tmpfs: Vec<Tmpfs>, pub shm_size: Option<String>, pub dns: Option<Dns>, pub environment: IndexMap<String, String>, pub sysctls: IndexMap<String, String>, pub ulimits: IndexMap<String, Ulimit>, pub ports: Vec<Port>, pub inputs: Vec<String>, pub secrets: Vec<MachineSecret>, pub resources: Option<Resources>, pub command: Option<CommandLine>, pub working_dir: Option<String>, pub healthcheck: Option<Healthcheck>, pub depends_on: Vec<String>, pub volumes: IndexMap<String, Mount>, pub files: Vec<MachineFile>, pub disks: IndexMap<String, Disk>, pub access: bool, pub docker: Option<DockerImpl>, pub vm: Option<VmImpl>, pub external: Option<External>, pub supplied: bool, pub configuration: Option<Configuration>,
}
Expand description

A machine of the environment: where it sits on the networks, what it serves, and how each kind of target produces it (docker:, vm:, external:).

Fields§

§networks: IndexMap<String, u8>

Network name -> last octet of the machine’s address on it. Every machine has one, but a LAN’s switch, whose ports the LAN gives it. A list (lan: [10, 11, 12]) gives the machine several addresses on the network: the first is its primary one, the one its name resolves to, and the others are on the same interface.

§more_addresses: IndexMap<String, Vec<u8>>

The addresses after the first of each network written as a list, split from networks by lowering: not a field a spec writes.

§count: Option<u8>

How many of this machine (2 to 99): clones named <name>-01, <name>-02, …, each one address further along on every network. Where the spec names this machine, it means every clone. Expanded before anything else reads the spec.

§aliases: Vec<String>

More DNS names the machine answers to besides its own (a fully qualified name an application has baked in, like api.example.com), on every network it is on.

§os: Option<String>

The machine’s OS as <family>@<version> (debian@12, windows-server@2022), or the family alone for its pinned default version (debian is debian@12). vm.os defaults to it, and a machine with neither docker: nor vm: runs as a VM of this OS (vm: { os }).

§arch: Arch

The machine’s CPU architecture (amd64 or arm64). Defaults to amd64.

§rate_limit: Option<String>

A bandwidth cap on each of the machine’s network links, in both directions, as tc writes a rate (10mbit, 512kbit): a machine on a slow line, while networks.*.tc slows a whole network down on its router.

§privileged: bool

The machine needs kernel-level access (nested containers, loading kernel modules, raw devices). A container runs privileged; a VM already has it (its workload is root). VMs inside a VM need nested_virtualization.

§nested_virtualization: bool

The machine runs VMs of its own: its VM gets the CPU’s virtualization extensions (each hypervisor’s nested virtualization). A VM only: a container can’t, so the machine needs a vm:. Targets whose VMs can’t nest refuse it.

§gpus: Option<Gpus>

GPUs for the machine: a count (1), all, or { count, ids, driver, capabilities, options }. A container gets the host’s (Docker, Kubernetes); a VM gets them passed through (Proxmox, by ids) or sized with them (a cloud’s GPU instance type). Other targets refuse it.

§devices: Vec<Device>

The host’s devices given to the machine: /dev/fuse, host:guest[:permissions], or { host, guest, permissions } (r, w, m). A container on the user’s own Docker host only: a VM has its own devices (a GPU reaches a VM through gpus).

§read_only: bool

The machine’s root filesystem is read-only (hardening): nothing can be written outside its declared volumes. Applies to containers; a VM’s root stays writable.

§tmpfs: Vec<Tmpfs>

Memory-backed (tmpfs) mounts inside the machine, for scratch space that never touches disk: a path (/tmp), or a path with a size and a mode ({ path: /run, size: 64m, mode: "1777" }). A VM sets these up in its own provisioning (fstab).

§shm_size: Option<String>

The size of /dev/shm (shared memory), e.g. 256m or 1g, for workloads that need more than the small default (browsers, some databases). A VM sizes it in its own provisioning.

§dns: Option<Dns>

How the machine resolves names: which DNS servers to use, search domains, and its own domain. Useful to point a Linux box at the lab’s domain controller. A VM sets its resolver in its own provisioning (resolv.conf).

§environment: IndexMap<String, String>

Environment variables with fixed values: a container’s environment; on a VM, every service’s (systemd’s default environment) and every login’s (/etc/environment).

§sysctls: IndexMap<String, String>

Kernel parameters, e.g. net.core.somaxconn: 1024. A container can only set the ones the kernel keeps per network or IPC namespace (net.*, kernel.shm*, kernel.msg*, kernel.sem, fs.mqueue.*); a VM sets any (/etc/sysctl.d).

§ulimits: IndexMap<String, Ulimit>

Process limits, by name (nofile, nproc, memlock…): one value for both, or { soft, hard }. A container’s ulimits; on a VM, every service’s (systemd) and every login’s (limits.d). Kubernetes has none per container.

§ports: Vec<Port>

The ports the machine answers on, each with its protocol, an HTTP probe and whether it is published or dormant: what is published, opened by reach, waited for and checked.

§inputs: Vec<String>

The spec’s inputs this machine receives, by name: only these reach it.

§secrets: Vec<MachineSecret>

The secrets this machine gets, as files (never environment variables): a name from the top-level secrets (/run/secrets/<name>), or { source, target, uid, gid, mode }. Delivered by isoloom run when the machine starts.

§resources: Option<Resources>

CPUs, memory and disk for the machine (a VM’s size, a container’s limits). Default: 1 CPU, 1024 MB, 20 GB.

§command: Option<CommandLine>

The machine’s own command, instead of its image’s (CMD; the image’s entrypoint still runs it). A text runs in the shell, a list as it is. On a VM it runs as a service (systemd, OpenRC on Alpine; a startup task on Windows), restarted when it fails.

§working_dir: Option<String>

The directory the command and the healthcheck run in (an absolute path). Default: the image’s WORKDIR; on a VM, the project folder (/opt/isoloom).

§healthcheck: Option<Healthcheck>

When the machine counts as healthy beyond its ports answering: a command or a page, with its pace. Checked beside the port probe, never instead of it.

§depends_on: Vec<String>

Machines that must be ready (their ports answering) before this one starts.

§volumes: IndexMap<String, Mount>

Data that survives restarts and re-creation of the machine, until the environment is destroyed: a name -> an absolute path in the machine. On the container targets a volume starts with the image’s files at that path (Docker’s named volumes; Kubernetes seeds its claim from the image while it is empty), so init jobs can add to them. A shared volume’s user may take one folder of it: { path: /srv/www, subpath: www }.

§files: Vec<MachineFile>

Files placed at a path on the machine (a configuration the image doesn’t carry), from the project or written inline, with their owner and mode: on every target.

§disks: IndexMap<String, Disk>

Data disks beside the machine’s own, by name (kebab-case, at most 12 characters: the filesystem’s label): { size_gb: 50, fs: xfs, mount: /data }. A VM gets an empty disk of that size, formatted and mounted at boot; a container gets a volume at the mount. The disks go with the machine.

§access: bool

The machine the user lands on. It may have no implementation: the runner supplies it.

§docker: Option<DockerImpl>

How a container produces this machine: an image or a build, and what only a container has (init jobs, appliances). A machine with docker: can run on the container targets.

§vm: Option<VmImpl>

How a VM produces this machine (services installed natively, no Docker inside).

§external: Option<External>

Where this machine already exists (the external target): Isoloom creates nothing and reaches it over SSH to provision, check and connect.

§supplied: bool

Filled by the runner’s image table (an access machine the spec leaves to the runner): a stock image, kept running idle for the user to work from. Never in a spec file.

§configuration: Option<Configuration>

What configures it (an app’s steps), in the configuration model, for every form: the plan resolves it into the recipe a container’s build and a VM’s set-up render. Set by lowering, never written in a spec.

Implementations§

Source§

impl Machine

Source

pub fn port_label(&self, s: &Port) -> String

How outputs name one of its ports (published outputs, Compose labels): its name, else its port. A UDP port is <port>-udp, and <name>-udp when a TCP port of the machine has the same name (DNS’s dns over both protocols), so the two never share a key.

Source

pub fn ready_ports(&self) -> Vec<u16>

The ports Isoloom waits for before the machine counts as ready: its TCP ports but the dormant ones (UDP has no handshake to probe). Empty: nothing to probe (no healthcheck, no readiness probe).

Source

pub fn has_readiness(&self) -> bool

Whether anything says when the machine is ready: a port to probe or a healthcheck of its own. Without either, the machine is ready once started.

Trait Implementations§

Source§

impl Clone for Machine

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Machine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Machine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Machine

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Machine

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Machine

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Machine

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Machine

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.