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.
This commit is contained in:
jeangab 2025-01-09 09:30:04 -05:00
parent 0af8e7e6a8
commit a80ead418e
2 changed files with 6 additions and 1 deletions

View File

@ -68,7 +68,7 @@ impl Config {
pub async fn install_package(&mut self, package_name: &str) -> Result<(), Error> { pub async fn install_package(&mut self, package_name: &str) -> Result<(), Error> {
info!("Installing opnsense package {package_name}"); info!("Installing opnsense package {package_name}");
let output = self.shell let output = self.shell
.exec(&format!("pkg install -y {package_name}")) .exec(&format!("/usr/local/opnsense/scripts/firmware/install.sh {package_name}"))
.await?; .await?;
info!("Installation output {output}"); info!("Installation output {output}");
self.reload_config().await?; self.reload_config().await?;

View File

@ -61,6 +61,11 @@ impl<'a> LoadBalancerConfig<'a> {
self.opnsense_shell.exec("configctl haproxy stop").await?; 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/HAProxy").await?;
self.opnsense_shell.exec("configctl template reload OPNsense/Syslog").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 configtest").await?;
self.opnsense_shell.exec("configctl haproxy start").await?; self.opnsense_shell.exec("configctl haproxy start").await?;
Ok(()) Ok(())