diff --git a/.gitea/workflows/deploy-prod.yml b/.gitea/workflows/deploy-prod.yml index e08d624..fa992c0 100644 --- a/.gitea/workflows/deploy-prod.yml +++ b/.gitea/workflows/deploy-prod.yml @@ -11,7 +11,8 @@ concurrency: cancel-in-progress: true env: - DEPLOY_HOST: quant.taxbaik.com + DEPLOY_HOST: quant.taxbaik.com # 앱 도메인 (헬스체크, URL 검증용) + DEPLOY_SSH_HOST: 178.104.200.7 # SSH 직접 접속 IP (Cloudflare 우회) DEPLOY_USER: kjh2064 SERVICE_NAME: quantengine DOTNET_VERSION: '10.0.x' @@ -113,9 +114,9 @@ jobs: exit 1 fi - # 호스트 키 스캔 (재시도) + # 호스트 키 스캔 (재시도) - SSH 직접 IP 사용 (Cloudflare 우회) for i in 1 2 3; do - if ssh-keyscan -t ed25519,rsa -H ${{ env.DEPLOY_HOST }} >> ~/.ssh/known_hosts 2>/dev/null; then + if ssh-keyscan -t ed25519,rsa -H ${{ env.DEPLOY_SSH_HOST }} >> ~/.ssh/known_hosts 2>/dev/null; then echo "✓ Host key added" break elif [ $i -lt 3 ]; then @@ -126,10 +127,10 @@ jobs: fi done - # SSH 연결 테스트 - echo "Testing SSH connection..." + # SSH 연결 테스트 - SSH 직접 IP 사용 + echo "Testing SSH connection to ${{ env.DEPLOY_SSH_HOST }}..." if ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 \ - "${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }}" "echo ✓ SSH OK"; then + "${{ env.DEPLOY_USER }}@${{ env.DEPLOY_SSH_HOST }}" "echo ✓ SSH OK"; then echo "✓ SSH connection verified" else echo "❌ SSH connection test failed" @@ -198,6 +199,7 @@ jobs: TIMESTAMP=$(date +%Y%m%d_%H%M%S) COMMIT=$(git rev-parse --short HEAD) DEPLOY_HOST="${{ env.DEPLOY_HOST }}" + DEPLOY_SSH_HOST="${{ env.DEPLOY_SSH_HOST }}" DEPLOY_USER="${{ env.DEPLOY_USER }}" TELEGRAM_BOT_TOKEN="${{ secrets.TELEGRAM_BOT_TOKEN }}" @@ -229,10 +231,10 @@ jobs: echo "=== Deploying QuantEngine $COMMIT ($TIMESTAMP) ===" - # 원격 디렉토리 생성 + # 원격 디렉토리 생성 - SSH 직접 IP 사용 echo "📁 Creating remote directories..." if ! ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 \ - "$DEPLOY_USER@$DEPLOY_HOST" "mkdir -p /home/kjh2064/tmp"; then + "$DEPLOY_USER@$DEPLOY_SSH_HOST" "mkdir -p /home/kjh2064/tmp"; then echo "❌ Failed to create remote directories" notify_failure "Remote directory creation" fi @@ -244,7 +246,7 @@ jobs: for attempt in 1 2 3; do if scp -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 \ - "$SRC" "$DEPLOY_USER@$DEPLOY_HOST:/home/kjh2064/tmp/$DST" 2>&1; then + "$SRC" "$DEPLOY_USER@$DEPLOY_SSH_HOST:/home/kjh2064/tmp/$DST" 2>&1; then echo "✓ Transferred $SRC" break elif [ $attempt -lt 3 ]; then @@ -257,11 +259,11 @@ jobs: done done - # 배포 스크립트 실행 (재시도) + # 배포 스크립트 실행 (재시도) - SSH 직접 IP 사용 echo "🚀 Running deployment script..." for attempt in 1 2; do if ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 \ - "$DEPLOY_USER@$DEPLOY_HOST" "chmod +x /home/kjh2064/tmp/deploy.sh && CI_DEPLOY=1 /home/kjh2064/tmp/deploy.sh"; then + "$DEPLOY_USER@$DEPLOY_SSH_HOST" "chmod +x /home/kjh2064/tmp/deploy.sh && CI_DEPLOY=1 /home/kjh2064/tmp/deploy.sh"; then echo "✓ Deployment script executed successfully" break elif [ $attempt -lt 2 ]; then @@ -273,10 +275,10 @@ jobs: fi done - # 환경 파일 설치 + # 환경 파일 설치 - SSH 직접 IP 사용 echo "⚙️ Installing environment configuration..." if ! ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 \ - "$DEPLOY_USER@$DEPLOY_HOST" "mkdir -p /home/kjh2064/.config && install -m 600 /home/kjh2064/tmp/quantengine.env /home/kjh2064/.config/quantengine.env && rm -f /home/kjh2064/tmp/quantengine.env"; then + "$DEPLOY_USER@$DEPLOY_SSH_HOST" "mkdir -p /home/kjh2064/.config && install -m 600 /home/kjh2064/tmp/quantengine.env /home/kjh2064/.config/quantengine.env && rm -f /home/kjh2064/tmp/quantengine.env"; then echo "❌ Failed to install configuration" notify_failure "Configuration installation" fi @@ -289,7 +291,7 @@ jobs: loopback_headers="" for i in 1 2 3; do echo " Health check attempt $i..." - loopback_headers=$(ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 "$DEPLOY_USER@$DEPLOY_HOST" "curl -s -D - -o /dev/null -m 5 http://127.0.0.1:5000/" 2>&1) + loopback_headers=$(ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 "$DEPLOY_USER@$DEPLOY_SSH_HOST" "curl -s -D - -o /dev/null -m 5 http://127.0.0.1:5000/" 2>&1) if printf '%s' "$loopback_headers" | grep -qE '^HTTP/1\.[01] (200|30[12]) '; then echo "✓ Loopback health check passed"