mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-09-17 02:03:59 +00:00
Upstream confirmed in scanopy/scanopy#698 that scanopy-server-linux-* has carried the built UI since v0.17.13, fixtures and service logos included, served on the same port as the API. The release notes never said so, which is why we kept building it. That removes the source tarball, the Rust toolchain and generate-fixtures, Node with npm ci and npm run build, and SCANOPY_WEB_EXTERNAL_PATH. With the variable set to a directory that no longer has an index.html, v0.17.14 and earlier refuse to start, so the update deletes the line rather than leaving it. build-essential, libssl-dev and pkg-config go too: the release binary is static-pie with no INTERP segment, so it has no runtime library dependencies. /opt/scanopy stays, now only for .env and oidc.toml, and the unit's WorkingDirectory follows it out of the removed backend directory. Since nothing wipes that directory any more, the config survives an update on its own, which is the report upstream passed on of an update coming back without SCANOPY_WEB_EXTERNAL_PATH and the server starting API-only. The update keeps the running binary until the new one answers /api/health and puts it back if it does not, so a bad release leaves a working server instead of a stopped one. check_for_gh_release now keys on scanopy-server, matching the version file the binary deploy writes; the Scanopy key belonged to the tarball that is gone. Existing containers run one extra update, then agree.
112 lines
3.2 KiB
Bash
112 lines
3.2 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: vhsdream
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/scanopy/scanopy
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
PG_VERSION=17 setup_postgresql
|
|
PG_DB_NAME="scanopy_db" PG_DB_USER="scanopy" PG_DB_GRANT_SUPERUSER="true" setup_postgresql_db
|
|
|
|
fetch_and_deploy_gh_release "scanopy-server" "scanopy/scanopy" "singlefile" "latest" "/usr/bin" "scanopy-server-linux-$(arch_resolve)"
|
|
|
|
msg_info "Configuring server for first-run"
|
|
mkdir -p /opt/scanopy
|
|
cat <<EOF >/opt/scanopy/.env
|
|
### - SERVER
|
|
SCANOPY_DATABASE_URL=postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME
|
|
SCANOPY_PUBLIC_URL=http://${LOCAL_IP}:60072
|
|
SCANOPY_SERVER_PORT=60072
|
|
SCANOPY_LOG_LEVEL=info
|
|
SCANOPY_INTEGRATED_DAEMON_URL=http://127.0.0.1:60073
|
|
## - uncomment to disable signups
|
|
# SCANOPY_DISABLE_REGISTRATION=true
|
|
## - uncomment when using TLS
|
|
# SCANOPY_USE_SECURE_SESSION_COOKIES=true
|
|
## - see https://github.com/imbolc/axum-client-ip?tab=readme-ov-file#configurable-vs-specific-extractors
|
|
## - before uncommenting the below
|
|
# SCANOPY_CLIENT_IP_SOURCE=
|
|
|
|
### - SMTP (password reset and notifications - optional)
|
|
# SCANOPY_SMTP_RELAY=smtp.gmail.com:587
|
|
# SCANOPY_SMTP_USERNAME=your-email@gmail.com
|
|
# SCANOPY_SMTP_PASSWORD=your-app-password
|
|
# SCANOPY_SMTP_EMAIL=scanopy@yourdomain.tld
|
|
|
|
### - INTEGRATED DAEMON
|
|
SCANOPY_SERVER_URL=http://127.0.0.1:60072
|
|
SCANOPY_BIND_ADDRESS=0.0.0.0
|
|
SCANOPY_NAME="scanopy-daemon"
|
|
SCANOPY_HEARTBEAT_INTERVAL=30
|
|
|
|
### - see https://github.com/scanopy/scanopy/blob/main/docs/CONFIGURATION.md for more options
|
|
EOF
|
|
|
|
cat <<EOF >/etc/systemd/system/scanopy-server.service
|
|
[Unit]
|
|
Description=Scanopy Network Discovery Server
|
|
After=network.target postgresql.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
WorkingDirectory=/opt/scanopy
|
|
EnvironmentFile=/opt/scanopy/.env
|
|
ExecStart=/usr/bin/scanopy-server
|
|
Restart=always
|
|
RestartSec=10
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
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, daemon API key and daemon in the Scanopy UI."
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|