fix(deploy): SSH 연결 재시도 로직 추가 (kex_exchange 거부 대응)

- 본 명령 실행 전 SSH 연결 테스트 (최대 3회, 10초 간격)
- ServerAliveInterval=15 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
htlee 2026-03-18 09:59:35 +09:00
부모 d4442c8470
커밋 b41324aa54

파일 보기

@ -92,7 +92,21 @@ jobs:
chmod 600 ~/.ssh/id_deploy
ssh-keyscan -T 5 $DEPLOY_HOST >> ~/.ssh/known_hosts 2>/dev/null || true
SSH_CMD="ssh -i ~/.ssh/id_deploy -o StrictHostKeyChecking=no -o ConnectTimeout=10 root@$DEPLOY_HOST"
SSH_CMD="ssh -i ~/.ssh/id_deploy -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ServerAliveInterval=15 root@$DEPLOY_HOST"
# SSH 연결 테스트 (최대 3회, kex_exchange 거부 대응)
for attempt in 1 2 3; do
echo "SSH connectivity test $attempt/3..."
if $SSH_CMD echo "SSH OK"; then
break
fi
if [ "$attempt" -eq 3 ]; then
echo "ERROR: SSH connection failed after 3 attempts"
exit 1
fi
echo "SSH failed, retrying in 10s..."
sleep 10
done
$SSH_CMD bash -s << 'RESTART'
DEPLOY_DIR=/devdata/services/kcg/backend