Browse Source

new rpm: scaphandre

main
Nicolas Massé 5 years ago
parent
commit
e2d9279675
  1. 4
      rpmbuild/SOURCES/scaphandre.env
  2. 16
      rpmbuild/SOURCES/scaphandre.service
  3. 58
      rpmbuild/SPECS/scaphandre.spec

4
rpmbuild/SOURCES/scaphandre.env

@ -0,0 +1,4 @@
LISTEN_ADDRESS=0.0.0.0
LISTEN_PORT=9390
SCAPHANDRE_EXPORTER=prometheus
SCAPHANDRE_OPTIONS=

16
rpmbuild/SOURCES/scaphandre.service

@ -0,0 +1,16 @@
[Unit]
Description=Electrical power consumption metrology agent
Wants=network.target
After=network-online.target
[Service]
Restart=always
Type=simple
EnvironmentFile=/opt/scaphandre/etc/scaphandre.env
ExecStart=/opt/scaphandre/bin/scaphandre ${SCAPHANDRE_EXPORTER} -p ${LISTEN_PORT} -a ${LISTEN_ADDRESS} $SCAPHANDRE_OPTIONS
WorkingDirectory=/opt/scaphandre
User=scaphandre
Group=itix-svc
[Install]
WantedBy=multi-user.target default.target

58
rpmbuild/SPECS/scaphandre.spec

@ -0,0 +1,58 @@
Name: scaphandre
Version: 0.3.0
Release: itix1
Summary: Electrical power consumption metrology agent.
License: Apache-2.0
Source0: https://github.com/hubblo-org/%{name}/archive/refs/tags/v%{version}.tar.gz
Source1: %{name}.service
Source2: %{name}.env
ExclusiveArch: x86_64
BuildRequires: systemd
BuildRequires: rust
BuildRequires: cargo
BuildRequires: openssl-devel
Requires(pre): shadow-utils
%description
Scaphandre is a metrology agent dedicated to electrical power consumption
metrics. The goal of the project is to permit to any company or individual
to measure the power consumption of its tech services and get this data in
a convenient form, sending it through any monitoring or data analysis
toolchain.
# Since we don't recompile from source, disable the build_id checking
%global _missing_build_ids_terminate_build 0
%global _build_id_links none
%global debug_package %{nil}
%prep
%setup
cp %{S:1} %{name}.service
cp %{S:2} %{name}.env
%build
cargo build --release
%install
install -D target/release/scaphandre %{buildroot}/opt/scaphandre/bin/scaphandre
install -D -m 0644 %{name}.env %{buildroot}/opt/%{name}/etc/%{name}.env
install -D -m 0644 %{name}.service %{buildroot}/%{_unitdir}/%{name}.service
%files
%defattr(0644, root, root, 0755)
%dir /opt/%{name}/bin/
%dir /opt/%{name}/etc/
%attr(0755, root, root) /opt/scaphandre/bin/scaphandre
%config(noreplace) /opt/%{name}/etc/%{name}.env
%{_unitdir}/%{name}.service
%pre
getent group itix-svc >/dev/null || groupadd -r itix-svc
getent passwd %{name} >/dev/null || useradd -r -g itix-svc \
-d /tmp -s /sbin/nologin -c "Electrical power consumption metrology agent" \
%{name}
exit 0
%changelog
Loading…
Cancel
Save