diff --git a/CT-Build/Alpine.Jenkinsfile b/CT-Build/Alpine.Jenkinsfile index a9d3982..4ef4b4e 100644 --- a/CT-Build/Alpine.Jenkinsfile +++ b/CT-Build/Alpine.Jenkinsfile @@ -7,7 +7,7 @@ pipeline { 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' 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 { skipDefaultCheckout() diff --git a/CT-Build/Alpine.yaml b/CT-Build/Alpine.yaml index 808c696..43ef9b6 100644 --- a/CT-Build/Alpine.yaml +++ b/CT-Build/Alpine.yaml @@ -375,6 +375,13 @@ files: variants: - freshrss +#FileForUptimeKuma +- path: /opt/Setup + generator: copy + source: CT-Files/uptimekuma + variants: + - uptimekuma + packages: manager: apk update: true @@ -449,6 +456,7 @@ packages: - z2mqtt - nodered - nodejs + - uptimekuma #PKGS for z2mqtt - packages: @@ -641,6 +649,15 @@ packages: variants: - freshrss +#PKGS for UptimeKunma + - packages: + - git + - curl + - ca-certificates + - libcap + action: install + variants: + - uptimekuma repositories: - name: /etc/apk/repositories @@ -680,6 +697,15 @@ actions: echo "Europe/Amsterdam" > /etc/timezone 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 - trigger: post-files action: |- @@ -698,6 +724,7 @@ actions: - z2mqtt - nodered - nodejs + - uptimekuma #Run init script for CT's with Nginx - trigger: post-files @@ -737,6 +764,7 @@ actions: - heimdall - vouchproxy - freshrss + - uptimekuma #Move App update script for ProxmoxHelper/ProxMoxToolKit, if CT has this script - trigger: post-files @@ -755,5 +783,13 @@ actions: variants: - 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: architecture_map: alpinelinux diff --git a/CT-Files/nodered/Scripts/Init.sh b/CT-Files/nodered/Scripts/Init.sh index 1932099..904f9d7 100644 --- a/CT-Files/nodered/Scripts/Init.sh +++ b/CT-Files/nodered/Scripts/Init.sh @@ -8,6 +8,7 @@ npm install --prefix /opt/node/node-red/app node-red @node-red-contrib-themes/th #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 save pm2 kill diff --git a/CT-Files/uptimekuma/Scripts/Init.sh b/CT-Files/uptimekuma/Scripts/Init.sh new file mode 100644 index 0000000..a6bb62e --- /dev/null +++ b/CT-Files/uptimekuma/Scripts/Init.sh @@ -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 \ No newline at end of file diff --git a/CT-Files/uptimekuma/Scripts/PTKAppUpdate.sh b/CT-Files/uptimekuma/Scripts/PTKAppUpdate.sh new file mode 100644 index 0000000..7477efb --- /dev/null +++ b/CT-Files/uptimekuma/Scripts/PTKAppUpdate.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Update script for updating apps with ProxmoxHelper/ProxMoxToolKit +ash /opt/Update-UptimeKuma.sh \ No newline at end of file diff --git a/CT-Files/uptimekuma/Scripts/Update-UptimeKuma.sh b/CT-Files/uptimekuma/Scripts/Update-UptimeKuma.sh new file mode 100644 index 0000000..9426a17 --- /dev/null +++ b/CT-Files/uptimekuma/Scripts/Update-UptimeKuma.sh @@ -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 \ No newline at end of file diff --git a/CT-Files/z2mqtt/Scripts/Init.sh b/CT-Files/z2mqtt/Scripts/Init.sh index 03a4f03..1c799bc 100644 --- a/CT-Files/z2mqtt/Scripts/Init.sh +++ b/CT-Files/z2mqtt/Scripts/Init.sh @@ -17,6 +17,7 @@ git clone https://github.com/zwave-js/zwave-js-ui /opt/node/ZwaveJsUi yarn --cwd /opt/node/ZwaveJsUi run build #Save PM2 statup config +pm2 install pm2-logrotate pm2 start npm --name zigbee2mqtt --cwd /opt/node/zigbee2mqtt -- start pm2 start yarn --name ZwaveJsUi --cwd /opt/node/ZwaveJsUi -- start pm2 save diff --git a/Readme.md b/Readme.md index 3dc407d..509f88e 100644 --- a/Readme.md +++ b/Readme.md @@ -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 | | vouchproxy | Alpine | Vouch-proxy, A SSO solution for Nginx | | freshrss | Alpine | FreshRSS, a self-hosted RSS feed aggregator | +| uptiimekuma | Alpine | Uptime Kuma a self-hosted monitoring tool. | ## TODO **Begin original list** @@ -272,6 +273,9 @@ lxc.mount.entry: /dev/ttyACM-Zwave dev/ttyACM-Zwave none bind,optional,create=fi ## esphome * Available on http://``:6052 +## uptimekuma +* Available on http://``:80 + # Further CT documentation ## iscsi