From 0065fbf8cf24578d3b23fd9b6734de768bffc515 Mon Sep 17 00:00:00 2001 From: gOOvER <116325+gOOvER@users.noreply.github.com> Date: Mon, 9 Oct 2023 19:07:39 +0200 Subject: [PATCH] Installation and update significantly simplified --- software/uptime-kuma/egg-uptime-kuma.json | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/software/uptime-kuma/egg-uptime-kuma.json b/software/uptime-kuma/egg-uptime-kuma.json index ced614ae..bf756329 100644 --- a/software/uptime-kuma/egg-uptime-kuma.json +++ b/software/uptime-kuma/egg-uptime-kuma.json @@ -4,7 +4,7 @@ "version": "PTDL_v2", "update_url": null }, - "exported_at": "2023-10-01T10:06:16+02:00", + "exported_at": "2023-10-09T19:06:53+02:00", "name": "Uptime Kuma", "author": "eggs@goover.dev", "description": "Uptime Kuma is an easy-to-use self-hosted monitoring tool.", @@ -13,7 +13,7 @@ "ghcr.io\/parkervcp\/apps:uptimekuma": "ghcr.io\/parkervcp\/apps:uptimekuma" }, "file_denylist": [], - "startup": "node \/home\/container\/server\/server.js --port={{SERVER_PORT}}", + "startup": "if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == \"1\" ]]; then npm run setup; fi; \/usr\/local\/bin\/node \/home\/container\/server\/server.js --port={{SERVER_PORT}}", "config": { "files": "{}", "startup": "{\r\n \"done\": \"[SERVER] INFO: Listening on \"\r\n}", @@ -22,7 +22,7 @@ }, "scripts": { "installation": { - "script": "#!\/bin\/ash\r\n# Uptime Kuma App Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napk update\r\napk add --no-cache git curl jq file unzip make gcc g++ python3 python3-dev libtool\r\n\r\nif [ -d \"\/mnt\/server\/node_modules\" ]; then\r\n rm -fR \/mnt\/server\/node_modules\r\n npm cache verify\r\nfi\r\n\r\nnpm install -g npm@latest\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\n## add git ending if it's not on the address\r\nif [[ ${GIT_ADDRESS} != *.git ]]; then\r\n GIT_ADDRESS=${GIT_ADDRESS}.git\r\nfi\r\n\r\n## pull git js repo\r\nif [ \"$(ls -A \/mnt\/server)\" ]; then\r\n echo -e \"\/mnt\/server directory is not empty.\"\r\n if [ -d .git ]; then\r\n echo -e \".git directory exists\"\r\n if [ -f .git\/config ]; then\r\n echo -e \"loading info from git config\"\r\n ORIGIN=$(git config --get remote.origin.url)\r\n else\r\n echo -e \"files found with no git config\"\r\n echo -e \"closing out without touching things to not break anything\"\r\n exit 10\r\n fi\r\n fi\r\n\r\n if [ \"${ORIGIN}\" == \"${GIT_ADDRESS}\" ]; then\r\n echo \"pulling latest from github\"\r\n git pull\r\n fi\r\nelse\r\n echo -e \"\/mnt\/server is empty.\\ncloning files into repo\"\r\n if [ -z ${BRANCH} ]; then\r\n echo -e \"cloning default branch\"\r\n git clone ${GIT_ADDRESS} .\r\n else\r\n echo -e \"cloning ${BRANCH}'\"\r\n git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} .\r\n fi\r\n\r\nfi\r\n\r\n## add below your custom commands if needed\r\ncd \/mnt\/server\r\nmkdir -p \/mnt\/server\/data\r\ngit config --global --add safe.directory \/mnt\/server\r\n\r\nnpm run setup\r\n\r\nif [ ! -f \"\/mnt\/server\/data\/kuma.db\" ]; then\r\n cp \/mnt\/server\/db\/kuma.db \/mnt\/server\/data\/kuma.db\r\nfi\r\n\r\n## install end\r\necho -e \"-----------------------------------------\"\r\necho -e \"Installation completed...\"\r\necho -e \"-----------------------------------------\"\r\nexit 0", + "script": "#!\/bin\/ash\r\n# Uptime Kuma App Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napk update\r\napk add --no-cache git curl jq file unzip make gcc g++ python3 python3-dev libtool\r\napk add --no-cache git-lfs --repository=https:\/\/dl-cdn.alpinelinux.org\/alpine\/latest-stable\/community\r\n\r\n## npm update to latest\r\necho -e \"Updating npm to latest....\\n\"\r\nif [ -d \"\/mnt\/server\/node_modules\" ]; then\r\n rm -fR \/mnt\/server\/node_modules\r\n npm cache verify\r\nfi\r\nnpm install -g npm@latest\r\n\r\n## Uptime Kuma install & update\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\ngit config --global --add safe.directory \/mnt\/server\r\n\r\nif [ -d .git ]; then\r\n echo -e \"Updating Uptime Kuma....\\n \"\r\n npm run setup\r\nelse\r\n echo -e \"Download and installing Uptime Kuma...\\n\" \r\n git clone https:\/\/github.com\/louislam\/uptime-kuma.git .\r\n npm run setup\r\nfi\r\n\r\n## only create dir, when .git is present to prevent errors\r\nif [ -d .git ]; then\r\n mkdir -p \/mnt\/server\/data\r\nfi\r\n\r\nif [ ! -f \"\/mnt\/server\/data\/kuma.db\" ]; then\r\n cp \/mnt\/server\/db\/kuma.db \/mnt\/server\/data\/kuma.db\r\nfi\r\n\r\n## install end\r\necho -e \"-----------------------------------------\"\r\necho -e \"Installation completed...\"\r\necho -e \"-----------------------------------------\"\r\nexit 0", "container": "node:18-alpine", "entrypoint": "ash" } @@ -47,6 +47,16 @@ "user_editable": false, "rules": "required|string", "field_type": "text" + }, + { + "name": "Auto Update", + "description": "", + "env_variable": "AUTO_UPDATE", + "default_value": "1", + "user_viewable": true, + "user_editable": true, + "rules": "required|boolean", + "field_type": "text" } ] } \ No newline at end of file