Nightscout

This commit is contained in:
Alex Manning 2021-02-26 13:39:18 +00:00
parent cac1c44b04
commit 555b7792f7
2 changed files with 105 additions and 0 deletions

View file

@ -0,0 +1,44 @@
[Unit]
Description=Nightscout CGM.
[Service]
Execstart=/usr/bin/node /usr/lib/node_modules/nightscout/server.js
DynamicUser=yes
EnvironmentFile=/etc/nightscout/nightscout-environ
Restart=on-failure
PrivateTmp=yes
PrivateDevices=true
PrivateUsers=true
DevicePolicy=closed
ProtectSystem=strict
ProtectHome=tmpfs
BindPaths=/home/git
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectClock=true
ProtectKernelLogs=yes
ProtectHostname=yes
RestrictAddressFamilies=AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
NoNewPrivileges=yes
LockPersonality=yes
MemoryDenyWriteExecute=yes
CapabilityBoundingSet=
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallErrorNumber=EPERM
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,61 @@
%global forgeurl https://github.com/nightscout/cgm-remote-monitor
Version: 14.2.2
%global tag %version
%forgemeta
Name: nightscout
Release: 1%{?dist}
Summary: CGM in the cloud.
License: AGPL
URL: %forgeurl
Source0: %forgesource
Source1: nightscout.service
BuildRequires: nodejs-devel
BuildRequires: npm
BuildRequires: systemd-rpm-macros
Requires: nodejs
%global debug_package %{nil}
%description
Nightscout CGM in the cloud.
%post
%systemd_post nightscout.service
%preun
%systemd_preun nightscout.service
%postun
%systemd_postun_with_restart nightscout.service
%prep
%forgesetup
%build
npm install
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{name}
cp -pr * %{buildroot}%{nodejs_sitelib}/%{name}
rm -rf %{buildroot}%{nodejs_sitelib}/%{name}/tmp/randomString
cp -p docs/example-template.env %{buildroot}%{_sysconfdir}/nightscout/nightscout-environ
install -D %{SOURCE1} %{buildroot}%{_unitdir}/nightscout.service
%files
%license LICENSE
%doc README.md
%{nodejs_sitelib}/%{name}
%{_unitdir}/nightscout.service
%config(noreplace) %{_sysconfdir}/nightscout
%changelog
* Fri Feb 26 12:10:49 GMT 2021 Alex Manning <git@alex-m.co.uk>
-