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
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_info "Backing up configurations"
cp /opt/scanopy/.env /opt/scanopy.env.bak
if [[ -f /opt/scanopy/oidc.toml ]]; then
cp /opt/scanopy/oidc.toml /opt/scanopy.oidc.toml
fi
cp /opt/scanopy/.env /opt/scanopy.env
[[ -f /opt/scanopy/oidc.toml ]] && cp /opt/scanopy/oidc.toml /opt/scanopy.oidc.toml
msg_ok "Backed up configurations"
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}')"
RUST_TOOLCHAIN=$TOOLCHAIN setup_rust
mv /opt/scanopy.env.bak /opt/scanopy/.env
if [[ -f /opt/scanopy.oidc.toml ]]; then
mv /opt/scanopy.oidc.toml /opt/scanopy/oidc.toml
fi
[[ -f /opt/scanopy.env ]] && mv /opt/scanopy.env /opt/scanopy/.env
[[ -f /opt/scanopy.oidc.toml ]] && mv /opt/scanopy.oidc.toml /opt/scanopy/oidc.toml
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
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_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!"
fi
exit
@@ -95,4 +93,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}"
echo -e "${INFO}${YW} Then create your account, and create a daemon in the UI.${CL}"

View File

@@ -33,7 +33,7 @@
},
"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"
},
{

View File

@@ -100,39 +100,39 @@ EOF
systemctl enable -q --now scanopy-server
# Creating short script to configure scanopy-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/scanopy-daemon.service
[Unit]
Description=Scanopy Network Discovery Daemon
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
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
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
END
systemctl enable -q --now scanopy-daemon
echo "Scanopy daemon configured and running"
EOF
chmod +x ~/configure_daemon.sh
msg_ok "Scanopy server running - please create an account in the UI to continue."
# 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/scanopy-daemon.service
# [Unit]
# Description=Scanopy Network Discovery Daemon
# After=network-online.target
# Wants=network-online.target
#
# [Service]
# Type=simple
# 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
# Restart=always
# RestartSec=10
# StandardOutput=journal
# StandardError=journal
#
# [Install]
# WantedBy=multi-user.target
# END
#
# systemctl enable -q --now scanopy-daemon
# echo "Scanopy daemon configured and running"
#
# EOF
# chmod +x ~/configure_daemon.sh
msg_ok "Scanopy server running - please create an account, daemon API key and daemon in the Scanopy UI."
motd_ssh
customize