feat: import Sea vHost single-server testing release

This commit is contained in:
canglan committed 2026-10-30 08:39:10 +08:00
commit 248badd33e
441 files changed
+63221

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env bash
set -uo pipefail
failures=0
warnings=0
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
pass() { printf '[PASS] %s\n' "$1"; }
warn() { printf '[WARN] %s\n' "$1"; warnings=$((warnings + 1)); }
fail() { printf '[FAIL] %s\n' "$1"; failures=$((failures + 1)); }
printf 'Sea vHost installation preflight\n'
printf '================================\n'
if [[ "${EUID}" -eq 0 ]]; then pass 'running as root'; else fail 'preflight must run as root'; fi
for required in systemctl getent id chattr openssl mktemp ss tar curl; do
if command -v "${required}" >/dev/null 2>&1; then pass "command available: ${required}"; else fail "missing command: ${required}"; fi
done
if [[ "$(ps -p 1 -o comm= 2>/dev/null | xargs)" == 'systemd' ]]; then
pass 'systemd is PID 1'
else
fail 'systemd is not PID 1'
fi
if id www >/dev/null 2>&1; then pass 'aaPanel service user www exists'; else fail 'aaPanel service user www is missing'; fi
for path in /www /www/wwwroot /www/server/panel/vhost/nginx; do
if [[ -d "${path}" && ! -L "${path}" ]]; then pass "physical directory available: ${path}"; else fail "missing or unsafe directory: ${path}"; fi
done
if [[ -x /www/server/nginx/sbin/nginx ]]; then
pass 'aaPanel Nginx binary is available'
if /www/server/nginx/sbin/nginx -t >/dev/null 2>&1; then pass 'current Nginx configuration is valid'; else fail 'current Nginx configuration is invalid'; fi
else
fail 'aaPanel Nginx binary is missing'
fi
for path in /www/server/nginx/logs/error.log /www/server/nginx/logs/nginx.pid; do
if [[ -f "${path}" && ! -L "${path}" ]]; then pass "physical Nginx runtime file available: ${path}"; else fail "missing or unsafe Nginx runtime file: ${path}"; fi
done
if systemctl is-active --quiet mysql.service || systemctl is-active --quiet mysqld.service; then
pass 'MySQL service is active'
else
warn 'MySQL service was not detected as active'
fi
if ss -ltnH 2>/dev/null | awk '{print $4}' | grep -Eq '(^|:|\])8080$'; then
if systemctl is-active --quiet sea-vhost-api.service; then
pass 'TCP port 8080 is occupied by the existing Sea vHost API (upgrade mode)'
else
fail 'TCP port 8080 is already in use by an unmanaged service'
fi
else
pass 'TCP port 8080 is available'
fi
for artifact in sea-vhost-api sea-vhost-agent sea-vhost-panel-broker; do
if [[ -f "${repo_root}/build/bin/${artifact}" && ! -L "${repo_root}/build/bin/${artifact}" ]]; then pass "build artifact available: ${artifact}"; else fail "missing or unsafe build artifact: ${artifact}"; fi
done
if [[ -f "${repo_root}/build/web/index.html" && ! -L "${repo_root}/build/web/index.html" ]]; then pass 'frontend build is available'; else fail 'frontend build is missing or unsafe'; fi
printf '\nResult: %d failure(s), %d warning(s)\n' "${failures}" "${warnings}"
if (( failures > 0 )); then exit 1; fi