From e28ebf566479ad23d1e9376ee8507796abc52332 Mon Sep 17 00:00:00 2001 From: openclaw Date: Tue, 9 Jun 2026 14:49:22 -0600 Subject: [PATCH] fix(deploy): improve SSH key handling and add debug output --- .gitea/workflows/deploy.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 8dc2aac..cd23358 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -109,20 +109,28 @@ jobs: set -e APP_DIR=/home/tyler/route-commerce - # Setup SSH key (secret contains multiline private key) + # Setup SSH key - write raw (no printf which can corrupt multi-line keys) mkdir -p ~/.ssh - printf '%s\n' "$SERVER_SSH_KEY" > ~/.ssh/id_ed25519 + echo "$SERVER_SSH_KEY" > ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 + + # Verify key was written correctly + if ! grep -q "PRIVATE KEY" ~/.ssh/id_ed25519; then + echo "ERROR: SSH key not found or malformed. Check SERVER_SSH_KEY secret." + cat ~/.ssh/id_ed25519 || echo "File is empty" + exit 1 + fi + ssh-keyscan -H route.crispygoat.com >> ~/.ssh/known_hosts 2>/dev/null || true - # Test SSH connection + # Test SSH connection with verbose output for debugging echo "Testing SSH connection..." - ssh -o ConnectTimeout=15 -o StrictHostKeyChecking=no tyler@route.crispygoat.com "echo 'SSH OK' && hostname" || { echo "SSH FAILED - check SERVER_SSH_KEY secret"; exit 1; } + ssh -o ConnectTimeout=15 -o StrictHostKeyChecking=no -o LogLevel=VERBOSE tyler@route.crispygoat.com "echo 'SSH OK' && hostname" 2>&1 || { echo "SSH FAILED"; exit 1; } # Create app dir on server ssh tyler@route.crispygoat.com "mkdir -p $APP_DIR/.next $APP_DIR/public" - # Write production env file using printf (avoids heredoc quoting issues) + # Write production env file ENV_FILE=$(mktemp) { printf 'DATABASE_URL=%s\n' "$DATABASE_URL"