mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 02:12:49 +00:00 
			
		
		
		
	Refactor (#6902)
This commit is contained in:
		@@ -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)
 | 
			
		||||
 | 
			
		||||
  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 sudo systemctl stop uptime-kuma
 | 
			
		||||
    $STD systemctl stop uptime-kuma
 | 
			
		||||
    msg_ok "Stopped ${APP}"
 | 
			
		||||
 | 
			
		||||
    fetch_and_deploy_gh_release "uptime-kuma" "louislam/uptime-kuma" "tarball"
 | 
			
		||||
    cd /opt/uptime-kuma
 | 
			
		||||
 | 
			
		||||
  msg_info "Pulling ${APP} ${LATEST}"
 | 
			
		||||
  $STD git fetch --all
 | 
			
		||||
  $STD git checkout $LATEST --force
 | 
			
		||||
  msg_ok "Pulled ${APP} ${LATEST}"
 | 
			
		||||
 | 
			
		||||
    msg_info "Updating ${APP} to ${LATEST}"
 | 
			
		||||
  $STD npm install --production
 | 
			
		||||
    $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"
 | 
			
		||||
  else
 | 
			
		||||
    msg_ok "No update required. ${APP} is already at ${RELEASE}"
 | 
			
		||||
  fi
 | 
			
		||||
  exit
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
  "updateable": true,
 | 
			
		||||
  "privileged": false,
 | 
			
		||||
  "interface_port": 3001,
 | 
			
		||||
    "documentation": null,
 | 
			
		||||
  "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": "",
 | 
			
		||||
 
 | 
			
		||||
@@ -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 <<EOF >/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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user