Refactor (#6902)
This commit is contained in:
parent
65f731d88b
commit
842d73de82
@ -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)
|
|
||||||
|
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}"
|
msg_info "Stopping ${APP}"
|
||||||
$STD sudo systemctl stop uptime-kuma
|
$STD systemctl stop uptime-kuma
|
||||||
msg_ok "Stopped ${APP}"
|
msg_ok "Stopped ${APP}"
|
||||||
|
|
||||||
|
fetch_and_deploy_gh_release "uptime-kuma" "louislam/uptime-kuma" "tarball"
|
||||||
cd /opt/uptime-kuma
|
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}"
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"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": "",
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user