mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-09-16 17:54:01 +00:00
Compare commits
1 Commits
fix-scanop
...
fix-docmos
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f44159be2a |
@@ -57,6 +57,7 @@ function update_script() {
|
|||||||
|
|
||||||
msg_info "Configuring Docmost"
|
msg_info "Configuring Docmost"
|
||||||
cd /opt/docmost
|
cd /opt/docmost
|
||||||
|
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||||
$STD pnpm install --force
|
$STD pnpm install --force
|
||||||
$STD pnpm build
|
$STD pnpm build
|
||||||
msg_ok "Configured Docmost"
|
msg_ok "Configured Docmost"
|
||||||
|
|||||||
@@ -32,25 +32,41 @@ function update_script() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_for_gh_release "scanopy-server" "scanopy/scanopy"; then
|
if check_for_gh_release "Scanopy" "scanopy/scanopy"; then
|
||||||
msg_info "Stopping services"
|
msg_info "Stopping services"
|
||||||
systemctl stop scanopy-server
|
systemctl stop scanopy-server
|
||||||
[[ -f /etc/systemd/system/scanopy-daemon.service ]] && systemctl stop scanopy-daemon
|
[[ -f /etc/systemd/system/scanopy-daemon.service ]] && systemctl stop scanopy-daemon
|
||||||
msg_ok "Stopped services"
|
msg_ok "Stopped services"
|
||||||
|
|
||||||
|
create_backup /opt/scanopy/.env /opt/scanopy/oidc.toml
|
||||||
|
|
||||||
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "Scanopy" "scanopy/scanopy" "tarball" "latest" "/opt/scanopy"
|
||||||
|
|
||||||
|
restore_backup
|
||||||
|
|
||||||
|
ensure_dependencies pkg-config libssl-dev
|
||||||
|
TOOLCHAIN="$(grep "channel" /opt/scanopy/backend/rust-toolchain.toml | awk -F\" '{print $2}')"
|
||||||
|
RUST_TOOLCHAIN=$TOOLCHAIN setup_rust
|
||||||
|
|
||||||
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
|
||||||
sed -i '/^SCANOPY_WEB_EXTERNAL_PATH=/d' /opt/scanopy/.env
|
|
||||||
sed -i 's|^WorkingDirectory=/opt/scanopy/backend$|WorkingDirectory=/opt/scanopy|' /etc/systemd/system/scanopy-server.service
|
|
||||||
systemctl daemon-reload
|
|
||||||
|
|
||||||
cp -f /usr/bin/scanopy-server /usr/bin/scanopy-server.bak 2>/dev/null || true
|
msg_info "Building Scanopy Server (patience)"
|
||||||
|
cd /opt/scanopy/backend
|
||||||
|
CARGO_BUILD_JOBS="$(get_parallel_jobs)" $STD cargo build --release --bin server --bin generate-fixtures
|
||||||
|
$STD ./target/release/generate-fixtures --output-dir /opt/scanopy/ui/src/lib/data
|
||||||
|
mv ./target/release/server /usr/bin/scanopy-server
|
||||||
|
msg_ok "Built Scanopy Server"
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "scanopy-server" "scanopy/scanopy" "singlefile" "latest" "/usr/bin" "scanopy-server-linux-$(arch_resolve)"
|
msg_info "Creating frontend UI"
|
||||||
|
export PUBLIC_SERVER_HOSTNAME=default
|
||||||
rm -rf /opt/scanopy/backend /opt/scanopy/ui
|
export PUBLIC_SERVER_PORT=""
|
||||||
|
cd /opt/scanopy/ui
|
||||||
|
$STD npm ci --no-fund --no-audit
|
||||||
|
$STD npm run build
|
||||||
|
msg_ok "Created frontend UI"
|
||||||
|
|
||||||
if [[ -f /etc/systemd/system/scanopy-daemon.service ]]; then
|
if [[ -f /etc/systemd/system/scanopy-daemon.service ]]; then
|
||||||
fetch_and_deploy_gh_release "Scanopy Daemon" "scanopy/scanopy" "singlefile" "latest" "/usr/local/bin" "scanopy-daemon-linux-$(arch_resolve)"
|
fetch_and_deploy_gh_release "Scanopy Daemon" "scanopy/scanopy" "singlefile" "latest" "/usr/local/bin" "scanopy-daemon-linux-$(arch_resolve)"
|
||||||
@@ -65,22 +81,6 @@ function update_script() {
|
|||||||
|
|
||||||
msg_info "Starting services"
|
msg_info "Starting services"
|
||||||
systemctl start scanopy-server
|
systemctl start scanopy-server
|
||||||
healthy=0
|
|
||||||
for _ in {1..30}; do
|
|
||||||
if curl -fsS -o /dev/null http://127.0.0.1:60072/api/health 2>/dev/null; then
|
|
||||||
healthy=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
if [[ "$healthy" -ne 1 ]]; then
|
|
||||||
systemctl stop scanopy-server
|
|
||||||
[[ -f /usr/bin/scanopy-server.bak ]] && mv -f /usr/bin/scanopy-server.bak /usr/bin/scanopy-server
|
|
||||||
systemctl start scanopy-server
|
|
||||||
msg_error "New server did not answer /api/health, restored the previous binary"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm -f /usr/bin/scanopy-server.bak
|
|
||||||
[[ -f /etc/systemd/system/scanopy-daemon.service ]] && systemctl start scanopy-daemon
|
[[ -f /etc/systemd/system/scanopy-daemon.service ]] && systemctl start scanopy-daemon
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ sed -i -e "s|APP_SECRET=.*|APP_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z
|
|||||||
-e "s|^STORAGE_DRIVER=azure|#STORAGE_DRIVER=azure|" \
|
-e "s|^STORAGE_DRIVER=azure|#STORAGE_DRIVER=azure|" \
|
||||||
/opt/docmost/.env
|
/opt/docmost/.env
|
||||||
export NODE_OPTIONS="--max-old-space-size=2048"
|
export NODE_OPTIONS="--max-old-space-size=2048"
|
||||||
|
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||||
$STD pnpm install
|
$STD pnpm install
|
||||||
$STD pnpm build
|
$STD pnpm build
|
||||||
msg_ok "Configured Docmost"
|
msg_ok "Configured Docmost"
|
||||||
|
|||||||
@@ -13,15 +13,40 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
PG_VERSION=17 setup_postgresql
|
msg_info "Installing Dependencies"
|
||||||
PG_DB_NAME="scanopy_db" PG_DB_USER="scanopy" PG_DB_GRANT_SUPERUSER="true" setup_postgresql_db
|
$STD apt install -y \
|
||||||
fetch_and_deploy_gh_release "scanopy" "scanopy/scanopy" "singlefile" "latest" "/usr/bin" "scanopy-server-linux-$(arch_resolve)"
|
build-essential \
|
||||||
|
libssl-dev \
|
||||||
|
pkg-config
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Configuring Scanopy"
|
PG_VERSION=17 setup_postgresql
|
||||||
mkdir -p /opt/scanopy
|
NODE_VERSION="24" setup_nodejs
|
||||||
|
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" "tarball" "latest" "/opt/scanopy"
|
||||||
|
TOOLCHAIN="$(grep "channel" /opt/scanopy/backend/rust-toolchain.toml | awk -F\" '{print $2}')"
|
||||||
|
RUST_TOOLCHAIN=$TOOLCHAIN setup_rust
|
||||||
|
|
||||||
|
msg_info "Building Scanopy Server (patience)"
|
||||||
|
cd /opt/scanopy/backend
|
||||||
|
CARGO_BUILD_JOBS="$(get_parallel_jobs)" $STD cargo build --release --bin server --bin generate-fixtures
|
||||||
|
$STD ./target/release/generate-fixtures --output-dir /opt/scanopy/ui/src/lib/data
|
||||||
|
mv ./target/release/server /usr/bin/scanopy-server
|
||||||
|
msg_ok "Built Scanopy Server"
|
||||||
|
|
||||||
|
msg_info "Creating frontend UI"
|
||||||
|
export PUBLIC_SERVER_HOSTNAME=default
|
||||||
|
export PUBLIC_SERVER_PORT=""
|
||||||
|
cd /opt/scanopy/ui
|
||||||
|
$STD npm ci --no-fund --no-audit
|
||||||
|
$STD npm run build
|
||||||
|
msg_ok "Created frontend UI"
|
||||||
|
|
||||||
|
msg_info "Configuring server for first-run"
|
||||||
cat <<EOF >/opt/scanopy/.env
|
cat <<EOF >/opt/scanopy/.env
|
||||||
### - SERVER
|
### - SERVER
|
||||||
SCANOPY_DATABASE_URL=postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME
|
SCANOPY_DATABASE_URL=postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME
|
||||||
|
SCANOPY_WEB_EXTERNAL_PATH="/opt/scanopy/ui/build"
|
||||||
SCANOPY_PUBLIC_URL=http://${LOCAL_IP}:60072
|
SCANOPY_PUBLIC_URL=http://${LOCAL_IP}:60072
|
||||||
SCANOPY_SERVER_PORT=60072
|
SCANOPY_SERVER_PORT=60072
|
||||||
SCANOPY_LOG_LEVEL=info
|
SCANOPY_LOG_LEVEL=info
|
||||||
@@ -48,9 +73,7 @@ SCANOPY_HEARTBEAT_INTERVAL=30
|
|||||||
|
|
||||||
### - see https://github.com/scanopy/scanopy/blob/main/docs/CONFIGURATION.md for more options
|
### - see https://github.com/scanopy/scanopy/blob/main/docs/CONFIGURATION.md for more options
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Configured Scanopy"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
|
||||||
cat <<EOF >/etc/systemd/system/scanopy-server.service
|
cat <<EOF >/etc/systemd/system/scanopy-server.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Scanopy Network Discovery Server
|
Description=Scanopy Network Discovery Server
|
||||||
@@ -58,7 +81,7 @@ After=network.target postgresql.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/opt/scanopy
|
WorkingDirectory=/opt/scanopy/backend
|
||||||
EnvironmentFile=/opt/scanopy/.env
|
EnvironmentFile=/opt/scanopy/.env
|
||||||
ExecStart=/usr/bin/scanopy-server
|
ExecStart=/usr/bin/scanopy-server
|
||||||
Restart=always
|
Restart=always
|
||||||
@@ -69,8 +92,43 @@ StandardError=journal
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
systemctl enable -q --now scanopy-server
|
systemctl enable -q --now scanopy-server
|
||||||
msg_ok "Created Service"
|
|
||||||
|
# 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
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|||||||
Reference in New Issue
Block a user