Commit Graph

86 Commits

Author SHA1 Message Date
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
f241bf793e fix(dhcp): remove unused IP range check and simplify DnsConfig
Remove the commented-out IP range validation in `DhcpConfig` and simplify the `DnsConfig` constructor by removing an unnecessary parameter, addressing several compiler warnings.
2025-01-12 15:32:14 -05:00
cad63ecf20 fix(config): specify attribute argument in yaserde macros
Update yaserde macro usage to explicitly specify the `attribute` argument for consistency and compatibility with newer versions of the yaserde crate. This change ensures that all fields annotated with `#[yaserde]` correctly define attributes, aligning with the recommended usage in the latest yaserde documentation.
2025-01-12 14:06:30 -05:00
jeangab
1665198e66 "Update Harmony Opnsense Configuration"
Improved configuration handling for Harmony Opnsense setup. Implemented changes to opnsense-config module to support various settings, including load balancer configuration and DHCP server settings. This update enhances the overall stability and functionality of the Harmony Opnsense setup process.
2025-01-11 13:52:57 -05:00
jeangab
9e6f22d7ea chore: Remove mistakenly commited file 2025-01-09 11:59:18 -05:00
jeangab
bec96c2954 feat(bootstrapping): add bootstrap load balancer and DHCP configurations
- Introduce `bootstrap_load_balancer` module for handling initial load balancing configuration.
- Add `bootstrap_dhcp` module for bootstrapping DHCP settings.
- Create `harmony_types` crate to house shared types, including `MacAddress`.
- Update `harmony_macros` to use `harmony_types` instead of directly referencing `harmony`.
2025-01-09 11:58:49 -05:00
jeangab
a80ead418e fix(config): update package installation command and add load balancer setup script
Update the package installation command to use the Opnsense firmware install script.
Add a call to the HAProxy setup script during the load balancer configuration process. This script is intended to copy the staging configuration to production, though its necessity in this context is uncertain.
2025-01-09 09:30:04 -05:00
jeangab
0af8e7e6a8 fix(load-balancer): implement missing HAProxy reload and sanitize output handling
Implement the `reload_restart` method in `LoadBalancerConfig` to ensure proper HAProxy configuration management. Additionally, enhance SSH command execution by sanitizing and logging outputs effectively. This ensures robust handling of HAProxy configurations and improves debugging capabilities through trace-level logs.
2025-01-08 16:30:56 -05:00
a55c63ffa6 feat(harmony_macros): add ipv4 macro
Adds a new `ipv4` macro to validate IPv4 addresses in proc macros. Removes unused `debug` import from `http.rs`.
2025-01-08 11:49:42 -05:00
81d40ec163 feat(opnsense-config): add caddy module with configuration management
Introduce a new Caddy module within opnsense-config to manage Caddy server configurations. This includes enabling/disabling Caddy, setting ports, and reloading/restarting the service via OPNsense shell commands. Additionally, provide a sample Caddy configuration file for PXE booting and a test file in the pxe-http-files directory.
2025-01-07 17:12:39 -05:00
925e84e4d2 feat(harmony): add TFTP server functionality (#10)
Introduce a new module and interface for serving files via TFTP in the HAClusterTopology structure. This includes adding the necessary dependencies, creating the `TftpServer` trait, implementing it where appropriate, and integrating its usage within the topology struct.

Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/10
Co-authored-by: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Co-committed-by: Jean-Gabriel Gill-Couture <jg@nationtech.io>
2025-01-07 19:12:35 +00:00
098cb30523 feat(load balancer): Can now fully configure an OPNSense HAProxy
instance for and openshift/OKD cluster

Squashed commit of the following:

commit f0d90d9e37da925c6b4441b076e212dd4f340cb7
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Fri Jan 3 10:19:49 2025 -0500

    chore: Remove opnsense config file committe by mistake

commit 73f017e6abc770003c483ee7e121c1c6e3cafa1a
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Fri Jan 3 10:17:42 2025 -0500

    feat(config): enhance HAProxy load balancer configuration and organize structs

    Add missing fields to the HAProxy load balancer configuration to make it fully functional. Move most of the HAProxy-related structs to their own file within `opnsense-config-xml` for better organization and maintainability.

commit 8a1b0b77dc6dde32298f69b0ca8a24ea2246de9e
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Tue Dec 31 12:06:37 2024 -0500

    feat(OPNSense): add support for configuration port and load balancer commit

    Introduce an optional port parameter to OPNSense configuration creation and enhance LoadBalancerInterpret to apply configurations after ensuring service existence. Adjust package installation commands to run non-interactively and log outputs. Add methods to enable the HAProxy component in the load balancer configuration.

commit 5075d1146f12cf7df2ae5d66ecee45f056ab39e8
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Sun Dec 29 09:29:57 2024 -0500

    docs: add README.md for OPNSense demo in vbox-opnsense

    Add a README file with instructions on how to download, start, and run the OPNSense virtual machine using VirtualBox, including credentials and command line usage details.

commit 5cda52430f1db6279707f8d189b7aac10195e09d
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Sat Dec 28 23:27:45 2024 -0500

    feat(opnsense-config): add package management and refactor load balancer module

    - Introduced `install_package` and `reload_haproxy` methods in the `Config` struct to manage OPNsense packages and reload HAProxy configuration.
    - Refactored `LoadBalancerConfig` to use a helper method `with_haproxy` for modifying HAProxy configurations, improving code readability and reducing duplication.
    - Added TODO warning in `add_backend` method to ensure new backends refer only to existing entities like servers or health checks.

commit d01186d21c443543e278c9e5190317b9961f8112
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Sat Dec 28 15:11:10 2024 -0500

    feat: Created demo project for virtualbox opnsense

commit c6c92ab1d457f5b2e38cbcfec0660c6fb550df1e
Author: Jean-Gabriel Gill-Couture <jeangabriel.gc@gmail.com>
Date:   Tue Dec 24 08:08:59 2024 -0500

    fix(xml): Support virtualbox config, pretty much vanilla opnsense

commit 4d5c23a6d07a434baa83d608247d0c7c446c1c08
Author: Sylvain Tremblay <stremblay@nationtech.io>
Date:   Fri Dec 20 16:15:18 2024 -0500

    fix: Support st opnsense config

commit 4546e6b5482061e3d51e07451ba182054d44d888
Author: johnride <jg@nationtech.io>
Date:   Fri Dec 20 21:11:56 2024 +0000

    feat: HAProxy load balancer able to load and create services, ready to be tested, they do not upload the new config yet

commit a899811d9bacea10e799a072965350842f9cbc7c
Author: johnride <jg@nationtech.io>
Date:   Fri Dec 20 18:39:32 2024 +0000

    feat: LoadBalancer building haproxy structures wip

commit 653c323f050ead350fd048fb30c1c3717b1471d1
Author: johnride <jg@nationtech.io>
Date:   Fri Dec 20 05:02:52 2024 +0000

    feat: LoadBalancer progress, now handles loading frontend, backend, servers and healthchecks from haproxy xml

commit 737e738f62d22523d5ededa4b6cc0b2e0ac7a0da
Author: jeangab <jeangabriel.gc@gmail.com>
Date:   Thu Dec 19 18:30:58 2024 -0500

    wip: Haproxy coming along, about 80% done before first test

commit 615ed36d89182e4bb1f2312dc9a8e4a7c31ab416
Author: Jean-Gabriel Gill-Couture <jeangabriel.gc@gmail.com>
Date:   Wed Dec 18 22:20:36 2024 -0500

    wip: LoadBalancer score coming along, first part of the score definition done. Next step is finishing it up and writing the concrete HAProxy implementation
2025-01-04 10:12:16 -05:00
0b6c8bfd09 Merge branch 'master' of https://git.nationtech.io/NationTech/harmony 2024-12-19 15:53:50 -05:00
9c672a5c80 chore: remove useless files in the tftpboot tree 2024-12-19 15:51:03 -05:00
Jean-Gabriel Gill-Couture
367e96b36a feat: Add OKD DNS score with DNS entries and registering dhcp leases 2024-12-18 15:58:49 -05:00
b098757683 Merge pull request 'feat: don't crash if ip:mac already exist, just skip it' (#7) from feat/validateExistingStaticLease into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/7
2024-12-18 17:46:25 +00:00
0247252474 feat: don't crash if ip:mac already exist, just skip it 2024-12-18 17:46:08 +00:00
f7e97f5c81 Merge pull request 'feat: Add score and opnsense implementation to register dhcp leases in dns server' (#8) from feat/dnsRegisterDhcpLeases into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/8
2024-12-18 17:45:54 +00:00
Jean-Gabriel Gill-Couture
478fd9e941 feat: Add score and opnsense implementation to register dhcp leases in dns server 2024-12-18 12:38:04 -05:00
51c6f1818c feat: remove the getMacAddress 2024-12-18 09:38:17 -05:00
58f81f0e58 Merge pull request 'feat/opnsenseDNS' (#6) from feat/opnsenseDNS into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/6
2024-12-18 14:21:54 +00:00
Jean-Gabriel Gill-Couture
18c67adfad feat: Harmony now sets dhcp next boot server for PXE on okd setup 2024-12-17 22:45:37 -05:00
Jean-Gabriel Gill-Couture
b15df3c93f feat: OKD Dhcp config works and is actually savec on opnsense firewall, its alive!! First real run on wk cluster 2024-12-17 15:15:41 -05:00
Jean-Gabriel Gill-Couture
d0d81af796 feat(macro): Add mac_address macro 2024-12-17 09:54:23 -05:00
Jean-Gabriel Gill-Couture
1e0c2eb470 feat: Added new crate harmony_macros with ip! macro to facilitate creating ip addresses 2024-12-09 15:23:12 -05:00
jeangab
3592b176e5 chore: Some cleanup in harmony repo 2024-12-03 10:43:50 -05:00