Added CT: Uptime Kuma, Fixed sudo issue whiile building

*Added CT  'Uptime Kuma'

* Added pm2-logrotate to CT nodered and z2mqtt

*Added fix for failing to build CT's that use Sudo commands.
The  new sudo version enables PTY by default,
configured to temporarily disabled it while building
This commit is contained in:
2024-02-13 00:22:42 +01:00
parent 8a3333ce3d
commit db2f8cc7f4
8 changed files with 88 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
#!/bin/ash
#allow node to use port privileged
setcap 'cap_net_bind_service=+ep' /usr/bin/node
#Run folowing commands as 'node' user
sudo -u node ash << EOF
#Install Uptime-Kuma
git clone https://github.com/louislam/uptime-kuma.git /opt/node/Uptime-Kuma
npm --prefix /opt/node/Uptime-Kuma run setup
#Save PM2 statup config
pm2 start server/server.js --name Uptime-Kuma --cwd /opt/node/Uptime-Kuma -- --port=80
pm2 install pm2-logrotate
pm2 save
pm2 kill
EOF
#Adding update scipts
mv /opt/Setup/Scripts/Update-UptimeKuma.sh /opt/Update-UptimeKuma.sh
#Cleanup
rm -rf /home/node/.npm/_cacache
rm -rf /home/node/.cache

View File

@@ -0,0 +1,3 @@
#!/bin/sh
# Update script for updating apps with ProxmoxHelper/ProxMoxToolKit
ash /opt/Update-UptimeKuma.sh

View File

@@ -0,0 +1,19 @@
#!/bin/ash
#Get latest vesion
NewUptimeKumaVer=$(curl -s https://api.github.com/repos/louislam/uptime-kuma/releases | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |tr -d : |head -n 1)
#Compare versions to check for update
if [ "$NewUptimeKumaVer" = "$(cd /opt/node/Uptime-Kuma ; sudo -u node git describe --tags --abbrev=0)" ] ; then
echo 'Uptime-Kuma up-to-date'
exit
else
sudo -u node ash << EOF
echo 'Updating Uptime-Kuma'
cd /opt/node/Uptime-Kuma
git fetch --all
git checkout $NewUptimeKumaVer --force
npm install --production
npm run download-dist
/usr/local/bin/pm2 restart Uptime-Kuma
EOF
fi