Files
maps-saas/sync_to_server.sh
T
2026-04-15 01:05:15 +03:00

48 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Configuration
SERVER_IP="188.68.36.205"
SERVER_USER="hamzadoctor"
REMOTE_PATH="/home/hamzadoctor/app"
KEY_PATH="/Users/hamzaaleghwairyeen/.ssh/doctory-key"
echo "🚀 Starting sync to server: $SERVER_IP..."
# Verify if the key exists
if [ ! -f "$KEY_PATH" ]; then
echo "⚠️ Warning: Identity file $KEY_PATH not found locally."
echo "Attempting sync using default SSH configuration..."
KEY_FLAG=""
else
KEY_FLAG="-i $KEY_PATH"
fi
# Sync files using rsync (surgical sync)
rsync -avz --progress -e "ssh -o StrictHostKeyChecking=no" $KEY_FLAG \
--exclude 'infrastructure/osm-data' \
--exclude 'osm-data' \
--exclude 'venv' \
--exclude '.git' \
--exclude 'node_modules' \
--exclude '.DS_Store' \
.env \
docker-compose.yml \
docker-compose.map2.yml \
setup_map2.sh \
apps \
packages \
infrastructure \
$SERVER_USER@$SERVER_IP:$REMOTE_PATH/
if [ $? -eq 0 ]; then
echo "✅ Sync successful!"
echo "------------------------------------------------"
echo "Now run the following on your SERVER terminal:"
echo "cd $REMOTE_PATH"
echo "docker compose up -d --build api dashboard"
echo "Dashboard will be live at: http://$SERVER_IP:3204"
echo "------------------------------------------------"
else
echo "❌ Sync failed. Please check your SSH connection or manually update the files."
fi