diff --git a/ct/scanopy.sh b/ct/scanopy.sh index 9363f566f..b53665b59 100644 --- a/ct/scanopy.sh +++ b/ct/scanopy.sh @@ -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}" diff --git a/frontend/public/json/scanopy.json b/frontend/public/json/scanopy.json index 60e21fc1a..ef117782e 100644 --- a/frontend/public/json/scanopy.json +++ b/frontend/public/json/scanopy.json @@ -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" }, { diff --git a/install/scanopy-install.sh b/install/scanopy-install.sh index a683ac9c9..1453e097b 100644 --- a/install/scanopy-install.sh +++ b/install/scanopy-install.sh @@ -100,39 +100,39 @@ EOF systemctl enable -q --now scanopy-server # Creating short script to configure scanopy-daemon -cat <~/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 </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 <~/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 </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