Scanopy: remove integrated daemon script (#11100)

This commit is contained in:
Chris
2026-01-23 15:21:19 -05:00
committed by GitHub
parent fe88545ce9
commit 4ea4422042
3 changed files with 44 additions and 46 deletions

View File

@@ -31,14 +31,13 @@ function update_script() {
if check_for_gh_release "scanopy" "scanopy/scanopy"; then if check_for_gh_release "scanopy" "scanopy/scanopy"; then
msg_info "Stopping services" msg_info "Stopping services"
systemctl stop scanopy-daemon scanopy-server systemctl stop scanopy-server
[[ -f /etc/systemd/system/scanopy-daemon.service ]] && systemctl stop scanopy-daemon
msg_ok "Stopped services" msg_ok "Stopped services"
msg_info "Backing up configurations" msg_info "Backing up configurations"
cp /opt/scanopy/.env /opt/scanopy.env.bak cp /opt/scanopy/.env /opt/scanopy.env
if [[ -f /opt/scanopy/oidc.toml ]]; then [[ -f /opt/scanopy/oidc.toml ]] && cp /opt/scanopy/oidc.toml /opt/scanopy.oidc.toml
cp /opt/scanopy/oidc.toml /opt/scanopy.oidc.toml
fi
msg_ok "Backed up configurations" msg_ok "Backed up configurations"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "scanopy" "scanopy/scanopy" "tarball" "latest" "/opt/scanopy" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "scanopy" "scanopy/scanopy" "tarball" "latest" "/opt/scanopy"
@@ -52,12 +51,10 @@ function update_script() {
TOOLCHAIN="$(grep "channel" /opt/scanopy/backend/rust-toolchain.toml | awk -F\" '{print $2}')" TOOLCHAIN="$(grep "channel" /opt/scanopy/backend/rust-toolchain.toml | awk -F\" '{print $2}')"
RUST_TOOLCHAIN=$TOOLCHAIN setup_rust RUST_TOOLCHAIN=$TOOLCHAIN setup_rust
mv /opt/scanopy.env.bak /opt/scanopy/.env [[ -f /opt/scanopy.env ]] && mv /opt/scanopy.env /opt/scanopy/.env
if [[ -f /opt/scanopy.oidc.toml ]]; then [[ -f /opt/scanopy.oidc.toml ]] && mv /opt/scanopy.oidc.toml /opt/scanopy/oidc.toml
mv /opt/scanopy.oidc.toml /opt/scanopy/oidc.toml
fi
if ! grep -q "PUBLIC_URL" /opt/scanopy/.env; then if ! grep -q "PUBLIC_URL" /opt/scanopy/.env; then
sed -i "\|_PATH=|a\scanopy_PUBLIC_URL=http://${LOCAL_IP}:60072" /opt/scanopy/.env sed -i "\|_PATH=|a\\scanopy_PUBLIC_URL=http://${LOCAL_IP}:60072" /opt/scanopy/.env
fi fi
sed -i 's|_TARGET=.*$|_URL=http://127.0.0.1:60072|' /opt/scanopy/.env sed -i 's|_TARGET=.*$|_URL=http://127.0.0.1:60072|' /opt/scanopy/.env
@@ -81,7 +78,8 @@ function update_script() {
msg_ok "Built scanopy-daemon" msg_ok "Built scanopy-daemon"
msg_info "Starting services" msg_info "Starting services"
systemctl start scanopy-server scanopy-daemon systemctl start scanopy-server
[[ -f /etc/systemd/system/scanopy-daemon.service ]] && systemctl start scanopy-daemon
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
fi fi
exit exit
@@ -95,4 +93,4 @@ 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}:60072${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}" echo -e "${INFO}${YW} Then create your account, and create a daemon in the UI.${CL}"

View File

@@ -33,7 +33,7 @@
}, },
"notes": [ "notes": [
{ {
"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", "text": "To configure the integrated daemon after install is complete, use the `Create Daemon` menu in the UI and follow the instructions",
"type": "info" "type": "info"
}, },
{ {

View File

@@ -100,39 +100,39 @@ EOF
systemctl enable -q --now scanopy-server systemctl enable -q --now scanopy-server
# Creating short script to configure scanopy-daemon # Creating short script to configure scanopy-daemon
cat <<EOF >~/configure_daemon.sh # cat <<EOF >~/configure_daemon.sh
#!/usr/bin/env bash # #!/usr/bin/env bash
#
echo "Auto-configuring integrated daemon..." # echo "Auto-configuring integrated daemon..."
#
NETWORK_ID="\$(sudo -u postgres psql -1 -t -d "${PG_DB_NAME}" -c 'SELECT id FROM networks;')" # 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;')" # API_KEY="\$(sudo -u postgres psql -1 -t -d "${PG_DB_NAME}" -c 'SELECT key FROM api_keys;')"
#
cat <<END >/etc/systemd/system/scanopy-daemon.service # cat <<END >/etc/systemd/system/scanopy-daemon.service
[Unit] # [Unit]
Description=Scanopy Network Discovery Daemon # Description=Scanopy Network Discovery Daemon
After=network-online.target # After=network-online.target
Wants=network-online.target # Wants=network-online.target
#
[Service] # [Service]
Type=simple # Type=simple
User=root # User=root
ExecStart=/usr/bin/scanopy-daemon --server-url http://127.0.0.1:60072 --network-id \${NETWORK_ID} --daemon-api-key \${API_KEY} --mode push # ExecStart=/usr/bin/scanopy-daemon --server-url http://127.0.0.1:60072 --network-id \${NETWORK_ID} --daemon-api-key \${API_KEY} --mode push
Restart=always # Restart=always
RestartSec=10 # RestartSec=10
StandardOutput=journal # StandardOutput=journal
StandardError=journal # StandardError=journal
#
[Install] # [Install]
WantedBy=multi-user.target # WantedBy=multi-user.target
END # END
#
systemctl enable -q --now scanopy-daemon # systemctl enable -q --now scanopy-daemon
echo "Scanopy daemon configured and running" # echo "Scanopy daemon configured and running"
#
EOF # EOF
chmod +x ~/configure_daemon.sh # chmod +x ~/configure_daemon.sh
msg_ok "Scanopy server running - please create an account in the UI to continue." msg_ok "Scanopy server running - please create an account, daemon API key and daemon in the Scanopy UI."
motd_ssh motd_ssh
customize customize