Step 3 of the rust-orchestrator-migration. New file prod_orchestrator.rs (999 LOC)
implements the full public surface that will replace scripts/first-boot-containers.sh:
* install / start / stop / restart / remove / upgrade / status / list / logs / health
* adopt_existing: read-only scan that claims containers matching our manifests by
name, without recreating — preserves the v1.7.42 fixture on .116.
* reconcile_all: level-triggered, per-app failures collected rather than aborting.
* install_fresh: build-or-pull (Step 2 trait methods), relative build contexts
resolved against the manifest directory.
Naming rule (answered design Q1): UI app IDs (bitcoin-ui/electrs-ui/lnd-ui) get the
archy- prefix; backends keep their bare ID. An explicit extensions.container_name
always wins. Codified in compute_container_name() with unit tests for all three tiers.
Concurrency (answered design Q4): per-app tokio::sync::Mutex<()> created lazily,
protecting every mutating op against the reconciler loop. Acquiring the per-app
lock only needs a read lock on the map, so independent apps do not serialize.
16 tests: 3 sync naming rule tests + 13 tokio async tests covering install (pull,
build-absent, build-present, relative-context), reconcile (noop/exited/missing/
mixed-failure), adopt-by-name, upgrade sequence ordering, list filtering, health
state mapping, and unknown-app-id rejection. All pass.
Not wired into main.rs yet — that is Step 6. Crate builds clean with expected
unused warnings for the new re-exports.
14 lines
383 B
Rust
14 lines
383 B
Rust
pub mod data_manager;
|
|
pub mod dev_orchestrator;
|
|
pub mod docker_packages;
|
|
pub mod image_versions;
|
|
pub mod prod_orchestrator;
|
|
pub mod registry;
|
|
|
|
pub use dev_orchestrator::DevContainerOrchestrator;
|
|
pub use docker_packages::DockerPackageScanner;
|
|
pub use prod_orchestrator::{
|
|
compute_container_name, AdoptionReport, ProdContainerOrchestrator, ReconcileAction,
|
|
ReconcileReport,
|
|
};
|