fix(deploy): SSH into server to deploy instead of local rsync; add rsync install
Deploy to route.crispygoat.com / deploy (push) Has been cancelled

This commit is contained in:
openclaw
2026-06-09 13:25:48 -06:00
parent 4253544109
commit 908b40aa1f
+20 -16
View File
@@ -66,6 +66,9 @@ jobs:
MINIMAX_BASE_URL: ${{ secrets.MINIMAX_BASE_URL }}
run: npm run build
- name: Install rsync
run: sudo apt-get update && sudo apt-get install -y rsync
- name: Deploy
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
@@ -104,9 +107,19 @@ jobs:
MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
MINIMAX_BASE_URL: ${{ secrets.MINIMAX_BASE_URL }}
CRON_SECRET: ${{ secrets.CRON_SECRET }}
SERVER_SSH_KEY: ${{ secrets.SERVER_SSH_KEY }}
run: |
set -e
APP_DIR=/home/tyler/route-commerce
# Add server SSH host key if provided
if [ -n "$SERVER_SSH_KEY" ]; then
mkdir -p ~/.ssh
echo "$SERVER_SSH_KEY" >> ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan route.crispygoat.com >> ~/.ssh/known_hosts 2>/dev/null
fi
# Write production env file
{
printf "DATABASE_URL=%s\n" "$DATABASE_URL"
@@ -147,22 +160,13 @@ jobs:
printf "CRON_SECRET=%s\n" "$CRON_SECRET"
} > $APP_DIR/.env.production
# Sync build output and required files
rsync -a --delete .next/ $APP_DIR/.next/
rsync -a --delete public/ $APP_DIR/public/
cp package.json $APP_DIR/
cp next.config.ts $APP_DIR/ 2>/dev/null || true
# Sync build output and required files to server
rsync -a --delete .next/ tyler@route.crispygoat.com:$APP_DIR/.next/
rsync -a --delete public/ tyler@route.crispygoat.com:$APP_DIR/public/
rsync $APP_DIR/package.json tyler@route.crispygoat.com:$APP_DIR/
rsync next.config.ts tyler@route.crispygoat.com:$APP_DIR/ 2>/dev/null || true
# Install production deps only
cd $APP_DIR
npm install --omit=dev
# Start or restart PM2
if pm2 describe route-commerce > /dev/null 2>&1; then
pm2 restart route-commerce
else
pm2 start npm --name route-commerce -- start -- -p 3100
pm2 save
fi
# Install production deps and restart on server
ssh tyler@route.crispygoat.com "cd $APP_DIR && npm install --omit=dev && pm2 restart route-commerce || pm2 start npm --name route-commerce -- start -- -p 3100 && pm2 save"
echo "Deployed successfully"