fix(deploy): SSH 호스트 내부 IP 고정 (signal-batch 패턴) (#47)
Some checks failed
Deploy KCG / deploy (push) Failing after 1m11s

Co-authored-by: htlee <htlee@gcsc.co.kr>
Co-committed-by: htlee <htlee@gcsc.co.kr>
This commit is contained in:
htlee 2026-03-18 08:38:49 +09:00 committed by claude-bot
부모 5d01b0e6e5
커밋 6182a79ae4

파일 보기

@ -85,15 +85,14 @@ jobs:
- name: Restart backend via SSH
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_HOST: 192.168.1.20
run: |
mkdir -p ~/.ssh
echo "$DEPLOY_KEY" > ~/.ssh/id_deploy
chmod 600 ~/.ssh/id_deploy
# Docker 컨테이너 → 호스트: default gateway (최소 의존)
DOCKER_HOST_IP=$(cat /proc/net/route | awk '$2 == "00000000" {printf "%d.%d.%d.%d", "0x"substr($3,7,2), "0x"substr($3,5,2), "0x"substr($3,3,2), "0x"substr($3,1,2); exit}')
ssh-keyscan $DOCKER_HOST_IP >> ~/.ssh/known_hosts 2>/dev/null || true
ssh-keyscan $DEPLOY_HOST >> ~/.ssh/known_hosts 2>/dev/null || true
SSH_CMD="ssh -i ~/.ssh/id_deploy -o StrictHostKeyChecking=no root@$DOCKER_HOST_IP"
SSH_CMD="ssh -i ~/.ssh/id_deploy -o StrictHostKeyChecking=no root@$DEPLOY_HOST"
$SSH_CMD bash -s << 'RESTART'
set -e