add deploy.sh with rsync and edge modes
This commit is contained in:
51
ctrl/deploy.sh
Executable file
51
ctrl/deploy.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
# Deploy UNT (NOVA) to server
|
||||
# Usage: ./ctrl/deploy.sh [rsync|edge]
|
||||
#
|
||||
# rsync — sync source to server and rebuild there (bypass CI)
|
||||
# edge — pull latest images and restart containers
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
SERVER="mcrn.ar"
|
||||
REMOTE_DIR="~/lgit/unt"
|
||||
|
||||
case "${1:-rsync}" in
|
||||
rsync)
|
||||
echo "=== Syncing source to $SERVER ==="
|
||||
rsync -avz --exclude='.git' --exclude='node_modules' --exclude='.venv' \
|
||||
--exclude='ui/app/dist' --exclude='__pycache__' \
|
||||
--filter=':- .gitignore' \
|
||||
. "$SERVER:$REMOTE_DIR/"
|
||||
|
||||
echo "=== Building and restarting on server ==="
|
||||
ssh "$SERVER" << 'EOF'
|
||||
cd ~/lgit/unt
|
||||
docker build -t nova-api -f ctrl/Dockerfile.api .
|
||||
docker build -t nova-ui -f ctrl/Dockerfile.ui .
|
||||
cd ctrl/edge
|
||||
docker compose up -d --remove-orphans
|
||||
docker image prune -f
|
||||
docker compose ps
|
||||
EOF
|
||||
;;
|
||||
|
||||
edge)
|
||||
echo "=== Pulling and restarting on $SERVER ==="
|
||||
ssh "$SERVER" << 'EOF'
|
||||
cd ~/lgit/unt/ctrl/edge
|
||||
docker compose pull
|
||||
docker compose up -d --remove-orphans
|
||||
docker image prune -f
|
||||
docker compose ps
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 [rsync|edge]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "=== Deploy complete ==="
|
||||
Reference in New Issue
Block a user