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:
parent
5c202e83c7
commit
f9d3ecec6a
@ -6,7 +6,7 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/
|
||||
# Source: https://github.com/nightscout/cgm-remote-monitor
|
||||
|
||||
APP="Nightscout"
|
||||
var_tags="${var_tags:-arr;health}"
|
||||
var_tags="${var_tags:-health}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-10}"
|
||||
@ -20,31 +20,39 @@ color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/nightscout ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Updating ${APP}"
|
||||
systemctl stop nightscout
|
||||
cd /opt/nightscout
|
||||
git pull
|
||||
npm install
|
||||
systemctl start nightscout
|
||||
msg_ok "Updated ${APP}"
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/nightscout ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "nightscout" "nightscout/cgm-remote-monitor"; then
|
||||
msg_info "Stopping Service"
|
||||
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
|
||||
$STD npm install
|
||||
msg_ok "Updated ${APP}"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start nightscout
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
msg_ok "Completed successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL:${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}"
|
||||
|
||||
@ -36,13 +36,17 @@
|
||||
"text": "Nightscout requires configuring `my.env` with your Mongo connection string and API_SECRET. Default API_SECRET is `yoursecret123`.",
|
||||
"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/)",
|
||||
"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.",
|
||||
"type": "warning"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -13,14 +13,18 @@ network_check
|
||||
update_os
|
||||
|
||||
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"
|
||||
|
||||
MONGO_VERSION="8.0" setup_mongodb
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
msg_info "Installing Nightscout (Patience)"
|
||||
fetch_and_deploy_gh_release "nightscout" "nightscout/cgm-remote-monitor" "source"
|
||||
|
||||
msg_info "Installing Nightscout"
|
||||
$STD npm install --prefix /opt/nightscout
|
||||
msg_ok "Installed Nightscout"
|
||||
|
||||
@ -28,7 +32,7 @@ msg_info "Creating Service"
|
||||
useradd -s /bin/bash -m 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
|
||||
BASE_URL=http://localhost:1337
|
||||
API_SECRET=yoursecret123
|
||||
@ -38,7 +42,7 @@ INSECURE_USE_HTTP=true
|
||||
EOF
|
||||
chown nightscout:nightscout /opt/nightscout/my.env
|
||||
|
||||
cat > /etc/systemd/system/nightscout.service <<EOF
|
||||
cat <<EOF >/etc/systemd/system/nightscout.service
|
||||
[Unit]
|
||||
Description=Nightscout CGM Service
|
||||
After=network.target mongodb.service
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user