All checks were successful
Run Check Script / check (pull_request) Successful in 1m22s
162 lines
6.5 KiB
Markdown
162 lines
6.5 KiB
Markdown
# Harmony : Open-source infrastructure orchestration that treats your platform like first-class code
|
||
|
||
_By [NationTech](https://nationtech.io)_
|
||
|
||
[](https://git.nationtech.io/nationtech/harmony)
|
||
[](LICENSE)
|
||
|
||
### Unify
|
||
|
||
- **Project Scaffolding**
|
||
- **Infrastructure Provisioning**
|
||
- **Application Deployment**
|
||
- **Day-2 operations**
|
||
|
||
All in **one strongly-typed Rust codebase**.
|
||
|
||
### Deploy anywhere
|
||
|
||
From a **developer laptop** to a **global production cluster**, a single **source of truth** drives the **full software lifecycle.**
|
||
|
||
---
|
||
|
||
## 1 · The Harmony Philosophy
|
||
|
||
Infrastructure is essential, but it shouldn’t be your core business. Harmony is built on three guiding principles that make modern platforms reliable, repeatable, and easy to reason about.
|
||
|
||
| Principle | What it means for you |
|
||
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||
| **Infrastructure as Resilient Code** | Replace sprawling YAML and bash scripts with type-safe Rust. Test, refactor, and version your platform just like application code. |
|
||
| **Prove It Works — Before You Deploy** | Harmony uses the compiler to verify that your application’s needs match the target environment’s capabilities at **compile-time**, eliminating an entire class of runtime outages. |
|
||
| **One Unified Model** | Software and infrastructure are a single system. Harmony models them together, enabling deep automation—from bare-metal servers to Kubernetes workloads—with zero context switching. |
|
||
|
||
These principles surface as simple, ergonomic Rust APIs that let teams focus on their product while trusting the platform underneath.
|
||
|
||
---
|
||
|
||
## 2 · Quick Start
|
||
|
||
The snippet below spins up a complete **production-grade Rust + Leptos Webapp** with monitoring. Swap it for your own scores to deploy anything from microservices to machine-learning pipelines.
|
||
|
||
```rust
|
||
use harmony::{
|
||
inventory::Inventory,
|
||
modules::{
|
||
application::{
|
||
ApplicationScore, RustWebFramework, RustWebapp,
|
||
features::{PackagingDeployment, rhob_monitoring::Monitoring},
|
||
},
|
||
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: "harmony-example-leptos".to_string(),
|
||
project_root: PathBuf::from(".."), // <== Your project root, usually .. if you use the standard `/harmony` folder
|
||
framework: Some(RustWebFramework::Leptos),
|
||
service_port: 8080,
|
||
});
|
||
|
||
// Define your Application deployment and the features you want
|
||
let app = ApplicationScore {
|
||
features: vec![
|
||
Box::new(PackagingDeployment {
|
||
application: application.clone(),
|
||
}),
|
||
Box::new(Monitoring {
|
||
application: application.clone(),
|
||
alert_receiver: vec![
|
||
Box::new(DiscordWebhook {
|
||
name: "test-discord".to_string(),
|
||
url: hurl!("https://discord.doesnt.exist.com"), // <== Get your discord webhook url
|
||
}),
|
||
],
|
||
}),
|
||
],
|
||
application,
|
||
};
|
||
|
||
harmony_cli::run(
|
||
Inventory::autoload(),
|
||
K8sAnywhereTopology::from_env(), // <== Deploy to local automatically provisioned local k3d by default or connect to any kubernetes cluster
|
||
vec![Box::new(app)],
|
||
None,
|
||
)
|
||
.await
|
||
.unwrap();
|
||
}
|
||
```
|
||
|
||
Run it:
|
||
|
||
```bash
|
||
cargo run
|
||
```
|
||
|
||
Harmony analyses the code, shows an execution plan in a TUI, and applies it once you confirm. Same code, same binary—every environment.
|
||
|
||
---
|
||
|
||
## 3 · Core Concepts
|
||
|
||
| Term | One-liner |
|
||
| ---------------- | ---------------------------------------------------------------------------------------------------- |
|
||
| **Score<T>** | Declarative description of the desired state (e.g., `LAMPScore`). |
|
||
| **Interpret<T>** | Imperative logic that realises a `Score` on a specific environment. |
|
||
| **Topology** | An environment (local k3d, AWS, bare-metal) exposing verified _Capabilities_ (Kubernetes, DNS, …). |
|
||
| **Maestro** | Orchestrator that compiles Scores + Topology, ensuring all capabilities line up **at compile-time**. |
|
||
| **Inventory** | Optional catalogue of physical assets for bare-metal and edge deployments. |
|
||
|
||
A visual overview is in the diagram below.
|
||
|
||
[Harmony Core Architecture](docs/diagrams/Harmony_Core_Architecture.drawio.svg)
|
||
|
||
---
|
||
|
||
## 4 · Install
|
||
|
||
Prerequisites:
|
||
|
||
- Rust
|
||
- Docker (if you deploy locally)
|
||
- `kubectl` / `helm` for Kubernetes-based topologies
|
||
|
||
```bash
|
||
git clone https://git.nationtech.io/nationtech/harmony
|
||
cd harmony
|
||
cargo build --release # builds the CLI, TUI and libraries
|
||
```
|
||
|
||
---
|
||
|
||
## 5 · Learning More
|
||
|
||
- **Architectural Decision Records** – dive into the rationale
|
||
- [ADR-001 · Why Rust](adr/001-rust.md)
|
||
- [ADR-003 · Infrastructure Abstractions](adr/003-infrastructure-abstractions.md)
|
||
- [ADR-006 · Secret Management](adr/006-secret-management.md)
|
||
- [ADR-011 · Multi-Tenant Cluster](adr/011-multi-tenant-cluster.md)
|
||
|
||
- **Extending Harmony** – write new Scores / Interprets, add hardware like OPNsense firewalls, or embed Harmony in your own tooling (`/docs`).
|
||
|
||
- **Community** – discussions and roadmap live in [GitLab issues](https://git.nationtech.io/nationtech/harmony/-/issues). PRs, ideas, and feedback are welcome!
|
||
|
||
---
|
||
|
||
## 6 · License
|
||
|
||
Harmony is released under the **GNU AGPL v3**.
|
||
|
||
> We choose a strong copyleft license to ensure the project—and every improvement to it—remains open and benefits the entire community. Fork it, enhance it, even out-innovate us; just keep it open.
|
||
|
||
See [LICENSE](LICENSE) for the full text.
|
||
|
||
---
|
||
|
||
_Made with ❤️ & 🦀 by the NationTech and the Harmony community_
|