All checks were successful
Run Check Script / check (pull_request) Successful in 1m15s
This includes Id, IpAddress, Url and some other heavily used types
56 lines
2.1 KiB
Rust
56 lines
2.1 KiB
Rust
use harmony::{
|
|
data::Version,
|
|
inventory::Inventory,
|
|
modules::lamp::{LAMPConfig, LAMPScore},
|
|
topology::K8sAnywhereTopology,
|
|
};
|
|
use harmony_types::net::Url;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
// 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(),
|
|
database_size: "4Gi".to_string().into(),
|
|
..Default::default()
|
|
},
|
|
};
|
|
|
|
//let monitoring = MonitoringAlertingScore {
|
|
// alert_receivers: vec![Box::new(DiscordWebhook {
|
|
// url: Url::Url(url::Url::parse("https://discord.idonotexist.com").unwrap()),
|
|
// // TODO write url macro
|
|
// // url: url!("https://discord.idonotexist.com"),
|
|
// })],
|
|
// alert_rules: vec![],
|
|
// scrape_targets: vec![],
|
|
//};
|
|
|
|
// 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.
|
|
harmony_cli::run(
|
|
Inventory::autoload(),
|
|
K8sAnywhereTopology::from_env(),
|
|
vec![Box::new(lamp_stack)],
|
|
None,
|
|
)
|
|
.await
|
|
.unwrap();
|
|
}
|
|
// That's it, end of the infra as code.
|