diff --git a/ct/meshmonitor.sh b/ct/meshmonitor.sh new file mode 100644 index 0000000000..073fd80a3d --- /dev/null +++ b/ct/meshmonitor.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: clartek +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://meshmonitor.org/ + +APP="MeshMonitor" +var_tags="${var_tags:-meshtastic;meshcore;monitoring}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-10}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +#var_arm64="${var_arm64:-no}" # Native dependencies have not been tested on arm64. +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/meshmonitor ]]; then + msg_error "No MeshMonitor Installation Found!" + exit 1 + fi + + if check_for_gh_release "meshmonitor" "Yeraze/meshmonitor"; then + msg_info "Stopping MeshMonitor" + systemctl stop meshmonitor meshmonitor-apprise + msg_ok "Stopped MeshMonitor" + + create_backup /data /etc/meshmonitor + + NODE_VERSION="24" setup_nodejs + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "meshmonitor" "Yeraze/meshmonitor" "tarball" + restore_backup + + # GitHub source archives omit submodules; use the commits pinned by this release. + github_api_call "https://api.github.com/repos/Yeraze/meshmonitor/git/trees/v$(cat ~/.meshmonitor)" /tmp/meshmonitor-tree.json + protobuf_commit=$(jq -er '.tree[] | select(.path == "protobufs" and .type == "commit") | .sha' /tmp/meshmonitor-tree.json) + takpacket_commit=$(jq -er '.tree[] | select(.path == "takpacket-sdk" and .type == "commit") | .sha' /tmp/meshmonitor-tree.json) + fetch_and_deploy_from_url "https://github.com/meshtastic/protobufs/archive/${protobuf_commit}.tar.gz" /opt/meshmonitor/protobufs + fetch_and_deploy_from_url "https://github.com/meshtastic/TAKPacket-SDK/archive/${takpacket_commit}.tar.gz" /opt/meshmonitor/takpacket-sdk + rm -f /tmp/meshmonitor-tree.json + + msg_info "Building MeshMonitor" + cd /opt/meshmonitor || exit 1 + PUPPETEER_SKIP_DOWNLOAD=true $STD npm install --legacy-peer-deps + $STD npm run build + $STD npm run build:server + $STD npm prune --omit=dev --legacy-peer-deps + msg_ok "Built MeshMonitor" + + msg_info "Updating MeshMonitor Python Dependencies" + $STD uv pip install --upgrade --python /opt/meshmonitor-venv/bin/python apprise requests "paho-mqtt<2.0" meshtastic meshcore-cli + msg_ok "Updated MeshMonitor Python Dependencies" + + msg_info "Starting MeshMonitor" + systemctl start meshmonitor-apprise meshmonitor + msg_ok "Started MeshMonitor" + msg_ok "Updated MeshMonitor successfully!" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}MeshMonitor setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}Access it using the following URL:${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:3001${CL}" +echo -e "${INFO}${YW}Log in as admin with password changeme, change the password, then add your node in the web UI.${CL}" diff --git a/install/meshmonitor-install.sh b/install/meshmonitor-install.sh new file mode 100644 index 0000000000..5b0002f748 --- /dev/null +++ b/install/meshmonitor-install.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: clartek +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://meshmonitor.org/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing MeshMonitor Dependencies" +$STD apt install -y \ + build-essential \ + git \ + python3-dev \ + libsqlite3-dev \ + unzip +msg_ok "Installed MeshMonitor Dependencies" + +NODE_VERSION="24" setup_nodejs +setup_uv + +fetch_and_deploy_gh_release "meshmonitor" "Yeraze/meshmonitor" "tarball" + +# GitHub source archives omit submodules; use the commits pinned by this release. +github_api_call "https://api.github.com/repos/Yeraze/meshmonitor/git/trees/v$(cat ~/.meshmonitor)" /tmp/meshmonitor-tree.json +protobuf_commit=$(jq -er '.tree[] | select(.path == "protobufs" and .type == "commit") | .sha' /tmp/meshmonitor-tree.json) +takpacket_commit=$(jq -er '.tree[] | select(.path == "takpacket-sdk" and .type == "commit") | .sha' /tmp/meshmonitor-tree.json) +fetch_and_deploy_from_url "https://github.com/meshtastic/protobufs/archive/${protobuf_commit}.tar.gz" /opt/meshmonitor/protobufs +fetch_and_deploy_from_url "https://github.com/meshtastic/TAKPacket-SDK/archive/${takpacket_commit}.tar.gz" /opt/meshmonitor/takpacket-sdk +rm -f /tmp/meshmonitor-tree.json + +msg_info "Building MeshMonitor" +cd /opt/meshmonitor || exit 1 +# The lockfile uses SSH for a public dependency; installation must not require SSH keys. +$STD git config --global url."https://github.com/".insteadOf "ssh://git@github.com/" +PUPPETEER_SKIP_DOWNLOAD=true $STD npm install --legacy-peer-deps +$STD npm run build +$STD npm run build:server +$STD npm prune --omit=dev --legacy-peer-deps +msg_ok "Built MeshMonitor" + +msg_info "Installing MeshMonitor Python Dependencies" +$STD uv venv --seed /opt/meshmonitor-venv +$STD uv pip install --python /opt/meshmonitor-venv/bin/python apprise requests "paho-mqtt<2.0" meshtastic meshcore-cli +msg_ok "Installed MeshMonitor Python Dependencies" + +msg_info "Configuring MeshMonitor" +mkdir -p /etc/meshmonitor /data/{apprise-config,scripts,logs} +cat </etc/meshmonitor/meshmonitor.env +NODE_ENV=production +PORT=3001 +DATABASE_PATH=/data/meshmonitor.db +SESSION_SECRET=$(random_password 64) +COOKIE_SECURE=false +ALLOWED_ORIGINS=http://${LOCAL_IP}:3001 +APPRISE_URL=http://127.0.0.1:8000 +APPRISE_HOST=127.0.0.1 +APPRISE_CONFIG_DIR=/data/apprise-config +APPRISE_STATEFUL_MODE=simple +EOF +chmod 600 /etc/meshmonitor/meshmonitor.env +msg_ok "Configured MeshMonitor" + +msg_info "Creating MeshMonitor Services" +cat </etc/systemd/system/meshmonitor-apprise.service +[Unit] +Description=MeshMonitor Apprise Notification Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/meshmonitor +EnvironmentFile=/etc/meshmonitor/meshmonitor.env +ExecStart=/opt/meshmonitor-venv/bin/python /opt/meshmonitor/docker/apprise-api.py +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +cat </etc/systemd/system/meshmonitor.service +[Unit] +Description=MeshMonitor +After=network.target meshmonitor-apprise.service +Wants=meshmonitor-apprise.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/meshmonitor +EnvironmentFile=/etc/meshmonitor/meshmonitor.env +Environment=PATH=/opt/meshmonitor-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ExecStart=/usr/bin/node /opt/meshmonitor/dist/server/server.js +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now meshmonitor-apprise meshmonitor +msg_ok "Created MeshMonitor Services" + +motd_ssh +customize +cleanup_lxc diff --git a/json/meshmonitor.json b/json/meshmonitor.json new file mode 100644 index 0000000000..bc97da7c74 --- /dev/null +++ b/json/meshmonitor.json @@ -0,0 +1,47 @@ +{ + "name": "MeshMonitor", + "slug": "meshmonitor", + "categories": [9, 18], + "date_created": "2026-10-20", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3001, + "documentation": "https://meshmonitor.org/deployment/PROXMOX_LXC_GUIDE.html", + "website": "https://meshmonitor.org/", + "repository": "https://github.com/Yeraze/meshmonitor", + "logo": "https://raw.githubusercontent.com/Yeraze/meshmonitor/main/public/logo.png", + "description": "MeshMonitor is a web application for monitoring and managing Meshtastic and MeshCore networks. It provides maps, messaging, telemetry, and notifications for connected mesh nodes.", + "install_methods": [ + { + "type": "default", + "script": "ct/meshmonitor.sh", + "config_path": "/etc/meshmonitor/meshmonitor.env", + "resources": { + "cpu": 2, + "ram": 4096, + "hdd": 10, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": "admin", + "password": "changeme" + }, + "notes": [ + { + "text": "Change the default admin password immediately after the first login.", + "type": "warning" + }, + { + "text": "Add your Meshtastic or MeshCore node through the web UI. The container must be able to reach your node over the network.", + "type": "info" + }, + { + "text": "When using a reverse proxy or a different access URL, update ALLOWED_ORIGINS in /etc/meshmonitor/meshmonitor.env and restart MeshMonitor.", + "type": "info" + } + ] +}