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

@@ -7,7 +7,7 @@ pipeline {
string defaultValue: '192.168.200.11', description: 'Proxy server for packages, when enabled', name: 'ProxyServer' string defaultValue: '192.168.200.11', description: 'Proxy server for packages, when enabled', name: 'ProxyServer'
booleanParam description: 'will disable use of proxy server', name: 'DisProxy' booleanParam description: 'will disable use of proxy server', name: 'DisProxy'
checkboxParameter(name: 'ImgVariantList', format: 'JSON', displayNodePath: "//Variants/Variant", valueNodePath: "//Variants/Variant", description: 'Select the variant(s) that should be build', checkboxParameter(name: 'ImgVariantList', format: 'JSON', displayNodePath: "//Variants/Variant", valueNodePath: "//Variants/Variant", description: 'Select the variant(s) that should be build',
pipelineSubmitContent: '{"Variants": [{"Variant": "minimal"},{"Variant": "default"},{"Variant": "gitea"},{"Variant": "nginx"},{"Variant": "ddns"},{"Variant": "transfersh"},{"Variant": "iscsi"},{"Variant": "z2mqtt"},{"Variant": "nodered"},{"Variant": "nodejs"},{"Variant": "nextcloud"},{"Variant": "mqtt"},{"Variant": "hass"},{"Variant": "mailbackup"},{"Variant": "elkarbackupALP"},{"Variant": "heimdall"},{"Variant": "vouchproxy"},{"Variant": "freshrss"}]}') pipelineSubmitContent: '{"Variants": [{"Variant": "minimal"},{"Variant": "default"},{"Variant": "gitea"},{"Variant": "nginx"},{"Variant": "ddns"},{"Variant": "transfersh"},{"Variant": "iscsi"},{"Variant": "z2mqtt"},{"Variant": "nodered"},{"Variant": "nodejs"},{"Variant": "nextcloud"},{"Variant": "mqtt"},{"Variant": "hass"},{"Variant": "mailbackup"},{"Variant": "elkarbackupALP"},{"Variant": "heimdall"},{"Variant": "vouchproxy"},{"Variant": "freshrss"},{"Variant": "uptimekuma"}]}')
} }
options { options {
skipDefaultCheckout() skipDefaultCheckout()

View File

@@ -375,6 +375,13 @@ files:
variants: variants:
- freshrss - freshrss
#FileForUptimeKuma
- path: /opt/Setup
generator: copy
source: CT-Files/uptimekuma
variants:
- uptimekuma
packages: packages:
manager: apk manager: apk
update: true update: true
@@ -449,6 +456,7 @@ packages:
- z2mqtt - z2mqtt
- nodered - nodered
- nodejs - nodejs
- uptimekuma
#PKGS for z2mqtt #PKGS for z2mqtt
- packages: - packages:
@@ -641,6 +649,15 @@ packages:
variants: variants:
- freshrss - freshrss
#PKGS for UptimeKunma
- packages:
- git
- curl
- ca-certificates
- libcap
action: install
variants:
- uptimekuma
repositories: repositories:
- name: /etc/apk/repositories - name: /etc/apk/repositories
@@ -680,6 +697,15 @@ actions:
echo "Europe/Amsterdam" > /etc/timezone echo "Europe/Amsterdam" > /etc/timezone
ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
#Temporarily disable sudo pseudo-terminal(since distrobuilder does not setup pty devices)
- trigger: post-packages
action: |-
#!/bin/sh
if [ -d "/etc/sudoers.d" ]; then
# If sudoers dir exists, presume sudo is installed
echo "Defaults !use_pty" > /etc/sudoers.d/DisablePTY
fi
#Run init script for NodeJS CT #Run init script for NodeJS CT
- trigger: post-files - trigger: post-files
action: |- action: |-
@@ -698,6 +724,7 @@ actions:
- z2mqtt - z2mqtt
- nodered - nodered
- nodejs - nodejs
- uptimekuma
#Run init script for CT's with Nginx #Run init script for CT's with Nginx
- trigger: post-files - trigger: post-files
@@ -737,6 +764,7 @@ actions:
- heimdall - heimdall
- vouchproxy - vouchproxy
- freshrss - freshrss
- uptimekuma
#Move App update script for ProxmoxHelper/ProxMoxToolKit, if CT has this script #Move App update script for ProxmoxHelper/ProxMoxToolKit, if CT has this script
- trigger: post-files - trigger: post-files
@@ -755,5 +783,13 @@ actions:
variants: variants:
- iscsi - iscsi
#Re-enable sudo pseudo-terminal
- trigger: post-files
action: |-
#!/bin/sh
if [ -f "/etc/sudoers.d/DisablePTY" ]; then
rm -f /etc/sudoers.d/DisablePTY
fi
mappings: mappings:
architecture_map: alpinelinux architecture_map: alpinelinux

View File

@@ -8,6 +8,7 @@ npm install --prefix /opt/node/node-red/app node-red @node-red-contrib-themes/th
#Save PM2 statup config #Save PM2 statup config
pm2 install pm2-logrotate
pm2 start --name nodered --cwd /opt/node/node-red/app ./node_modules/node-red/red.js -- -u /opt/node/node-red/data pm2 start --name nodered --cwd /opt/node/node-red/app ./node_modules/node-red/red.js -- -u /opt/node/node-red/data
pm2 save pm2 save
pm2 kill pm2 kill

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

View File

@@ -17,6 +17,7 @@ git clone https://github.com/zwave-js/zwave-js-ui /opt/node/ZwaveJsUi
yarn --cwd /opt/node/ZwaveJsUi run build yarn --cwd /opt/node/ZwaveJsUi run build
#Save PM2 statup config #Save PM2 statup config
pm2 install pm2-logrotate
pm2 start npm --name zigbee2mqtt --cwd /opt/node/zigbee2mqtt -- start pm2 start npm --name zigbee2mqtt --cwd /opt/node/zigbee2mqtt -- start
pm2 start yarn --name ZwaveJsUi --cwd /opt/node/ZwaveJsUi -- start pm2 start yarn --name ZwaveJsUi --cwd /opt/node/ZwaveJsUi -- start
pm2 save pm2 save

View File

@@ -51,6 +51,7 @@ This can be done on a privileged Debian CT (make sure to enable the Fuse, Nestin
| heimdall | Alpine | Heimdall, A application dashboard/launcher | | heimdall | Alpine | Heimdall, A application dashboard/launcher |
| vouchproxy | Alpine | Vouch-proxy, A SSO solution for Nginx | | vouchproxy | Alpine | Vouch-proxy, A SSO solution for Nginx |
| freshrss | Alpine | FreshRSS, a self-hosted RSS feed aggregator | | freshrss | Alpine | FreshRSS, a self-hosted RSS feed aggregator |
| uptiimekuma | Alpine | Uptime Kuma a self-hosted monitoring tool. |
## TODO ## TODO
**Begin original list** **Begin original list**
@@ -272,6 +273,9 @@ lxc.mount.entry: /dev/ttyACM-Zwave dev/ttyACM-Zwave none bind,optional,create=fi
## esphome ## esphome
* Available on http://`<ip>`:6052 * Available on http://`<ip>`:6052
## uptimekuma
* Available on http://`<ip>`:80
# Further CT documentation # Further CT documentation
## iscsi ## iscsi