Skip to content

Commit e3164f6

Browse files
authored
NetVisor: v0.10.0 fixes (#9255)
1 parent 783db66 commit e3164f6

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

ct/netvisor.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function update_script() {
3535
msg_ok "Stopped services"
3636

3737
msg_info "Backing up configurations"
38-
cp /opt/netvisor/.env /opt/netvisor.env
38+
cp /opt/netvisor/.env /opt/netvisor.env.bak
3939
msg_ok "Backed up configurations"
4040

4141
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "netvisor" "mayanayza/netvisor" "tarball" "latest" "/opt/netvisor"
@@ -49,10 +49,16 @@ function update_script() {
4949
TOOLCHAIN="$(grep "channel" /opt/netvisor/backend/rust-toolchain.toml | awk -F\" '{print $2}')"
5050
RUST_TOOLCHAIN=$TOOLCHAIN setup_rust
5151

52-
mv /opt/netvisor.env /opt/netvisor/.env
52+
cp /opt/netvisor.env.bak /opt/netvisor/.env
53+
LOCAL_IP="$(hostname -I | awk '{print $1}')"
54+
if ! grep -q "PUBLIC_URL"; then
55+
sed -i "\|_PATH=|a\NETVISOR_SERVER_PUBLIC_URL=http://${LOCAL_IP}:60072" /opt/netvisor/.env
56+
fi
57+
sed -i 's|_TARGET=.*$|_URL=http://127.0.0.1:60072|' /opt/netvisor/.env
58+
5359
msg_info "Creating frontend UI"
5460
export PUBLIC_SERVER_HOSTNAME=default
55-
export PUBLIC_SERVER_PORT=60072
61+
export PUBLIC_SERVER_PORT=""
5662
cd /opt/netvisor/ui
5763
$STD npm ci --no-fund --no-audit
5864
$STD npm run build
@@ -64,10 +70,16 @@ function update_script() {
6470
mv ./target/release/server /usr/bin/netvisor-server
6571
msg_ok "Built Netvisor-server"
6672

67-
msg_info "Building Netvisor-daemon (amd64 version)"
73+
msg_info "Building Netvisor-daemon"
6874
$STD cargo build --release --bin daemon
6975
cp ./target/release/daemon /usr/bin/netvisor-daemon
70-
msg_ok "Built Netvisor-daemon (amd64 version)"
76+
msg_ok "Built Netvisor-daemon"
77+
78+
sed -i -e 's|-target|-url|' \
79+
-e 's| --server-port |:|' \
80+
/etc/systemd/system/netvisor-daemon.service
81+
sed -i '/^ \"server_target.*$/d' /root/.config/daemon/config.json
82+
systemctl daemon-reload
7183

7284
msg_info "Starting services"
7385
systemctl start netvisor-server netvisor-daemon

frontend/public/json/netvisor.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
{
3636
"text": "The integrated daemon config is located at `/root/.config/daemon/config.json`",
3737
"type": "info"
38+
},
39+
{
40+
"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`.",
41+
"type": "info"
3842
}
3943
]
4044
}

install/netvisor-install.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ RUST_TOOLCHAIN=$TOOLCHAIN setup_rust
3131

3232
msg_info "Creating frontend UI"
3333
export PUBLIC_SERVER_HOSTNAME=default
34-
export PUBLIC_SERVER_PORT=60072
34+
export PUBLIC_SERVER_PORT=""
3535
cd /opt/netvisor/ui
3636
$STD npm ci --no-fund --no-audit
3737
$STD npm run build
@@ -49,20 +49,18 @@ cp ./target/release/daemon /usr/bin/netvisor-daemon
4949
msg_ok "Built Netvisor-daemon"
5050

5151
msg_info "Configuring server & daemon for first-run"
52+
LOCAL_IP="$(hostname -I | awk '{print $1}')"
5253
cat <<EOF >/opt/netvisor/.env
53-
### - UI
54-
PUBLIC_SERVER_HOSTNAME=default
55-
PUBLIC_SERVER_PORT=60072
56-
5754
### - SERVER
5855
NETVISOR_DATABASE_URL=postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME
5956
NETVISOR_WEB_EXTERNAL_PATH="/opt/netvisor/ui/build"
57+
NETVISOR_SERVER_PUBLIC_URL=http://${LOCAL_IP}:60072
6058
NETVISOR_SERVER_PORT=60072
6159
NETVISOR_LOG_LEVEL=info
6260
NETVISOR_INTEGRATED_DAEMON_URL=http://127.0.0.1:60073
6361
## - uncomment to disable signups
6462
# NETVISOR_DISABLE_REGISTRATION=true
65-
## - uncomment when behind reverse proxy
63+
## - uncomment when using TLS
6664
# NETVISOR_USE_SECURE_SESSION_COOKIES=true
6765
6866
### - OIDC (optional)
@@ -74,8 +72,14 @@ NETVISOR_INTEGRATED_DAEMON_URL=http://127.0.0.1:60073
7472
## - Callback URL for reference
7573
# http://your-netvisor-domain:60072/api/auth/oidc/callback
7674
75+
### - SMTP (password reset and notifications - optional)
76+
# NETVISOR_SMTP_RELAY=smtp.gmail.com:587
77+
78+
# NETVISOR_SMTP_PASSWORD=your-app-password
79+
80+
7781
### - INTEGRATED DAEMON
78-
NETVISOR_SERVER_TARGET=127.0.0.1
82+
NETVISOR_SERVER_URL=http://127.0.0.1:60072
7983
NETVISOR_BIND_ADDRESS=0.0.0.0
8084
NETVISOR_NAME="netvisor-daemon"
8185
NETVISOR_HEARTBEAT_INTERVAL=30
@@ -112,7 +116,7 @@ After=network.target netvisor-server.service
112116
[Service]
113117
Type=simple
114118
EnvironmentFile=/opt/netvisor/.env
115-
ExecStart=/usr/bin/netvisor-daemon --server-target http://127.0.0.1 --server-port 60072 --network-id ${NETWORK_ID} --daemon-api-key ${API_KEY}
119+
ExecStart=/usr/bin/netvisor-daemon --server-url http://127.0.0.1:60072 --network-id ${NETWORK_ID} --daemon-api-key ${API_KEY}
116120
Restart=always
117121
RestartSec=10
118122
StandardOutput=journal

0 commit comments

Comments
 (0)