From 4fa2b8deb6a83948b0ca43067486d90adca699b6 Mon Sep 17 00:00:00 2001 From: Jean-Gabriel Gill-Couture Date: Tue, 9 Sep 2025 20:46:33 -0400 Subject: [PATCH] chore: Add files to create in a leptos project in try_rust example --- .../files_to_add/.dockerignore | 1 + .../try_rust_webapp/files_to_add/Cargo.toml | 20 +++++++++ examples/try_rust_webapp/files_to_add/main.rs | 45 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 examples/try_rust_webapp/files_to_add/.dockerignore create mode 100644 examples/try_rust_webapp/files_to_add/Cargo.toml create mode 100644 examples/try_rust_webapp/files_to_add/main.rs diff --git a/examples/try_rust_webapp/files_to_add/.dockerignore b/examples/try_rust_webapp/files_to_add/.dockerignore new file mode 100644 index 0000000..856a07e --- /dev/null +++ b/examples/try_rust_webapp/files_to_add/.dockerignore @@ -0,0 +1 @@ +harmony diff --git a/examples/try_rust_webapp/files_to_add/Cargo.toml b/examples/try_rust_webapp/files_to_add/Cargo.toml new file mode 100644 index 0000000..487671c --- /dev/null +++ b/examples/try_rust_webapp/files_to_add/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "harmony-tryrust" +edition = "2024" +version = "0.1.0" + +[dependencies] +harmony = { path = "../../../nationtech/harmony/harmony" } +harmony_cli = { path = "../../../nationtech/harmony/harmony_cli" } +harmony_types = { path = "../../../nationtech/harmony/harmony_types" } +harmony_macros = { path = "../../../nationtech/harmony/harmony_macros" } +tokio = { version = "1.40", features = [ + "io-std", + "fs", + "macros", + "rt-multi-thread", +] } +log = { version = "0.4", features = ["kv"] } +env_logger = "0.11" +url = "2.5" +base64 = "0.22.1" diff --git a/examples/try_rust_webapp/files_to_add/main.rs b/examples/try_rust_webapp/files_to_add/main.rs new file mode 100644 index 0000000..ce96763 --- /dev/null +++ b/examples/try_rust_webapp/files_to_add/main.rs @@ -0,0 +1,45 @@ +use harmony::{ + inventory::Inventory, + modules::{ + application::{ + ApplicationScore, RustWebFramework, RustWebapp, + features::{ContinuousDelivery, Monitoring, rhob_monitoring::RHOBMonitoring}, + }, + monitoring::alert_channel::discord_alert_channel::DiscordWebhook, + }, + topology::K8sAnywhereTopology, +}; +use harmony_macros::hurl; +use std::{path::PathBuf, sync::Arc}; + +#[tokio::main] +async fn main() { + let application = Arc::new(RustWebapp { + name: "tryrust".to_string(), + project_root: PathBuf::from(".."), + framework: Some(RustWebFramework::Leptos), + service_port: 8080, + }); + + let app = ApplicationScore { + features: vec![ + Box::new(ContinuousDelivery { + application: application.clone(), + }), + Box::new(RHOBMonitoring { + application: application.clone(), + alert_receiver: vec![], + }), + ], + application, + }; + + harmony_cli::run( + Inventory::autoload(), + K8sAnywhereTopology::from_env(), + vec![Box::new(app)], + None, + ) + .await + .unwrap(); +}