Files
zmb-webui/deploy.sh
T
2026-06-05 19:21:29 +02:00

46 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Deploy ZMB Webui to target system
# Usage: ./deploy.sh [target] [--pull]
# Example: ./deploy.sh 192.168.1.179
# Example: ./deploy.sh 192.168.1.179 --pull (pull from git first)
TARGET="${1:-192.168.1.179}"
PULL="${2:-}"
set -e
if [ "$PULL" == "--pull" ]; then
echo "📦 Pulling from git..."
git pull origin master
fi
echo "🔨 Building frontend..."
cd frontend
rm -rf .next out
npm run build > /dev/null 2>&1
cd ..
echo "📤 Deploying to $TARGET..."
# Deploy backend
echo " → Backend..."
rsync -avz --delete backend/ root@$TARGET:/opt/zmb-webui/backend/ \
--exclude venv --exclude __pycache__ --exclude "*.pyc" > /dev/null
# Deploy frontend
echo " → Frontend..."
rsync -avz --delete frontend/out/ root@$TARGET:/opt/zmb-webui/frontend/ > /dev/null
# Restart services
echo "🔄 Restarting services..."
ssh root@$TARGET bash << 'EOF'
systemctl restart zmb-webui-backend
sleep 1
systemctl restart nginx
sleep 1
echo "✓ Services restarted"
EOF
echo "✅ Deployment complete!"
echo " Access: https://$TARGET:8090"