From c879ca143fbb94a93d9051e29ceeed15603f08d2 Mon Sep 17 00:00:00 2001 From: Jean-Gabriel Gill-Couture Date: Wed, 30 Apr 2025 23:36:12 -0400 Subject: [PATCH] feat: Add comments explaining a bit of what harmony does in the lamp demo --- examples/lamp/src/main.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/lamp/src/main.rs b/examples/lamp/src/main.rs index 9d51d0b..41adfb4 100644 --- a/examples/lamp/src/main.rs +++ b/examples/lamp/src/main.rs @@ -8,17 +8,30 @@ use harmony::{ #[tokio::main] async fn main() { - // let _ = env_logger::Builder::from_default_env().filter_level(log::LevelFilter::Info).try_init(); + // This here is the whole configuration to + // - setup a local K3D cluster + // - Build a docker image with the PHP project builtin and production grade settings + // - Deploy a mariadb database using a production grade helm chart + // - Deploy the new container using a kubernetes deployment + // - Configure networking between the PHP container and the database + // - Provision a public route and an SSL certificate automatically on production environments + // + // Enjoy :) let lamp_stack = LAMPScore { name: "harmony-lamp-demo".to_string(), domain: Url::Url(url::Url::parse("https://lampdemo.harmony.nationtech.io").unwrap()), php_version: Version::from("8.4.4").unwrap(), + // This config can be extended as needed for more complicated configurations config: LAMPConfig { project_root: "./php".into(), ..Default::default() }, }; + // You can choose the type of Topology you want, we suggest starting with the + // K8sAnywhereTopology as it is the most automatic one that enables you to easily deploy + // locally, to development environment from a CI, to staging, and to production with settings + // that automatically adapt to each environment grade. let mut maestro = Maestro::::initialize( Inventory::autoload(), K8sAnywhereTopology::new(), @@ -26,5 +39,7 @@ async fn main() { .await .unwrap(); maestro.register_all(vec![Box::new(lamp_stack)]); + // Here we bootstrap the CLI, this gives some nice features if you need them harmony_cli::init(maestro, None).await.unwrap(); } +// That's it, end of the infra as code.