|
| 1 | +#!/usr/bin/env bash |
| 2 | +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) |
| 3 | +# Copyright (c) 2021-2025 community-scripts ORG |
| 4 | +# Author: vhsdream |
| 5 | +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE |
| 6 | +# Source: https://github.com/PatchMon/PatchMon |
| 7 | + |
| 8 | +APP="PatchMon" |
| 9 | +var_tags="${var_tags:-monitoring}" |
| 10 | +var_cpu="${var_cpu:-2}" |
| 11 | +var_ram="${var_ram:-2048}" |
| 12 | +var_disk="${var_disk:-4}" |
| 13 | +var_os="${var_os:-debian}" |
| 14 | +var_version="${var_version:-13}" |
| 15 | +var_unprivileged="${var_unprivileged:-1}" |
| 16 | + |
| 17 | +header_info "$APP" |
| 18 | +variables |
| 19 | +color |
| 20 | +catch_errors |
| 21 | + |
| 22 | +function update_script() { |
| 23 | + header_info |
| 24 | + check_container_storage |
| 25 | + check_container_resources |
| 26 | + |
| 27 | + if [[ ! -d "/opt/patchmon" ]]; then |
| 28 | + msg_error "No ${APP} Installation Found!" |
| 29 | + exit |
| 30 | + fi |
| 31 | + |
| 32 | + NODE_VERSION="24" setup_nodejs |
| 33 | + if check_for_gh_release "PatchMon" "PatchMon/PatchMon"; then |
| 34 | + msg_info "Stopping Service" |
| 35 | + systemctl stop patchmon-server |
| 36 | + msg_ok "Stopped Service" |
| 37 | + |
| 38 | + msg_info "Creating Backup" |
| 39 | + cp /opt/patchmon/backend/.env /opt/backend.env |
| 40 | + cp /opt/patchmon/frontend/.env /opt/frontend.env |
| 41 | + msg_ok "Backup Created" |
| 42 | + |
| 43 | + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "PatchMon" "PatchMon/PatchMon" "tarball" "latest" "/opt/patchmon" |
| 44 | + |
| 45 | + msg_info "Updating PatchMon" |
| 46 | + cd /opt/patchmon |
| 47 | + export NODE_ENV=production |
| 48 | + $STD npm install --no-audit --no-fund --no-save --ignore-scripts |
| 49 | + cd /opt/patchmon/backend |
| 50 | + $STD npm install --no-audit --no-fund --no-save --ignore-scripts |
| 51 | + cd /opt/patchmon/frontend |
| 52 | + $STD npm install --include=dev --no-audit --no-fund --no-save --ignore-scripts |
| 53 | + $STD npm run build |
| 54 | + cd /opt/patchmon/backend |
| 55 | + mv /opt/backend.env /opt/patchmon/backend/.env |
| 56 | + mv /opt/frontend.env /opt/patchmon/frontend/.env |
| 57 | + $STD npx prisma migrate deploy |
| 58 | + $STD npx prisma generate |
| 59 | + msg_ok "Updated PatchMon" |
| 60 | + |
| 61 | + msg_info "Starting Service" |
| 62 | + systemctl start patchmon-server |
| 63 | + msg_ok "Started Service" |
| 64 | + msg_ok "Updated Successfully!" |
| 65 | + fi |
| 66 | + exit |
| 67 | +} |
| 68 | + |
| 69 | +start |
| 70 | +build_container |
| 71 | +description |
| 72 | + |
| 73 | +msg_ok "Completed Successfully!\n" |
| 74 | +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" |
| 75 | +echo -e "${INFO}${YW} Access it using the following URL:${CL}" |
| 76 | +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" |
0 commit comments