#!/bin/bash # Deploy soleprint standalone to server # # Usage: # ./ctrl/deploy.sh # Sync and restart # ./ctrl/deploy.sh --build # Rebuild locally first, then sync and restart # ./ctrl/deploy.sh --sync-only # Sync without restarting set -e cd "$(dirname "$0")/.." SERVER="mcrn.ar" REMOTE_DIR="~/soleprint/gen/standalone" BUILD=false SYNC_ONLY=false for arg in "$@"; do case $arg in --build) BUILD=true ;; --sync-only) SYNC_ONLY=true ;; esac done if [ "$BUILD" = true ]; then echo "Building standalone..." python build.py fi echo "Syncing gen/standalone/ to $SERVER:$REMOTE_DIR..." rsync -avz --delete \ --exclude='__pycache__' \ --exclude='.venv' \ --exclude='*.pyc' \ --exclude='.env' \ --filter=':- .gitignore' \ gen/standalone/ "$SERVER:$REMOTE_DIR/" if [ "$SYNC_ONLY" = true ]; then echo "Sync complete (restart skipped)" exit 0 fi echo "Restarting soleprint on server..." ssh "$SERVER" "cd $REMOTE_DIR && docker compose up -d --build" echo "Deploy complete"