From a80ead418e9cab340acb85bece14107d8f08417b Mon Sep 17 00:00:00 2001 From: jeangab Date: Thu, 9 Jan 2025 09:30:04 -0500 Subject: [PATCH] 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. --- harmony-rs/opnsense-config/src/config/config.rs | 2 +- harmony-rs/opnsense-config/src/modules/load_balancer.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/harmony-rs/opnsense-config/src/config/config.rs b/harmony-rs/opnsense-config/src/config/config.rs index cea652b..bef244b 100644 --- a/harmony-rs/opnsense-config/src/config/config.rs +++ b/harmony-rs/opnsense-config/src/config/config.rs @@ -68,7 +68,7 @@ impl Config { pub async fn install_package(&mut self, package_name: &str) -> Result<(), Error> { info!("Installing opnsense package {package_name}"); let output = self.shell - .exec(&format!("pkg install -y {package_name}")) + .exec(&format!("/usr/local/opnsense/scripts/firmware/install.sh {package_name}")) .await?; info!("Installation output {output}"); self.reload_config().await?; diff --git a/harmony-rs/opnsense-config/src/modules/load_balancer.rs b/harmony-rs/opnsense-config/src/modules/load_balancer.rs index 72b161a..d30dcdb 100644 --- a/harmony-rs/opnsense-config/src/modules/load_balancer.rs +++ b/harmony-rs/opnsense-config/src/modules/load_balancer.rs @@ -61,6 +61,11 @@ impl<'a> LoadBalancerConfig<'a> { self.opnsense_shell.exec("configctl haproxy stop").await?; self.opnsense_shell.exec("configctl template reload OPNsense/HAProxy").await?; self.opnsense_shell.exec("configctl template reload OPNsense/Syslog").await?; + + // This script copies the staging config to production config. I am not 100% sure it is + // required in the context + self.opnsense_shell.exec("/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh deploy").await?; + self.opnsense_shell.exec("configctl haproxy configtest").await?; self.opnsense_shell.exec("configctl haproxy start").await?; Ok(())