fix(deploy): SSH 호스트 내부 IP 고정 (signal-batch 패턴) #47
@ -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
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user