feat: Refactor Nightscout update logic to use fetch_and_deploy_gh_release, streamline dependency installation, and update post-install messages and CT tags.

This commit is contained in:
Francesco Vattiato 2026-01-18 14:43:15 +01:00
parent 5c202e83c7
commit f9d3ecec6a
3 changed files with 41 additions and 25 deletions

View File

@ -6,7 +6,7 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/
# Source: https://github.com/nightscout/cgm-remote-monitor # Source: https://github.com/nightscout/cgm-remote-monitor
APP="Nightscout" APP="Nightscout"
var_tags="${var_tags:-arr;health}" var_tags="${var_tags:-health}"
var_cpu="${var_cpu:-2}" var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}" var_ram="${var_ram:-2048}"
var_disk="${var_disk:-10}" var_disk="${var_disk:-10}"
@ -27,13 +27,24 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
msg_info "Updating ${APP}"
if check_for_gh_release "nightscout" "nightscout/cgm-remote-monitor"; then
msg_info "Stopping Service"
systemctl stop nightscout systemctl stop nightscout
msg_ok "Stopped Service"
fetch_and_deploy_gh_release "nightscout" "nightscout/cgm-remote-monitor" "source"
msg_info "Updating ${APP}"
cd /opt/nightscout cd /opt/nightscout
git pull $STD npm install
npm install
systemctl start nightscout
msg_ok "Updated ${APP}" msg_ok "Updated ${APP}"
msg_info "Starting Service"
systemctl start nightscout
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit exit
} }
@ -41,10 +52,7 @@ start
build_container build_container
description description
msg_ok "Completed Successfully!\n" msg_ok "Completed successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:1337${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:1337${CL}"
echo -e "${INFO}${YW} Configuration:${CL}"
echo -e "${TAB} Edit /opt/nightscout/my.env to configure your CGM source (Dexcom/CareLink)"
echo -e "${TAB} Then run: ${BGN}systemctl restart nightscout${CL}"

View File

@ -36,9 +36,13 @@
"text": "Nightscout requires configuring `my.env` with your Mongo connection string and API_SECRET. Default API_SECRET is `yoursecret123`.", "text": "Nightscout requires configuring `my.env` with your Mongo connection string and API_SECRET. Default API_SECRET is `yoursecret123`.",
"type": "info" "type": "info"
}, },
{
"text": "Edit `/opt/nightscout/my.env` to configure your CGM source (Dexcom/CareLink). Then run: `systemctl restart nightscout`",
"type": "info"
},
{ {
"text": "Official Configuration Guide: [Nightscout Documentation](https://nightscout.github.io/nightscout/setup_variables/)", "text": "Official Configuration Guide: [Nightscout Documentation](https://nightscout.github.io/nightscout/setup_variables/)",
"type": "link" "type": "info"
}, },
{ {
"text": "Nightscout requires HTTPS for many features (security, tokens, PWA). Usage of a reverse proxy (e.g. Nginx Proxy Manager) is highly recommended.", "text": "Nightscout requires HTTPS for many features (security, tokens, PWA). Usage of a reverse proxy (e.g. Nginx Proxy Manager) is highly recommended.",

View File

@ -13,14 +13,18 @@ network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt install -y git build-essential libssl-dev $STD apt install -y \
git \
build-essential \
libssl-dev
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
MONGO_VERSION="8.0" setup_mongodb MONGO_VERSION="8.0" setup_mongodb
NODE_VERSION="22" setup_nodejs NODE_VERSION="22" setup_nodejs
msg_info "Installing Nightscout (Patience)"
fetch_and_deploy_gh_release "nightscout" "nightscout/cgm-remote-monitor" "source" fetch_and_deploy_gh_release "nightscout" "nightscout/cgm-remote-monitor" "source"
msg_info "Installing Nightscout"
$STD npm install --prefix /opt/nightscout $STD npm install --prefix /opt/nightscout
msg_ok "Installed Nightscout" msg_ok "Installed Nightscout"
@ -28,7 +32,7 @@ msg_info "Creating Service"
useradd -s /bin/bash -m nightscout useradd -s /bin/bash -m nightscout
chown -R nightscout:nightscout /opt/nightscout chown -R nightscout:nightscout /opt/nightscout
cat > /opt/nightscout/my.env <<EOF cat <<EOF >/opt/nightscout/my.env
MONGO_CONNECTION=mongodb://127.0.0.1:27017/nightscout MONGO_CONNECTION=mongodb://127.0.0.1:27017/nightscout
BASE_URL=http://localhost:1337 BASE_URL=http://localhost:1337
API_SECRET=yoursecret123 API_SECRET=yoursecret123
@ -38,7 +42,7 @@ INSECURE_USE_HTTP=true
EOF EOF
chown nightscout:nightscout /opt/nightscout/my.env chown nightscout:nightscout /opt/nightscout/my.env
cat > /etc/systemd/system/nightscout.service <<EOF cat <<EOF >/etc/systemd/system/nightscout.service
[Unit] [Unit]
Description=Nightscout CGM Service Description=Nightscout CGM Service
After=network.target mongodb.service After=network.target mongodb.service