diff --git a/nightscout/nightscout.service b/nightscout/nightscout.service new file mode 100644 index 0000000..c941c93 --- /dev/null +++ b/nightscout/nightscout.service @@ -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 diff --git a/nightscout/nightscout.spec b/nightscout/nightscout.spec new file mode 100644 index 0000000..b2d069e --- /dev/null +++ b/nightscout/nightscout.spec @@ -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 +-