From 24da3c8033dce83ff7a7f4b826fd23cb662b7d5f Mon Sep 17 00:00:00 2001 From: Daniel Neto Date: Tue, 13 Aug 2024 23:32:47 -0300 Subject: [PATCH] Updating deb packaging files --- .../unibuild-packaging/deb/control | 2 +- .../deb/perfsonar-host-metrics.install | 4 ++-- .../deb/perfsonar-host-metrics.postinst | 6 ++++-- .../deb/perfsonar-host-metrics.prerm | 21 +++++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.prerm diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/control b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/control index 084a15d..f975fb1 100644 --- a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/control +++ b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/control @@ -10,7 +10,7 @@ Package: perfsonar-host-metrics Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends}, prometheus-node-exporter, openssl, apache2, apache2-ssl-dev, perfsonar-common, python3-perfsonar-psconfig, - python3-pscheduler + python3-pscheduler, python3, python3-flask, libapache2-mod-wsgi-py3 Description: Prometheus node-exporter integration with perfSONAR A package that installs and sets-up Prometheus node_exporter for a perfSONAR to collect and report host metrics. diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.install b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.install index e01cf0c..6d22aa3 100644 --- a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.install +++ b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.install @@ -1,5 +1,5 @@ apache-node_exporter.conf /etc/apache2/conf-available/ apache-perfsonar_host_exporter.conf /etc/apache2/conf-available/ exporter_opts.sh /usr/lib/perfsonar/host_metrics/ -perfsonar_host_exporter /usr/lib/perfsonar/host_metrics/ -perfsonar-host-exporter.service lib/systemd/system/ \ No newline at end of file +perfsonar_host_exporter.py /usr/lib/perfsonar/host_metrics/ +host_exporter.wsgi /var/www/html/perfsonar/host_exporter \ No newline at end of file diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.postinst b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.postinst index ce11868..670d535 100644 --- a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.postinst +++ b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.postinst @@ -7,6 +7,8 @@ set -e case "$1" in configure) + # This link is necessary because the WSGI script imports the application using a path relative to the WSGI config directory. + ln -sT -f /usr/lib/perfsonar/host_metrics/ /var/www/html/perfsonar/host_exporter/host_exporter # check if installation or update, where version is a parameter chmod 755 /usr/lib/perfsonar/host_metrics/perfsonar_host_exporter #set node_exporter opts @@ -16,9 +18,8 @@ case "$1" in systemctl daemon-reload || : systemctl enable node_exporter.service || : systemctl restart node_exporter.service || : - systemctl enable perfsonar-host-exporter.service || : - systemctl restart perfsonar-host-exporter.service || : + # Enable and restart apache for wsgi and reverse proxy # Apache setup if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then . /usr/share/apache2/apache2-maintscript-helper @@ -27,6 +28,7 @@ case "$1" in apache2_invoke ensite default-ssl apache2_invoke enmod proxy apache2_invoke enmod proxy_http + apache2_invoke enconf mod-wsgi apache2_invoke enconf apache-node_exporter apache2_invoke enconf apache-perfsonar_host_exporter fi diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.prerm b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.prerm new file mode 100644 index 0000000..b8102cf --- /dev/null +++ b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/perfsonar-host-metrics.prerm @@ -0,0 +1,21 @@ +#!/bin/sh +# prerm script for perfsonar host metrics +# +# see: dh_installdeb(1) + +set -e + + +case "$1" in + remove|upgrade|deconfigure) + if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke disconf apache-node_exporter + apache2_invoke disconf apache-perfsonar_host_exporter + fi + + rm -f /var/www/html/perfsonar/host_exporter/host_exporter + ;; +esac + +exit 0 \ No newline at end of file