Commit Graph

111 Commits

Author SHA1 Message Date
3097e6af67 Merge branch 'adr/005-interactive-project' 2025-04-11 11:03:16 -04:00
606ea43b51 fix: improve tests and remove unused code
- Corrected XML test data to remove unnecessary `<descr>` tags, resolving failing tests.
- Removed the unused `ratatui_utils` module and its associated code.
- Simplified example in `harmony_tui/src/lib.rs` to use `tokio::main` and register scores directly with `Maestro`. This aligns with the project's evolving structure.
2025-04-11 11:01:05 -04:00
31ae8365a6 docs: add quick demo and core architecture overview
Adds a quick demo command using `cargo run -p example-tui` to launch a minimalist TUI with demo scores.

Also includes a core architecture diagram and overview in the README for better understanding of the project structure.
2025-04-09 16:09:54 -04:00
1cbf4de2a1 adr: proposal serde for score data representation and UI rendering
Decouples score definitions from UI implementations by mandating `serde::Serialize` and `serde::Deserialize` for all `Score` structs. UIs will interact with scores via their serialized representation, enabling scalability and reducing complexity for score authors.

This approach:

- Scales better with new score types and UI targets.
- Simplifies score authoring by removing the need for UI-specific display traits.
- Leverages the `serde` ecosystem for robust data handling.

Adding new field types requires updates to all UIs, a trade-off acknowledged in the ADR.
2025-04-05 14:38:58 -04:00
b4cc5cff4f feat: add serde derive to Score types
This commit adds `serde` dependency and derives `Serialize` trait for `Score` types. This is necessary for serialization and deserialization of these types, which is required to display Scores to various user interfaces

- Added `serde` dependency to `harmony_types/Cargo.toml`.
- Added `serde::Serialize` derive macro to `MacAddress` in `harmony_types/src/lib.rs`.
- Added `serde::Serialize` derive macro to `Config` in `opnsense-config/src/config/config.rs`.
- Added `serde::Serialize` derive macro to `Score` in `harmony_types/src/lib.rs`.
- Added `serde::Serialize` derive macro to `Config` and `Score` in relevant modules.
- Added placeholder `todo!()` implementations for `serialize` methods. These will be implemented in future commits.
2025-04-05 14:36:08 -04:00
ab9b7476a4 feat: add load balancer score and frontend integration
- Implemented `OKDLoadBalancerScore` and integrated it as a `FrontendScore`.
- Added `FrontendScore` trait for TUI displayable scores.
- Implemented `Display` for `OKDLoadBalancerScore`.
- Updated `ScoreListWidget` to handle `FrontendScore` types.
- Included load balancer score in the TUI.
2025-04-03 13:41:29 -04:00
e6384da57e Working on various ADR, cleaning up some stuff 2025-04-03 13:40:46 -04:00
79213ba8d7 feat: implement passthrough for HAClusterTopology traits
This commit completes the refactoring of the `HAClusterTopology` struct to implement all required traits via passthrough to the underlying infrastructure providers.

