-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·48 lines (39 loc) · 1.23 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·48 lines (39 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# Redeploys VortexUI on a native (non-Docker) install: pulls latest code,
# rebuilds the frontend, rebuilds the panel binary, and restarts services.
#
# Usage: sudo ./deploy.sh [--skip-backend]
set -euo pipefail
REPO_DIR="${VORTEX_REPO_DIR:-/opt/vortexui}"
WEB_ROOT="${VORTEX_WEB_ROOT:-/var/www/vortexui}"
SERVICE="${VORTEX_SERVICE:-vortexui-panel}"
SKIP_BACKEND=0
[[ "${1:-}" == "--skip-backend" ]] && SKIP_BACKEND=1
cd "$REPO_DIR"
echo "==> git pull"
git pull origin master
echo "==> building frontend"
cd "$REPO_DIR/web"
npm install
npm run build
echo "==> deploying static files to $WEB_ROOT"
mkdir -p "$WEB_ROOT"
# Wipe old hashed assets first so stale bundles never linger and mask a fresh
# deploy (Vite renames every build, cp alone would just keep piling files up).
if command -v rsync >/dev/null 2>&1; then
rsync -a --delete dist/ "$WEB_ROOT/"
else
rm -rf "${WEB_ROOT:?}"/*
cp -r dist/* "$WEB_ROOT/"
fi
if [[ "$SKIP_BACKEND" -eq 0 ]]; then
echo "==> building backend"
cd "$REPO_DIR"
go build -o /usr/local/bin/vortex-panel ./cmd/panel
echo "==> restarting $SERVICE"
systemctl restart "$SERVICE"
fi
echo "==> reloading caddy"
systemctl reload caddy
echo "==> done. built files:"
ls -la "$WEB_ROOT"/assets