diff --git a/src/VERSION_STRING b/src/VERSION_STRING index 840ca8cb..ecd29bf5 100644 --- a/src/VERSION_STRING +++ b/src/VERSION_STRING @@ -1 +1 @@ -1.4 \ No newline at end of file +1.5-BETA1 \ No newline at end of file diff --git a/src/build_dpkg.sh b/src/build_dpkg.sh index 08306870..e0686fcd 100755 --- a/src/build_dpkg.sh +++ b/src/build_dpkg.sh @@ -10,7 +10,7 @@ then BUILD_DATE="" fi PACKAGE=libreqos -VERSION=1.5.$BUILD_DATE +VERSION=`cat ./VERSION_STRING`.$BUILD_DATE PKGVERSION=$PACKAGE PKGVERSION+="_" PKGVERSION+=$VERSION @@ -20,7 +20,7 @@ DEBIAN_DIR=$DPKG_DIR/DEBIAN LQOS_DIR=$DPKG_DIR/opt/libreqos/src ETC_DIR=$DPKG_DIR/etc MOTD_DIR=$DPKG_DIR/etc/update-motd.d -LQOS_FILES="graphInfluxDB.py influxDBdashboardTemplate.json integrationCommon.py integrationPowercode.py integrationRestHttp.py integrationSonar.py integrationSplynx.py integrationUISP.py integrationSonar.py LibreQoS.py lqos.example lqTools.py mikrotikFindIPv6.py network.example.json pythonCheck.py README.md scheduler.py ShapedDevices.example.csv lqos.example" +LQOS_FILES="graphInfluxDB.py influxDBdashboardTemplate.json integrationCommon.py integrationPowercode.py integrationRestHttp.py integrationSonar.py integrationSplynx.py integrationUISP.py integrationSonar.py LibreQoS.py lqos.example lqTools.py mikrotikFindIPv6.py network.example.json pythonCheck.py README.md scheduler.py ShapedDevices.example.csv lqos.example ../requirements.txt" LQOS_BIN_FILES="lqos_scheduler.service.example lqosd.service.example lqos_node_manager.service.example" RUSTPROGS="lqosd lqtop xdp_iphash_to_cpu_cmdline xdp_pping lqos_node_manager lqusers lqos_setup lqos_map_perf uisp_integration lqos_support_tool" @@ -61,11 +61,8 @@ echo "#!/bin/bash" >> postinst echo "# Install Python Dependencies" >> postinst echo "pushd /opt/libreqos" >> postinst # - Setup Python dependencies as a post-install task -while requirement= read -r line -do - echo "python3 -m pip install $line" >> postinst - echo "sudo python3 -m pip install $line" >> postinst -done < ../../../../requirements.txt +echo "python3 -m pip install --break-system-packages -r src/requirements.txt" >> postinst +echo "sudo python3 -m pip install --break-system-packages -r src/requirements.txt" >> postinst # - Run lqsetup echo "/opt/libreqos/src/bin/lqos_setup" >> postinst # - Setup the services @@ -78,6 +75,18 @@ echo "/bin/systemctl start lqosd" >> postinst echo "/bin/systemctl start lqos_node_manager" >> postinst echo "/bin/systemctl start lqos_scheduler" >> postinst echo "popd" >> postinst +# Attempting to fixup versioning issues with libpython. +# This requires that you already have LibreQoS installed. +LINKED_PYTHON=$(ldd /opt/libreqos/src/bin/lqosd | grep libpython | sed -e '/^[^\t]/ d' | sed -e 's/\t//' | sed -e 's/.*=..//' | sed -e 's/ (0.*)//') +echo "if ! test -f $LINKED_PYTHON; then" >> postinst +echo " if test -f /lib/x86_64-linux-gnu/libpython3.12.so.1.0; then" >> postinst +echo " ln -s /lib/x86_64-linux-gnu/libpython3.12.so.1.0 $LINKED_PYTHON" >> postinst +echo " fi" >> postinst +echo " if test -f /lib/x86_64-linux-gnu/libpython3.11.so.1.0; then" >> postinst +echo " ln -s /lib/x86_64-linux-gnu/libpython3.11.so.1.0 $LINKED_PYTHON" >> postinst +echo " fi" >> postinst +echo "fi" >> postinst +# End of symlink insanity chmod a+x postinst # Uninstall Script diff --git a/src/build_rust.sh b/src/build_rust.sh index 7117ae5e..9fb1a55b 100755 --- a/src/build_rust.sh +++ b/src/build_rust.sh @@ -9,7 +9,7 @@ # Don't forget to setup `/etc/lqos.conf` # Check Pre-Requisites -sudo apt install python3-pip clang gcc gcc-multilib llvm libelf-dev git nano graphviz curl screen llvm pkg-config linux-tools-common linux-tools-`uname -r` libbpf-dev libssl-dev esbuild +udo apt install python3-pip clang gcc gcc-multilib llvm libelf-dev git nano graphviz curl screen llvm pkg-config linux-tools-common linux-tools-`uname -r` libbpf-dev libssl-dev esbuild if ! rustup -V &> /dev/null then diff --git a/src/integrationSplynx.py b/src/integrationSplynx.py index 35692432..483b8b73 100644 --- a/src/integrationSplynx.py +++ b/src/integrationSplynx.py @@ -20,7 +20,7 @@ def spylnxRequest(target, headers): # Sends a REST GET request to Spylnx and returns the # result in JSON url = splynx_api_url() + "/api/2.0/" + target - r = requests.get(url, headers=headers, timeout=10) + r = requests.get(url, headers=headers, timeout=120) return r.json() def getTariffs(headers): diff --git a/src/rust/lqos_setup/src/main.rs b/src/rust/lqos_setup/src/main.rs index 8e81c95e..082d10dc 100644 --- a/src/rust/lqos_setup/src/main.rs +++ b/src/rust/lqos_setup/src/main.rs @@ -166,8 +166,11 @@ fn write_combined_config( std::fs::write("/etc/lqos.conf", raw).unwrap(); } +const VERSION: &str = include_str!("../../../VERSION_STRING"); + fn main() { - println!("{:^80}", "LibreQoS 1.4 Setup Assistant".yellow().on_blue()); + let greeting = format!("LibreQoS {VERSION} Setup Assistant"); + println!("{:^80}", greeting.yellow().on_blue()); println!(); let interfaces = get_available_interfaces(); let mut if_internet: Option = None; diff --git a/src/rust/lqosd/src/throughput_tracker/mod.rs b/src/rust/lqosd/src/throughput_tracker/mod.rs index 8389c171..9e8847a4 100644 --- a/src/rust/lqosd/src/throughput_tracker/mod.rs +++ b/src/rust/lqosd/src/throughput_tracker/mod.rs @@ -74,6 +74,8 @@ async fn throughput_task( false }; + let mut ticker = tokio::time::interval(Duration::from_millis(interval_ms)); + ticker.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); loop { let start = Instant::now(); @@ -104,13 +106,7 @@ async fn throughput_task( } tokio::spawn(submit_throughput_stats(long_term_stats_tx.clone())); - let elapsed = start.elapsed(); - if elapsed.as_secs_f32() < 1.0 { - let sleep_duration = Duration::from_millis(interval_ms) - start.elapsed(); - tokio::time::sleep(sleep_duration).await; - } else { - log::error!("Throughput monitor thread is running behind. It took {elapsed} to poll the network.", elapsed=elapsed.as_secs_f32()); - } + ticker.tick().await; } } diff --git a/src/scheduler.py b/src/scheduler.py index 17f33bfc..85041606 100644 --- a/src/scheduler.py +++ b/src/scheduler.py @@ -13,6 +13,7 @@ if automatic_import_sonar(): from integrationSonar import importFromSonar from apscheduler.schedulers.background import BlockingScheduler from apscheduler.executors.pool import ThreadPoolExecutor +import os.path ads = BlockingScheduler(executors={'default': ThreadPoolExecutor(1)}) @@ -40,6 +41,12 @@ def importFromCRM(): except: print("Failed to import from Sonar") + # Post-CRM Hooks + path = get_libreqos_directory() + "/bin/post_integration_hook.sh" + binPath = get_libreqos_directory() + "/bin" + if os.path.isfile(path): + subprocess.Popen(path, cwd=binPath) + def graphHandler(): try: refreshBandwidthGraphs()