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..."
 | 
					      echo "Installed NPM..."
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
  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}"
 | 
					    fetch_and_deploy_gh_release "uptime-kuma" "louislam/uptime-kuma" "tarball"
 | 
				
			||||||
  $STD git fetch --all
 | 
					    cd /opt/uptime-kuma
 | 
				
			||||||
  $STD git checkout $LATEST --force
 | 
					 | 
				
			||||||
  msg_ok "Pulled ${APP} ${LATEST}"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  msg_info "Updating ${APP} to ${LATEST}"
 | 
					    msg_info "Updating ${APP} to ${LATEST}"
 | 
				
			||||||
  $STD npm install --production
 | 
					    $STD npm install --omit dev
 | 
				
			||||||
  $STD npm run download-dist
 | 
					    $STD npm run download-dist
 | 
				
			||||||
  msg_ok "Updated ${APP}"
 | 
					    msg_ok "Updated ${APP}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  msg_info "Starting ${APP}"
 | 
					    msg_info "Starting ${APP}"
 | 
				
			||||||
  $STD sudo systemctl start uptime-kuma
 | 
					    $STD sudo systemctl start uptime-kuma
 | 
				
			||||||
  msg_ok "Started ${APP}"
 | 
					    msg_ok "Started ${APP}"
 | 
				
			||||||
  msg_ok "Updated Successfully"
 | 
					
 | 
				
			||||||
 | 
					    msg_ok "Updated Successfully"
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    msg_ok "No update required. ${APP} is already at ${RELEASE}"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
  exit
 | 
					  exit
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,35 +1,35 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    "name": "Uptime Kuma",
 | 
					  "name": "Uptime Kuma",
 | 
				
			||||||
    "slug": "uptimekuma",
 | 
					  "slug": "uptimekuma",
 | 
				
			||||||
    "categories": [
 | 
					  "categories": [
 | 
				
			||||||
        9
 | 
					    9
 | 
				
			||||||
    ],
 | 
					  ],
 | 
				
			||||||
    "date_created": "2024-05-02",
 | 
					  "date_created": "2024-05-02",
 | 
				
			||||||
    "type": "ct",
 | 
					  "type": "ct",
 | 
				
			||||||
    "updateable": true,
 | 
					  "updateable": true,
 | 
				
			||||||
    "privileged": false,
 | 
					  "privileged": false,
 | 
				
			||||||
    "interface_port": 3001,
 | 
					  "interface_port": 3001,
 | 
				
			||||||
    "documentation": null,
 | 
					  "documentation": "https://github.com/louislam/uptime-kuma/wiki",
 | 
				
			||||||
    "website": "https://github.com/louislam/uptime-kuma#uptime-kuma",
 | 
					  "website": "https://github.com/louislam/uptime-kuma#uptime-kuma",
 | 
				
			||||||
    "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/uptime-kuma.webp",
 | 
					  "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/uptime-kuma.webp",
 | 
				
			||||||
    "config_path": "",
 | 
					  "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.",
 | 
					  "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": [
 | 
					  "install_methods": [
 | 
				
			||||||
        {
 | 
					    {
 | 
				
			||||||
            "type": "default",
 | 
					      "type": "default",
 | 
				
			||||||
            "script": "ct/uptimekuma.sh",
 | 
					      "script": "ct/uptimekuma.sh",
 | 
				
			||||||
            "resources": {
 | 
					      "resources": {
 | 
				
			||||||
                "cpu": 1,
 | 
					        "cpu": 1,
 | 
				
			||||||
                "ram": 1024,
 | 
					        "ram": 1024,
 | 
				
			||||||
                "hdd": 4,
 | 
					        "hdd": 4,
 | 
				
			||||||
                "os": "debian",
 | 
					        "os": "debian",
 | 
				
			||||||
                "version": "12"
 | 
					        "version": "12"
 | 
				
			||||||
            }
 | 
					      }
 | 
				
			||||||
        }
 | 
					    }
 | 
				
			||||||
    ],
 | 
					  ],
 | 
				
			||||||
    "default_credentials": {
 | 
					  "default_credentials": {
 | 
				
			||||||
        "username": null,
 | 
					    "username": null,
 | 
				
			||||||
        "password": null
 | 
					    "password": null
 | 
				
			||||||
    },
 | 
					  },
 | 
				
			||||||
    "notes": []
 | 
					  "notes": []
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,22 +13,18 @@ setting_up_container
 | 
				
			|||||||
network_check
 | 
					network_check
 | 
				
			||||||
update_os
 | 
					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
 | 
					NODE_VERSION="22" setup_nodejs
 | 
				
			||||||
 | 
					fetch_and_deploy_gh_release "uptime-kuma" "louislam/uptime-kuma" "tarball"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Installing Uptime Kuma"
 | 
					msg_info "Installing Uptime Kuma"
 | 
				
			||||||
$STD git clone https://github.com/louislam/uptime-kuma.git
 | 
					 | 
				
			||||||
cd /opt/uptime-kuma
 | 
					cd /opt/uptime-kuma
 | 
				
			||||||
$STD npm run setup
 | 
					$STD npm ci --omit dev
 | 
				
			||||||
 | 
					$STD npm run download-dist
 | 
				
			||||||
msg_ok "Installed Uptime Kuma"
 | 
					msg_ok "Installed Uptime Kuma"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Creating Service"
 | 
					msg_info "Creating Service"
 | 
				
			||||||
service_path="/etc/systemd/system/uptime-kuma.service"
 | 
					cat <<EOF >/etc/systemd/system/uptime-kuma.service
 | 
				
			||||||
echo "[Unit]
 | 
					[Unit]
 | 
				
			||||||
Description=uptime-kuma
 | 
					Description=uptime-kuma
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Service]
 | 
					[Service]
 | 
				
			||||||
@@ -39,8 +35,9 @@ WorkingDirectory=/opt/uptime-kuma
 | 
				
			|||||||
ExecStart=/usr/bin/npm start
 | 
					ExecStart=/usr/bin/npm start
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Install]
 | 
					[Install]
 | 
				
			||||||
WantedBy=multi-user.target" >$service_path
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
$STD systemctl enable --now uptime-kuma
 | 
					EOF
 | 
				
			||||||
 | 
					systemctl enable -q --now uptime-kuma
 | 
				
			||||||
msg_ok "Created Service"
 | 
					msg_ok "Created Service"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
motd_ssh
 | 
					motd_ssh
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user