Skip to main content

lightshuttle_runtime/
lib.rs

1//! Container runtime backends and lifecycle manager for LightShuttle.
2//!
3//! This crate provides:
4//!
5//! - A narrow [`ContainerRuntime`] trait that the lifecycle manager
6//!   targets and that hides the daemon-specific surface.
7//! - A first concrete implementation [`DockerRuntime`] backed by the
8//!   `bollard` crate.
9//! - A [`ContainerSpec`] value built from a `lightshuttle-manifest`
10//!   resource declaration, with the v0 defaults already applied
11//!   (image expansion, database name derivation, random password
12//!   generation, healthcheck materialisation).
13//! - A [`LifecycleManager`] that consumes a [`LifecyclePlan`] and a
14//!   runtime, then orchestrates startup (topological, parallel where
15//!   possible, gated on healthchecks), supervises the running stack
16//!   and rolls everything down on signal.
17//!
18//! See `docs/spec/manifest-v0.md` in the main repository for the
19//! manifest specification this runtime consumes.
20
21pub use crate::docker::{DockerRuntime, LABEL_PROJECT, LABEL_RESOURCE, ManagedContainer};
22pub use crate::error::{Result, RuntimeError};
23pub use crate::lifecycle::{
24    EnvReport, EnvSource, EnvVarReport, EnvVarStatus, LifecycleError, LifecycleEvent,
25    LifecycleHandle, LifecycleHandleError, LifecycleManager, LifecyclePlan, ManagerHandle,
26    NodeStatus, PlanNode, ResourceStatus, ResourceView,
27};
28pub use crate::runtime::{
29    ContainerId, ContainerRuntime, ContainerStatus, LogChunk, LogChunkStream, LogStream,
30};
31pub use lightshuttle_spec::{
32    ContainerSpec, HealthcheckSpec, ImageSource, PortBinding, ResolvedResource, ResourceOutputs,
33    SpecError, VolumeBinding, VolumeSource, from_resource,
34};
35
36mod docker;
37mod error;
38mod lifecycle;
39mod runtime;
40
41pub mod testkit;