Files
maps-saas/sync_to_server.sh
T

54 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Auto-detect script directory so it can be run from any folder
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Configuration
SERVER_IP="188.68.36.205"
SERVER_USER="hamzadoctor"
REMOTE_PATH="/home/hamzadoctor/app"
KEY_PATH="/Users/hamzaaleghwairyeen/.ssh/doctory-key"
echo "🚀 Starting surgical sync to server: $SERVER_IP..."
# Verify if the key exists
if [ ! -f "$KEY_PATH" ]; then
echo "ℹ️ Using standard SSH authentication..."
KEY_FLAG=""
else
KEY_FLAG="-i $KEY_PATH"
fi
# Clean, lightweight sync using .rsyncignore file
rsync -avz --progress -e "ssh -o StrictHostKeyChecking=no" $KEY_FLAG \
--exclude-from="$SCRIPT_DIR/.rsyncignore" \
.env \
docker-compose.yml \
docker-compose.map2.yml \
setup_map2.sh \
style.json \
style-dark.json \
style-tourism.json \
style-satellite.json \
style-3d-terrain.json \
*.html \
*.md \
apps \
packages \
infrastructure \
data \
$SERVER_USER@$SERVER_IP:$REMOTE_PATH/
if [ $? -eq 0 ]; then
echo "✅ Sync successful!"
echo "------------------------------------------------"
echo "To rebuild and restart containers on the server:"
echo "cd $REMOTE_PATH"
echo "docker compose up -d --build api dashboard web"
echo "------------------------------------------------"
else
echo "❌ Sync failed. Please verify your SSH access."
fi