isoloom_render/lib.rs
1//! What every Isoloom backend renders with, so the targets render the same decisions the same
2//! way. It sits between the plan (`isoloom-plan`, the facts) and the backends (Compose,
3//! Kubernetes, Vagrant, Terraform, Ansible), which implement its
4//! [`Backend`](backend::Backend) port.
5//!
6//! - **The port:** [`backend`] (the [`Backend`](backend::Backend) trait a target's renderer
7//! implements) and its [`Error`].
8//! - **The builders**, one per language a target writes: [`hcl_builder`] (Terraform), [`ruby`]
9//! (a Vagrantfile's literals), [`powershell`] (a Windows machine's) and [`inventory`]
10//! (Ansible's); shell is `isoloom_spec::shell`, below every crate.
11//! - **The configuration renderers** ([`configure`]): a machine's recipe as the shell and
12//! PowerShell libraries' calls, the Dockerfile its container builds from, and Isoloom's runner,
13//! the process of a container that runs services.
14//! - **A VM's set-up:** [`steps`] (each [`Step`](isoloom_plan::Step) as Linux shell or
15//! PowerShell), the scripts kept across restarts ([`boot`]), [`secrets`] delivered at run time,
16//! the network's [`constraints`], the [`controller`] that runs the playbooks, and the
17//! [`project`] copied in.
18//! - **The network pieces:** [`router`], VLAN [`trunks`], [`ipv6`] and a VM's
19//! [`more_addresses`].
20//! - **The containers' shared parts:** [`container`]; where a check reaches its host:
21//! [`checks`].
22//! - **The run manifest's pieces** every target's `run.json` is built from: [`run_manifest`].
23//!
24//! Everything here is a pure function of the plan: no I/O, no clock, no environment.
25//!
26//! ```
27//! use isoloom_plan::{Environment, Lab, Step};
28//! use isoloom_spec::model::Target;
29//!
30//! let lab = Lab::parse(
31//! "version: 1\nname: demo\nnetworks: { lan: { cidr: 10.9.0.0/24 } }\nmachines:\n web: { networks: { lan: 10 }, os: debian@12 }\n",
32//! )
33//! .expect("the spec parses");
34//! let env = Environment::build(&lab.for_target(Target::Vagrant), Target::Vagrant, None);
35//! let ready = isoloom_render::steps::linux(&env, "web", &Step::Ready).expect("every VM gets ready");
36//! assert!(ready.ends_with("echo ready > /var/lib/isoloom/ready\n"));
37//! ```
38
39pub mod backend;
40pub mod boot;
41pub mod checks;
42pub mod configure;
43pub mod constraints;
44pub mod container;
45pub mod controller;
46mod error;
47pub mod hcl_builder;
48pub mod inventory;
49mod network;
50mod output;
51pub mod powershell;
52pub mod project;
53pub mod ruby;
54pub mod run_manifest;
55pub mod secrets;
56pub mod steps;
57#[cfg(test)]
58mod testing;
59
60pub use error::{Error, Result};
61pub use network::{ipv6, more_addresses, router, trunks};
62pub use output::{GeneratedFile, OUTPUT_DIR, header};