Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ct/netvisor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
# Copyright (c) 2021-2025 community-scripts ORG
# Author: vhsdream
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/maynayza/netvisor
# Source: https://github.com/mayanayza/netvisor

APP="NetVisor"
var_tags="${var_tags:-analytics}"
Expand Down Expand Up @@ -99,3 +99,4 @@ 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}:60072${CL}"
echo -e "${INFO}${YW} Then create your account, and run the 'configure_daemon.sh' script to setup the daemon.${CL}"
4 changes: 2 additions & 2 deletions frontend/public/json/netvisor.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
},
"notes": [
{
"text": "The integrated daemon config is located at `/root/.config/daemon/config.json`",
"text": "To configure the integrated daemon after install is complete, either use the `Create Daemon` menu in the UI, or run `/root/configure_daemon.sh` for automatic configuration",
"type": "info"
},
{
"text": "When using a reverse proxy, edit `/opt/netvisor/ui/build/_app/env.js`: add 443 to `PUBLIC_SERVER_PORT` and remove 'default' from `PUBLIC_SERVER_HOSTNAME`.",
"text": "The integrated daemon config is located at `/root/.config/daemon/config.json`",
"type": "info"
}
]
Expand Down
32 changes: 22 additions & 10 deletions install/netvisor-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $STD cargo build --release --bin daemon
cp ./target/release/daemon /usr/bin/netvisor-daemon
msg_ok "Built Netvisor-daemon"

msg_info "Configuring server & daemon for first-run"
msg_info "Configuring server for first-run"
LOCAL_IP="$(hostname -I | awk '{print $1}')"
cat <<EOF >/opt/netvisor/.env
### - SERVER
Expand Down Expand Up @@ -101,29 +101,41 @@ WantedBy=multi-user.target
EOF

systemctl enable -q --now netvisor-server
sleep 5
NETWORK_ID="$(sudo -u postgres psql -1 -t -d $PG_DB_NAME -c 'SELECT id FROM networks;')"
API_KEY="$(sudo -u postgres psql -1 -t -d $PG_DB_NAME -c 'SELECT key from api_keys;')"

cat <<EOF >/etc/systemd/system/netvisor-daemon.service
# Creating short script to configure netvisor-daemon
cat <<EOF >~/configure_daemon.sh
#!/usr/bin/env bash

echo "Auto-configuring integrated daemon..."

NETWORK_ID="\$(sudo -u postgres psql -1 -t -d "${PG_DB_NAME}" -c 'SELECT id FROM networks;')"
API_KEY="\$(sudo -u postgres psql -1 -t -d "${PG_DB_NAME}" -c 'SELECT key FROM api_keys;')"

cat <<END >/etc/systemd/system/netvisor-daemon.service
[Unit]
Description=NetVisor Network Discovery Daemon
After=network.target netvisor-server.service
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
EnvironmentFile=/opt/netvisor/.env
ExecStart=/usr/bin/netvisor-daemon --server-url http://127.0.0.1:60072 --network-id ${NETWORK_ID} --daemon-api-key ${API_KEY}
User=root
ExecStart=/usr/bin/netvisor-daemon --server-url http://127.0.0.1:60072 --network-id \${NETWORK_ID} --daemon-api-key \${API_KEY} --mode push
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
EOF
END

systemctl enable -q --now netvisor-daemon
msg_ok "Netvisor server & daemon configured and running"
echo "NetVisor daemon configured and running"

EOF
chmod +x ~/configure_daemon.sh
msg_ok "Netvisor server running - please create an account in the UI to continue."

motd_ssh
customize
Expand Down