From 44413b12c9f8dd1460981b86c8ed8dc5afc92dff Mon Sep 17 00:00:00 2001 From: Daniel Neto Date: Mon, 12 Aug 2024 21:15:35 -0300 Subject: [PATCH] Updating rpm spec files to work with mod_wsgi --- .../perfsonar-host-metrics/Makefile | 8 +++++++- .../rpm/perfsonar-host-metrics.spec | 16 ++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/Makefile b/perfsonar-host-metrics/perfsonar-host-metrics/Makefile index 1b62c44..20e0e72 100644 --- a/perfsonar-host-metrics/perfsonar-host-metrics/Makefile +++ b/perfsonar-host-metrics/perfsonar-host-metrics/Makefile @@ -11,13 +11,19 @@ endif ifndef HTTPD-CONFIGPATH @echo No HTTPD-CONFIGPATH specified for installation @false +endif +ifndef WSGI-CONFIGPATH + @echo No WSGI-CONFIGPATH specified for installation + @false endif mkdir -p ${PERFSONAR-ROOTPATH} mkdir -p ${HTTPD-CONFIGPATH} + mkdir -p ${WSGI-CONFIGPATH} install -m 755 exporter_opts.sh ${PERFSONAR-ROOTPATH}/ - install -m 755 perfsonar_host_exporter ${PERFSONAR-ROOTPATH}/ + install -m 755 perfsonar_host_exporter.py ${PERFSONAR-ROOTPATH}/ install -m 644 apache-node_exporter.conf ${HTTPD-CONFIGPATH}/ install -m 644 apache-perfsonar_host_exporter.conf ${HTTPD-CONFIGPATH}/ + install -m 644 host_exporter.wsgi ${WSGI-CONFIGPATH}/ clean: @true diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec index 69a4847..d277eb3 100644 --- a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec +++ b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec @@ -1,6 +1,7 @@ %define install_base /usr/lib/perfsonar %define pkg_install_base %{install_base}/host_metrics %define httpd_config_base /etc/httpd/conf.d +%define wsgi_config_base /var/www/html/perfsonar/host_exporter #Version variables set by automated scripts %define perfsonar_auto_version 5.2.0 @@ -72,9 +73,7 @@ A package that installs and sets-up Prometheus node_exporter for a perfSONAR ins make -f /usr/share/selinux/devel/Makefile -C selinux perfsonar_host_metrics.pp %install -make PERFSONAR-ROOTPATH=%{buildroot}/%{pkg_install_base} HTTPD-CONFIGPATH=%{buildroot}/%{httpd_config_base} install -mkdir -p %{buildroot}/%{_unitdir}/ -install -m 644 *.service %{buildroot}/%{_unitdir}/ +make PERFSONAR-ROOTPATH=%{buildroot}/%{pkg_install_base} HTTPD-CONFIGPATH=%{buildroot}/%{httpd_config_base} WSGI-CONFIGPATH=%{buildroot}/%{wsgi_config_base} install mkdir -p %{buildroot}/usr/share/selinux/packages/ mv selinux/*.pp %{buildroot}/usr/share/selinux/packages/ @@ -82,6 +81,7 @@ mv selinux/*.pp %{buildroot}/usr/share/selinux/packages/ rm -rf %{buildroot} %post +ln -sT -f %{pkg_install_base} %{wsgi_config_base}/host_exporter #selinux semodule -n -i /usr/share/selinux/packages/perfsonar_host_metrics.pp @@ -91,7 +91,6 @@ fi #Restart/enable opensearch and logstash %systemd_post node_exporter.service -%systemd_post perfsonar-host-exporter.service if [ "$1" = "1" ]; then #set SELinux booleans to allow httpd proxy to work %selinux_set_booleans -s %{selinuxtype} %{selinuxbooleans} @@ -103,8 +102,6 @@ if [ "$1" = "1" ]; then 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 reverse proxy systemctl enable httpd systemctl restart httpd @@ -115,11 +112,10 @@ fi %preun %systemd_preun node_exporter.service -%systemd_preun perfsonar-host-exporter.service %postun ++%{__rm} -f %{wsgi_config_base}/host_exporter %systemd_postun_with_restart node_exporter.service -%systemd_postun_with_restart perfsonar-host-exporter.service if [ $1 -eq 0 ]; then %selinux_unset_booleans -s %{selinuxtype} %{selinuxbooleans} semodule -n -r perfsonar_host_metrics @@ -132,11 +128,11 @@ fi %defattr(0644,perfsonar,perfsonar,0755) %license LICENSE %attr(0755, perfsonar, perfsonar) %{pkg_install_base}/exporter_opts.sh -%attr(0755, perfsonar, perfsonar) %{pkg_install_base}/perfsonar_host_exporter +%attr(0755, perfsonar, perfsonar) %{pkg_install_base}/perfsonar_host_exporter.py %attr(0644, perfsonar, perfsonar) %{httpd_config_base}/apache-node_exporter.conf %attr(0644, perfsonar, perfsonar) %{httpd_config_base}/apache-perfsonar_host_exporter.conf +%attr(0644, perfsonar, perfsonar) %{wsgi_config_base}/host_exporter.wsgi %attr(0644,root,root) /usr/share/selinux/packages/* -%{_unitdir}/perfsonar-host-exporter.service %changelog * Tue Oct 24 2023 andy@es.net 5.0.5-0.0.a1