Initial commit for iiEasy: all files included
This commit is contained in:
48
sync-to-nomad.sh
Executable file
48
sync-to-nomad.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
# Transfer iiEasy project files to Nomad node for remote build/deploy
|
||||
# Usage: ./sync-to-nomad.sh
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
NOMAD_HOST="${NOMAD_HOST:-192.168.1.16}"
|
||||
NOMAD_USER="${NOMAD_USER:-its}"
|
||||
REMOTE_DIR="${REMOTE_DIR:-/home/$NOMAD_USER/iieasy}"
|
||||
|
||||
echo "=== Sync iiEasy to $NOMAD_USER@$NOMAD_HOST:$REMOTE_DIR ==="
|
||||
|
||||
# Create exclude list (node_modules, .git, build artifacts)
|
||||
EXCLUDES=(
|
||||
--exclude 'node_modules'
|
||||
--exclude '.git'
|
||||
--exclude 'dist'
|
||||
--exclude 'dist-ssr'
|
||||
--exclude '.cache'
|
||||
--exclude '.tmp'
|
||||
--exclude 'build'
|
||||
--exclude '*.log'
|
||||
--exclude '.env'
|
||||
--exclude '.env.local'
|
||||
--exclude '.env.nomad'
|
||||
)
|
||||
|
||||
if command -v rsync &>/dev/null; then
|
||||
rsync -avz --progress \
|
||||
"${EXCLUDES[@]}" \
|
||||
"$SCRIPT_DIR/" \
|
||||
"$NOMAD_USER@$NOMAD_HOST:$REMOTE_DIR/"
|
||||
else
|
||||
echo "Using tar+ssh (rsync not found)..."
|
||||
tar --exclude='node_modules' --exclude='.git' --exclude='dist' \
|
||||
--exclude='.cache' --exclude='.tmp' --exclude='build' \
|
||||
-cf - . | ssh "$NOMAD_USER@$NOMAD_HOST" "mkdir -p $REMOTE_DIR && cd $REMOTE_DIR && tar -xf -"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Done. SSH to node and deploy:"
|
||||
echo " ssh $NOMAD_USER@$NOMAD_HOST"
|
||||
echo " cd $REMOTE_DIR"
|
||||
echo " ./deploy-on-node.sh"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user