mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-09-24 11:08:07 +00:00
* scanopy: use prebuilt server binary, relax release profile for generate-fixtures * scanopy: drop unneeded rust build, use committed UI fixtures * scanopy: restore generate-fixtures build, ui/src/lib/data is gitignored and incomplete * scanopy: serve the UI from the binary, drop the source build 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. * Refactor scanopy-install.sh for server setup Updated installation script to configure Scanopy server and removed daemon configuration section. * Update service names from 'scanopy-server' to 'Scanopy' * Fix case sensitivity in fetch_and_deploy_gh_release * scanopy: make the rollback restore the whole old setup The health check put the previous binary back but nothing else, and the source tree it needs was already gone by then: the update deleted /opt/scanopy/ui before starting the new server, and removed SCANOPY_WEB_EXTERNAL_PATH from the env at the same time. A failed health check therefore left the old binary running without the UI it serves from disk, so the rollback produced an API-only server. Back up the env file and the unit alongside the binary, restore all three when the check fails, and delete the source tree only once the new server has answered. Nothing the old version needs is removed before the new one has proven itself. * scanopy: name the deployed binary what the unit starts singlefile mode writes the asset to <target>/<app name>: local target_file="$app" [[ "${USE_ORIGINAL_FILENAME:-false}" == "true" ]] && target_file="$filename" so with the app renamed to Scanopy the binary lands at /usr/bin/Scanopy while the unit starts /usr/bin/scanopy-server, and the service never comes up on a fresh install. Rename it after the deploy, the same way the daemon block already renames "Scanopy Daemon". Keeping the app name is what matters here: it is also the version file (~/.scanopy), and changing it would make every existing container report an update it does not need.
79 lines
2.2 KiB
Bash
79 lines
2.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" "scanopy/scanopy" "singlefile" "latest" "/usr/bin" "scanopy-server-linux-$(arch_resolve)"
|
|
mv -f /usr/bin/Scanopy /usr/bin/scanopy-server
|
|
|
|
msg_info "Configuring Scanopy"
|
|
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
|
|
msg_ok "Configured Scanopy"
|
|
|
|
msg_info "Creating Service"
|
|
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
|
|
msg_ok "Created Service"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|