Skip to content

Commit

Permalink
Updating rpm spec files to work with mod_wsgi
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNeto committed Aug 13, 2024
1 parent 754de72 commit 44413b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 7 additions & 1 deletion perfsonar-host-metrics/perfsonar-host-metrics/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -72,16 +73,15 @@ 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/

%clean
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
Expand All @@ -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}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 [email protected] 5.0.5-0.0.a1
Expand Down

0 comments on commit 44413b1

Please sign in to comment.