diff --git a/ct/uptimekuma.sh b/ct/uptimekuma.sh index bcc689206..346212b56 100644 --- a/ct/uptimekuma.sh +++ b/ct/uptimekuma.sh @@ -34,27 +34,29 @@ function update_script() { echo "Installed NPM..." fi fi - LATEST=$(curl -fsSL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | grep '"tag_name":' | cut -d'"' -f4) - msg_info "Stopping ${APP}" - $STD sudo systemctl stop uptime-kuma - msg_ok "Stopped ${APP}" - cd /opt/uptime-kuma + RELEASE=$(curl -fsSL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}') + if [[ ! -f ~/.uptime-kuma ]] || [[ "${RELEASE}" != "$(cat ~/.uptime-kuma)" ]]; then + msg_info "Stopping ${APP}" + $STD systemctl stop uptime-kuma + msg_ok "Stopped ${APP}" - msg_info "Pulling ${APP} ${LATEST}" - $STD git fetch --all - $STD git checkout $LATEST --force - msg_ok "Pulled ${APP} ${LATEST}" + fetch_and_deploy_gh_release "uptime-kuma" "louislam/uptime-kuma" "tarball" + cd /opt/uptime-kuma - msg_info "Updating ${APP} to ${LATEST}" - $STD npm install --production - $STD npm run download-dist - msg_ok "Updated ${APP}" + msg_info "Updating ${APP} to ${LATEST}" + $STD npm install --omit dev + $STD npm run download-dist + msg_ok "Updated ${APP}" - msg_info "Starting ${APP}" - $STD sudo systemctl start uptime-kuma - msg_ok "Started ${APP}" - msg_ok "Updated Successfully" + msg_info "Starting ${APP}" + $STD sudo systemctl start uptime-kuma + msg_ok "Started ${APP}" + + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi exit } diff --git a/frontend/public/json/uptimekuma.json b/frontend/public/json/uptimekuma.json index 94fc167e2..19d8c4a41 100644 --- a/frontend/public/json/uptimekuma.json +++ b/frontend/public/json/uptimekuma.json @@ -1,35 +1,35 @@ { - "name": "Uptime Kuma", - "slug": "uptimekuma", - "categories": [ - 9 - ], - "date_created": "2024-05-02", - "type": "ct", - "updateable": true, - "privileged": false, - "interface_port": 3001, - "documentation": null, - "website": "https://github.com/louislam/uptime-kuma#uptime-kuma", - "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/uptime-kuma.webp", - "config_path": "", - "description": "Uptime Kuma is a monitoring and alerting system that tracks the availability and performance of servers, websites, and other internet-connected devices. It can be self-hosted and is open-source, offering a visually appealing interface for monitoring and receiving notifications about downtime events.", - "install_methods": [ - { - "type": "default", - "script": "ct/uptimekuma.sh", - "resources": { - "cpu": 1, - "ram": 1024, - "hdd": 4, - "os": "debian", - "version": "12" - } - } - ], - "default_credentials": { - "username": null, - "password": null - }, - "notes": [] + "name": "Uptime Kuma", + "slug": "uptimekuma", + "categories": [ + 9 + ], + "date_created": "2024-05-02", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3001, + "documentation": "https://github.com/louislam/uptime-kuma/wiki", + "website": "https://github.com/louislam/uptime-kuma#uptime-kuma", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/uptime-kuma.webp", + "config_path": "", + "description": "Uptime Kuma is a monitoring and alerting system that tracks the availability and performance of servers, websites, and other internet-connected devices. It can be self-hosted and is open-source, offering a visually appealing interface for monitoring and receiving notifications about downtime events.", + "install_methods": [ + { + "type": "default", + "script": "ct/uptimekuma.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] } diff --git a/install/uptimekuma-install.sh b/install/uptimekuma-install.sh index 8fa7e14c1..c778ae116 100644 --- a/install/uptimekuma-install.sh +++ b/install/uptimekuma-install.sh @@ -13,22 +13,18 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt-get install -y git -$STD apt-get install -y ca-certificates -msg_ok "Installed Dependencies" - NODE_VERSION="22" setup_nodejs +fetch_and_deploy_gh_release "uptime-kuma" "louislam/uptime-kuma" "tarball" msg_info "Installing Uptime Kuma" -$STD git clone https://github.com/louislam/uptime-kuma.git cd /opt/uptime-kuma -$STD npm run setup +$STD npm ci --omit dev +$STD npm run download-dist msg_ok "Installed Uptime Kuma" msg_info "Creating Service" -service_path="/etc/systemd/system/uptime-kuma.service" -echo "[Unit] +cat </etc/systemd/system/uptime-kuma.service +[Unit] Description=uptime-kuma [Service] @@ -39,8 +35,9 @@ WorkingDirectory=/opt/uptime-kuma ExecStart=/usr/bin/npm start [Install] -WantedBy=multi-user.target" >$service_path -$STD systemctl enable --now uptime-kuma +WantedBy=multi-user.target +EOF +systemctl enable -q --now uptime-kuma msg_ok "Created Service" motd_ssh