- Implemented all traits (`DnsServer`, `LoadBalancer`, `HttpServer`, etc.) on `HAClusterTopology`.
- Each trait method now simply calls the corresponding method on the underlying infrastructure provider.
- This ensures that all functionality is delegated to the correct provider without duplicating logic.
- Updated trait implementations to accept `&self` instead of `&mut self` where appropriate.
- Fixed a compilation error in `remove_record` by changing the signature to accept `&self`.
- Added unimplemented!() stubs for HttpServer traits.
2025-04-03 12:20:51 -04:00
8a1627e728 wip: refactoring 2025-04-02 16:52:24 -04:00
fc718f11cf feat: Introduce Topology Trait for Compile-Time Safe Score Binding
Introduce the `Topology` trait to ensure that `Maestro` can compile-time safely bind compatible `Scores` and `Topologies`. This refactoring includes updating `HarmonyTuiEvent`, `ScoreListWidget`, and related structures to work with generic `Topology` types, enhancing type safety and modularity.
2025-04-02 15:51:28 -04:00
f7dc15cbf0 refactor(topology): remove unused HAClusterTopology import
Remove the unnecessary `HAClusterTopology` import from multiple modules to clean up dependencies and reduce clutter. This change does not affect functionality as `HAClusterTopology` is no longer required in these files.
2025-03-31 15:07:16 -04:00
6e9bf3a4be Add more Topology samples with various architectures 2025-03-31 15:02:41 -04:00
fda007f014 feat(topology): generalize Score and Interpret implementations with topology traits
Refactor various `Score` and `Interpret` implementations to utilize generic `Topology` traits, removing hardcoded dependencies on `HAClusterTopology`. This enhancement allows for more flexible and extensible code, accommodating different types of network topologies.
2025-03-26 23:10:51 -04:00
d7897f29c4 feat(orchestration): introduce Interpret trait and refactor score application
Refactor the orchestration process to use an `Interpret` trait instead of directly applying scores. This change introduces a more flexible and extensible design for executing commands associated with different types of topologies. The `CommandScore` and `K8sResourceScore` now implement this trait, providing a clear separation between score definition and execution logic. Update the `Maestro::orchestrate` method to compile scores into interpreters before executing them against their respective topologies.
2025-03-26 16:39:11 -04:00
3962238f0d spike: Working on abstractions, Topology, Score, Capability, Maestro for strong type safety and nice UX/DX 2025-03-25 08:03:45 -04:00
2433c02de9 feat: select k3d for cross-platform Kubernetes development
Select k3d as the primary solution for running Kubernetes clusters on Windows and macOS, alongside native k3s on Linux, to achieve a consistent "zero setup" experience across platforms while considering resource usage, complexity, and long-term alternatives like WebAssembly.
2025-03-17 22:36:07 -04:00
3d6f646460 feat(adr/007-default-runtime.md): add future work section discussing WASM potential
Add a new section to the ADR document outlining potential future work with WebAssembly (WASM) as an alternative runtime, comparing it to Java's bytecode and JVM model, highlighting potential benefits in observability, heap allocation, and garbage collection. Note current maturity limitations compared to our target customer base.
2025-03-17 16:20:52 -04:00
35fcc295aa ADR: Default runtime for harmony workloads
This ADR proposes to use k3s as a default runtime on linux and k3d on other platforms supporting docker
2025-03-17 15:48:14 -04:00
7291db7ca3 feat(example/lamp): add LAMPScore and configuration support
- Introduce `LAMPScore` struct with additional fields: `domain`, `config`, and `php_version`.
- Define default implementation for `LAMPConfig`.
- Update `Url` enum to use `Url(url::Url)` instead of `Remote(url::Url)`.
- Adjust references in `HttpServer` and `TftpServer` implementations.
- Modify `Interpret` trait implementation to use `name()` method from `LAMPScore`.
2025-03-10 17:04:35 -04:00
fbc18d2fad feat(harmony): add lamp server module and refactor dhcpd tests
Implement LAMP server module with basic configuration.
Refactor and remove commented out Dhcpd struct and associated tests in opnsense/xml_utils.
Ensure codebase adheres to best practices and maintainability standards.
2025-03-10 15:18:40 -04:00
fe42ebd347 feat(adr): add architecture decision record for interactive project setup
Add an Architecture Decision Record (ADR) outlining the approach to integrate LAMP projects into Harmony's automated delivery pipeline using either Score Spec or a custom Rust DSL. A decision will have to be made between the two in the short term to decide which we will implement first. The ADR details the benefits and consequences of each option, focusing on providing a seamless transition for developers while leveraging Harmony's enterprise-grade features.
2025-03-10 00:35:40 -04:00
2950235d23 Actualiser adr/006-secret-management.md 2025-03-10 04:31:06 +00:00
7f56d4d654 feat(adr/006-secret-management): propose using Keycloak for secret management
Introduce Architecture Decision Record (ADR) outlining the use of Keycloak as a secret management solution. The document details the context, considerations, decision workflow, rationale for choosing Keycloak over alternatives, and potential consequences including benefits and challenges.
2025-03-06 12:40:44 -05:00
989f407502 docs(adr): add ADR for using iPXE with chaining for architecture independence
Adopt iPXE as the primary bootloader with chaining to support BIOS and UEFI architectures, enabling dynamic boot configurations, advanced network booting, and diskless machine management. This introduces a dependency on iPXE but offers significant benefits in flexibility and configuration simplicity.
2025-02-23 13:33:47 -05:00
62a554fac7 feat(modules/opnsense): refactor and add upgrade functionality
Refactor OPNSense module to use a mod.rs structure and add an OPNsenseLaunchUpgrade score for launching firmware upgrades.
2025-02-21 11:24:04 -05:00
0eb9e02b99 feat: add .gitignore and update file paths
Add a .gitignore file to exclude target, private_repos, and log directories. Update TftpScore and HttpScore file paths in `main.rs` to use relative paths from the project root. Modify `HarmonyTUI` initialization in `lib.rs` to create log directory if it doesn't exist before setting the log file path.
2025-02-12 16:27:56 -05:00
96bbef8195 chore: Reorganize file tree for easier onboarding. Rust project now at the root for simple git clone && cargo run 2025-02-12 15:32:59 -05:00
83b4efd625 feat(example): add new example crate with basic setup 2025-02-12 14:32:17 -05:00
31e92a08a4 fix: autoload inventory and topology, update dhcp struct, add k8s deployment score
- Updated `Inventory` and `HAClusterTopology` to use `autoload` instead of `dummy`.
- Made fields in `DhcpScore` public for better access.
- Added `K8sDeploymentScore` to the list of modules registered with Maestro.
- Corrected logic in `Config::verify_package_installation` to check if package is installed.
- Updated `CaddyGeneral` struct to include `http_versions`.
2025-02-06 16:24:22 -05:00
0b30d82793 feat(harmony): add OPNSense shell command execution score
Introduces a new `OPNSenseShellCommandScore` to execute shell commands on an OPNSense device within the Harmony framework. This allows for custom command execution as part of the scoring and interpretation process, enhancing the flexibility and functionality of the system.
2025-02-04 16:39:49 -05:00
697c669d05 feat(examples/tui): add TUI example with harmony integration
- Create `Cargo.toml` for the new TUI example under `examples/tui`
- Implement basic `main.rs` that initializes Maestro and launches the TUI
- Update `harmony_tui/src/lib.rs` to handle async score execution gracefully
2025-02-04 15:43:05 -05:00
e5b4b5114e fix: improve code formatting and module organization
- Corrected code formatting issues such as inconsistent line breaks and unnecessary trailing commas.
- Reorganized `mod.rs` to ensure proper order of module declarations.
- Fixed misplaced imports in `help.rs` and corrected the rendering method signature.
- Cleaned up unused code lines and moved `dummy` module declaration to its correct position.
2025-02-04 14:44:58 -05:00
134f2b78d6 feat(tui): add panic logging and improve event handling
- Integrate `log_panics` for better error tracking in TUI.
- Enhance score interpretation result handling with async task management.
- Improve layout consistency in the UI rendering process.
2025-02-04 14:44:03 -05:00
0ade6209bb feat: Support opnsense 25.1 config 2025-02-03 08:16:24 -05:00
1877570d7c feat: Add verification of opnsense package installation, fix opnsense-config tests, add log file to tui 2025-02-02 17:06:23 -05:00
3eac78c6d3 feat(harmony): enhance PhysicalHost with builder methods and update dependencies
- Added builder methods to `PhysicalHost` for configuring CPU, memory size, storage, MAC address, labels, and management interface.
- Updated the edition of various Cargo.toml files to 2024.
- Implemented workspace inheritance for version, readme, and license fields in Cargo.toml files.
2025-02-01 11:45:04 -05:00
0cfd5dc89e fix(tui): handle 'End' key for bottom logs navigation
Update the TUI to handle both 'Shift+G' and 'End' keys for navigating to the bottom of logs. Adjusted the help widget text accordingly to reflect this change.
2025-01-29 15:50:35 -05:00
f1f2c796c4 feat(widget): add help widget and improve score widget
- Introduced a new `Help` widget to display user instructions.
- Improved the `ScoreListWidget` by removing unnecessary execution rendering methods and simplifying state transitions.
- Cleaned up unused imports and refactored code for better readability.
2025-01-29 15:34:16 -05:00
6628e193e0 feat: harmony terminal ui can now browse scores and (almost) launch them 2025-01-28 16:51:58 -05:00
3410751463 feat: add ScoreListWidget with execution confirmation
Implement ScoreListWidget to manage score list rendering and execution confirmation flow. This includes methods for scrolling through scores, launching an execution, confirming/denying the execution, and rendering a popup for user confirmation.
2025-01-27 23:24:21 -05:00
651266d71c fix: update Score trait implementation and TUI initialization
Update the `Score` trait implementations to return a `Box<dyn Interpret>` instead of concrete types or clones where necessary. Additionally, refactor the initialization and cleanup in `HarmonyTUI` to use utility functions provided by `ratatui`.
2025-01-25 12:36:22 -05:00
4bbe8e84d8 feat(harmony_tui): add initial TUI implementation with ratatui and crossterm
Add a new `harmony_tui` crate to initialize and run a text-based user interface (TUI) for the Harmony project using `ratatui` for rendering and `crossterm` for handling input. The `HarmonyTUI` struct initializes the terminal, enters a loop to render updates, and handles basic input events to exit. This commit sets up the foundation for further TUI development.
2025-01-24 11:30:01 -05:00
21258cf1af chore: Ran cargo fmt on all code 2025-01-24 10:50:38 -05:00
d6c8650d52 feat(k8s): add Kubernetes deployment resource handling
Introduce new modules to handle Kubernetes resources specifically focusing on Deployment resources. Added `K8sResource` and `K8sDeployment` structs along with necessary traits implementations for interpretation and execution in the inventory system. Also, fixed module reordering issues in opnsense-config-xml and corrected some fields types within its data structures.
2025-01-24 10:44:27 -05:00
caec71f06d feat(k8s): add initial Resource module structure
Introduce the initial structure for the Kubernetes (K8s) resource module, including `K8sResourceScore` and `K8sResourceInterpret`. Additionally, update the module paths to include the new K8s module.
2025-01-22 10:36:19 -05:00
98c2ab169c dep: Use github dependency for yaserde 2025-01-22 10:35:35 -05:00
d8c762e9df feat(harmony_macros): add yaml macro to validate YAML input
- Introduced a new `yaml` macro in `harmony_macros` that validates if the provided YAML string is valid by attempting to deserialize it using `serde_yaml`.
- Added dependencies on `serde`, `serde_yaml` for handling YAML deserialization.
- Included dev dependencies with features enabled for deriving types from `serde`.
2025-01-22 10:21:08 -05:00
jeangab
2041ce63d7 feat(adr): add architecture decision record for infrastructure abstractions
Introduce a new Architecture Decision Record (ADR) outlining the design of provider-agnostic infrastructure abstractions in Harmony. This ADR details how domain-driven traits will be used to define essential elements for resources and upgrades, enabling flexibility and portability across different cloud providers.
2025-01-18 07:11:29 -05:00
jeangab
42ed82b0c1 wip: Kube-rs demo 2025-01-16 16:13:48 -05:00
04db8103c4 fix(config): update variable names and remove unused imports
Refactor variable names to follow snake_case convention and remove unused imports across multiple files to improve code readability and maintainability.
2025-01-12 15:57:01 -05:00