use std::{path::PathBuf, sync::Arc}; use harmony::{ data::Id, inventory::Inventory, maestro::Maestro, modules::{ application::{ ApplicationScore, RustWebFramework, RustWebapp, features::{ContinuousDelivery, Monitoring}, }, monitoring::alert_channel::{ discord_alert_channel::DiscordWebhook, webhook_receiver::WebhookReceiver, }, tenant::TenantScore, }, topology::{K8sAnywhereTopology, Url, tenant::TenantConfig}, }; #[tokio::main] async fn main() { //TODO there is a bug where the application is deployed into the namespace matching the //application name and the tenant is created in the namesapce matching the tenant name //in order for the application to be deployed in the tenant namespace the application.name and //the TenantConfig.name must match let tenant = TenantScore { config: TenantConfig { id: Id::from_str("test-tenant-id"), name: "example-monitoring".to_string(), ..Default::default() }, }; let application = Arc::new(RustWebapp { name: "example-monitoring".to_string(), domain: Url::Url(url::Url::parse("https://rustapp.harmony.example.com").unwrap()), project_root: PathBuf::from("./examples/rust/webapp"), framework: Some(RustWebFramework::Leptos), }); let webhook_receiver = WebhookReceiver { name: "sample-webhook-receiver".to_string(), url: Url::Url(url::Url::parse("https://webhook-doesnt-exist.com").unwrap()), }; let app = ApplicationScore { features: vec![Box::new(Monitoring { alert_receiver: vec![Box::new(webhook_receiver)], application: application.clone(), })], application, }; harmony_cli::run( Inventory::autoload(), K8sAnywhereTopology::from_env(), vec![Box::new(tenant), Box::new(app)], None, ) .await .unwrap(); }