Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 130 additions & 74 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI/CD Pipeline

on:
push:
branches: [ main, develop, 'fix/*' ]
branches: [ main ]
pull_request:
branches: [ main, develop, 'fix/*' ]
branches: [ main ]

env:
REGISTRY: ghcr.io
Expand All @@ -16,8 +16,8 @@ jobs:

# 환경변수 설정
env:
ENVIRONMENT: development
DEBUG: true
ENVIRONMENT: production
DEBUG: false
LOG_LEVEL: INFO
GITHUB_ACTIONS: true

Expand Down Expand Up @@ -94,63 +94,14 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
file: ./docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

deploy-development:
needs: build-and-push
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
environment: development

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Checkout Config Repository
uses: actions/checkout@v4
with:
repository: UruruLab/Ururu-AI-Config
path: config
token: ${{ secrets.PRIVATE_REPO_TOKEN }}

- name: Copy Development Environment Config Files
run: |
if compgen -G "config/.env*" > /dev/null; then
if [ -f "config/.env.development" ]; then
cp config/.env.development .env.development
echo "✅ Development environment config files copied successfully"
else
echo "❌ .env.development not found in config repository"
exit 1
fi
else
echo "❌ No config files found in config repository"
exit 1
fi

- name: Validate Docker Compose Configuration
run: |
echo "Validating development environment configuration files"
echo "Validating docker-compose.development.yml syntax"
ENVIRONMENT=development docker compose -f docker-compose.development.yml config --quiet
echo "Verifying environment variable bindings"
ENVIRONMENT=development docker compose -f docker-compose.development.yml config \
| grep -A 10 "environment:" \
| grep "^[[:space:]]*[[:alpha:]]" \
| sed 's/.*$/&<redacted>/' || true
echo "Development environment deployment preparation completed"

- name: Simulate Deployment (No actual EC2 deployment)
run: |
echo "Development environment deployment simulation"
echo "- Docker Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:develop"
echo "- Config File: .env.development (fetched from Config repository)"
echo "Development environment deployment configuration completed"
# Development 배포는 VPC 내부 통신에서 불필요하므로 제거

deploy-production:
needs: build-and-push
Expand All @@ -167,7 +118,7 @@ jobs:
with:
repository: UruruLab/Ururu-AI-Config
path: config
token: ${{ secrets.PRIVATE_REPO_TOKEN }}
token: ${{ secrets.GHCR_TOKEN }}

- name: Copy Production Environment Config Files
run: |
Expand All @@ -187,25 +138,130 @@ jobs:
- name: Validate Docker Compose Configuration
run: |
echo "Validating production environment configuration files"
echo "Validating docker-compose.production.yml syntax"
ENVIRONMENT=production docker compose -f docker-compose.production.yml config --quiet
echo "Verifying environment variable bindings"
ENVIRONMENT=production docker compose -f docker-compose.production.yml config \
| grep -A 10 "environment:" \
| grep "^[[:space:]]*[[:alpha:]]" \
| sed 's/.*$/&<redacted>/' || true
echo "Production environment deployment preparation completed"

- name: Prepare Deployment Notification
run: |
echo "Production environment deployment preparation completed"
echo "- Docker Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
echo "- Config File: .env.production (fetched from Config repository)"
echo "Actual EC2 deployment will be handled by separate process"
- name: Deploy to FastAPI Production EC2
uses: appleboy/ssh-action@v0.1.6
with:
host: ${{ secrets.AI_EC2_HOST }} # 새로운 FastAPI EC2
username: ${{ secrets.AI_EC2_USER }} # ec2-user
key: ${{ secrets.AI_EC2_SSH_KEY }} # 새로운 EC2 키
port: 22
timeout: 600s
script: |
Comment on lines +143 to +99
Copy link

@coderabbitai coderabbitai bot Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

SSH 배포 스크립트에 .env.production 전송 단계가 없습니다
Runner 에서 복사한 .env.production 파일이 EC2 로 전달되지 않으므로,
EC2 측에서 178~180 라인 체크에 실패해 배포가 즉시 중단됩니다.
scp 로 파일을 넘기거나 cat <<'EOF' 방식으로 원격 작성해주셔야 합니다.

+  # 예시: 파일 전송
+  - name: Upload .env.production
+    uses: appleboy/scp-action@v0.1.4
+    with:
+      host: ${{ secrets.AI_EC2_HOST }}
+      username: ${{ secrets.AI_EC2_USER }}
+      key: ${{ secrets.AI_EC2_SSH_KEY }}
+      source: ".env.production"
+      target: "/home/ec2-user/ururu-ai/.env.production"
🤖 Prompt for AI Agents
In .github/workflows/ci-cd.yml around lines 143 to 151, the deployment script
lacks a step to transfer the .env.production file to the EC2 instance, causing
deployment to fail on environment checks. Add a command before the deployment
script to copy the .env.production file from the runner to the EC2, either by
using scp with the SSH credentials or by creating the file remotely using a
here-document (cat <<'EOF'). Ensure the file is correctly placed on the EC2 so
subsequent deployment steps can access it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SSH 배포 스크립트가 더 간결하고 명확해졌습니다.
.env.production 파일을 직접 업로드하는 방식이 더 안전하고 효율적입니다.

이 구조로 적용하겠습니다.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@23MinL 좋은 결정입니다! 직접 파일 업로드 방식은 확실히 더 투명하고 안전한 접근법이죠.

scp-action을 사용하면 파일 전송 과정이 명시적으로 분리되어 디버깅도 더 쉬워지고, 스크립트 내에서 파일 생성 로직이 복잡해지는 것도 방지할 수 있습니다.

배포 파이프라인 개선 작업 화이팅하세요! 🚀


✏️ Learnings added
Learnt from: 23MinL
PR: UruruLab/Ururu-AI#28
File: .github/workflows/ci-cd.yml:143-151
Timestamp: 2025-07-16T02:59:26.908Z
Learning: 23MinL은 CI/CD 배포 스크립트에서 환경 설정 파일 처리 시 스크립트 내부에서 파일을 생성하는 방식보다 scp-action을 사용한 직접 파일 업로드 방식을 선호한다. 이는 더 간결하고 명확하며 안전하고 효율적인 접근법으로 평가하며, 파일 전송 과정의 투명성과 디버깅 용이성을 중요하게 여긴다.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: 23MinL
PR: UruruLab/Ururu-AI#28
File: .github/workflows/ci-cd.yml:138-142
Timestamp: 2025-07-16T02:47:55.337Z
Learning: 23MinL은 CI/CD 파이프라인에서 validation을 실제 배포 환경과 맞지 않는 경우 제거하고, 실제 배포 시점(EC2에서 docker compose 실행)에서 validation을 수행하는 실용적 접근법을 선호한다. CI/CD 환경의 제약(production secrets 부재, VPC 환경 차이)을 고려하여 validation 시점을 적절히 분리하는 아키텍처적 판단을 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-09T15:52:13.709Z
Learning: 23MinL은 CI/CD 파이프라인 설계에서 현실적 제약을 고려한 하이브리드 접근법을 선호한다. GitHub Actions에서는 Docker 이미지 빌드/푸시와 설정 검증까지만 자동화하고, 실제 배포는 보안과 제어를 위해 수동으로 분리하는 방식을 적용한다. 배포 시뮬레이션과 명확한 가이드 제공을 통해 투명성과 실용성을 동시에 확보하는 것을 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-09T16:21:00.355Z
Learning: 23MinL은 GitHub Actions CI/CD 파이프라인에서 환경변수 보안을 최우선으로 고려하며, cat 명령어로 .env 파일 내용을 로그에 출력하는 것을 제거하여 민감 정보 노출을 방지하는 보안 중심적 접근법을 적용한다. 특히 FastAPI → Spring Boot → ALB 구조에서는 백엔드 연결 정보 보안을 더욱 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#26
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-11T17:05:55.347Z
Learning: 23MinL은 GitHub Actions CI/CD 파이프라인에서 환경변수 노출 방지를 위해 `sed 's/.*$/&<redacted>/'` 명령어를 사용하여 environment variable의 실제 값을 마스킹하는 구체적인 보안 접근법을 적용한다. 이를 통해 docker compose config 출력에서 민감한 정보가 로그에 노출되는 것을 효과적으로 방지한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#26
File: .github/workflows/docker-health-check.yml:0-0
Timestamp: 2025-07-11T17:05:46.311Z
Learning: 23MinL은 GitHub Actions 워크플로우에서 환경 변수 보안을 위해 sed를 활용한 <redacted> 처리를 통해 민감한 정보가 로그에 노출되는 것을 방지하는 proactive한 보안 접근법을 적용한다. 공개 리포지토리에서 DB 패스워드나 API 키 등의 중요 정보 유출을 사전에 차단하여 배포 안정성을 확보하는 것을 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-09T16:21:02.010Z
Learning: 23MinL은 FastAPI → Spring Boot → ALB 멀티 레이어 아키텍처에서 보안을 더욱 중요하게 고려하며, GitHub Actions 로그에서 환경변수를 완전히 마스킹하는 엄격한 보안 접근법을 적용한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#28
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-16T02:29:31.415Z
Learning: 23MinL은 GitHub Actions에서 appleboy/ssh-action 사용 시 secrets 값이 script 본문에 직접 참조되어 로그에 노출되는 보안 위험을 즉시 인식하고, secrets를 env 섹션으로 분리하여 스크립트 내에서 환경변수로 참조하는 방식으로 근본적 해결을 수행하는 proactive한 보안 접근법을 적용한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-09T15:05:42.278Z
Learning: 23MinL은 GitHub Actions CI/CD 파이프라인에서 보안을 최우선으로 고려하며, secrets 변수 처리 시 echo 대신 printf를 사용하여 로그 노출 위험을 최소화하는 보안 중심적 접근법을 적용한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#26
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-11T17:06:01.929Z
Learning: 23MinL은 CI/CD 파이프라인에서 환경 변수 보안 조치를 모든 환경(development, production)에 일관되게 적용하는 것을 중요하게 여긴다. GitHub Actions 로그에서 민감한 정보 노출을 방지하기 위해 sed 명령어를 사용한 값 마스킹 패턴을 동일하게 적용하여 보안 수준을 통일한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#28
File: .github/workflows/ci-cd.yml:19-23
Timestamp: 2025-07-16T02:53:49.222Z
Learning: 23MinL은 CI/CD 파이프라인의 테스트 잡에서 ENVIRONMENT=production 설정을 완전히 제거하여 테스트가 프로덕션 DB나 서비스에 접근하는 위험을 차단하는 것을 선호한다. 테스트 환경에서는 코드 내부 기본값을 사용하도록 하여 최대한 안전한 격리를 유지하는 보수적 보안 접근법을 적용한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/docker-health-check.yml:30-40
Timestamp: 2025-07-09T15:06:49.305Z
Learning: 23MinL은 GitHub Actions 워크플로우에서 의존성 관리 시 환경 가정보다 명시적 설치를 선호하며, 일관성 유지를 위해 curl 대신 Python requests를 사용하는 것을 선호한다. ubuntu-latest 환경의 불확실성을 고려하여 pip install --quiet 명령어를 통한 명시적 패키지 설치로 안정성을 확보하는 접근법을 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: .gitignore:53-58
Timestamp: 2025-07-04T14:43:24.632Z
Learning: 23MinL은 민감한 설정 파일(.env, config/, ssl/)을 메인 리포지토리에서 분리하여 별도의 private 리포지토리(Ururu-AI-Config)에서 관리하는 보안 중심 접근법을 사용한다. 이를 통해 메인 코드베이스와 민감한 설정을 분리하여 보안을 강화한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/product_tower_service.py:0-0
Timestamp: 2025-07-03T05:43:46.374Z
Learning: 23MinL은 12-Factor App 패턴을 적극적으로 활용하며, 환경변수 기반 설정 관리를 통해 개발/운영 환경 분리, Docker 배포 유연성, 보안 강화를 중요하게 고려한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: docker-compose.production.yml:15-27
Timestamp: 2025-07-04T14:43:46.253Z
Learning: 23MinL은 현재 요구사항을 만족하는 동시에 향후 확장성을 위한 사전 설정을 유지하는 것을 선호하며, 단계적 성장에 대비한 아키텍처 설계를 중요하게 고려한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/product_tower_service.py:87-89
Timestamp: 2025-07-03T06:22:37.053Z
Learning: 23MinL은 뷰티 용어 정규화에서 순서 최적화, 중복 방지(한번만 사용), 이미 변환된 텍스트 제외, 정규표현식 기반 단어 경계 매칭을 통해 정확성과 효율성을 동시에 확보하는 접근법을 선호한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/product_tower_service.py:87-89
Timestamp: 2025-07-03T06:22:37.053Z
Learning: 23MinL은 뷰티 용어 정규화에서 순서 최적화, 중복 방지(한번만 사용), 이미 변환된 텍스트 제외, 정규표현식 기반 단어 경계 매칭을 통해 정확성과 효율성을 동시에 확보하는 접근법을 선호한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/embedding_service.py:0-0
Timestamp: 2025-07-03T05:41:35.314Z
Learning: 23MinL은 Python 커뮤니티 표준 준수를 중요하게 여기며, 코드 가독성과 IDE 지원 향상을 위해 PEP 8 규칙을 적극적으로 따른다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/embedding_service.py:103-106
Timestamp: 2025-07-03T06:45:40.113Z
Learning: 23MinL은 초기 개발 단계에서 정확성보다 단순성과 의존성 최소화를 우선시하며, 단계별 최적화 접근법을 선호한다. 특히 한국어 텍스트 처리에서 보수적 제한을 통해 안전성을 확보한 후, 추후 성능 측정을 바탕으로 최적화를 진행하는 방식을 적용한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: Dockerfile:0-0
Timestamp: 2025-07-04T14:50:32.456Z
Learning: 23MinL은 Docker 컨테이너 환경에서 Gunicorn 워커 수를 환경변수로 구성하여 환경별 최적화를 수행하는 접근법을 선호한다. 리소스 제한과 일치하는 워커 수 설정을 통해 성능 최적화를 중요하게 고려한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: docker-compose.yml:0-0
Timestamp: 2025-07-04T14:50:16.061Z
Learning: 23MinL은 Docker Compose 설정에서 복잡한 health check보다는 단순한 depends_on 구조를 선호하며, 시스템 내부의 재시도 로직을 활용하여 안정성을 확보하는 실용적 접근법을 취한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: scripts/fetch-config.sh:5-9
Timestamp: 2025-07-04T14:44:01.189Z
Learning: 23MinL은 Docker 컨테이너 격리를 충분한 보안 수준으로 판단하며, 컨테이너 내부에서만 실행되는 민감한 작업(GitHub PAT 사용 등)에 대해서는 현재 구현 방식을 적절하다고 평가한다.

set -e
echo "🚀 FastAPI AI 서비스 배포 시작"

# 기존 컨테이너 상태 확인
if docker ps | grep ururu-ai-service; then
echo "📊 기존 AI 서비스 로그 확인"
docker logs --tail 10 ururu-ai-service
fi

# 작업 디렉토리 생성 및 이동
mkdir -p /home/ec2-user/ururu-ai
cd /home/ec2-user/ururu-ai

# 코드 업데이트 (올바른 디렉토리)
if [ ! -d ".git" ]; then
echo "📥 레포지토리 초기 클론"
git clone https://github.com/UruruLab/Ururu-AI.git .
else
echo "🔄 코드 업데이트"
git fetch origin
git checkout main
git reset --hard origin/main
fi

# Config 파일 복사 (중복 생성 제거)
echo "📝 Config 파일 사용"
if [ ! -f ".env.production" ]; then
echo "❌ .env.production 파일이 없습니다. Config 리포지토리에서 가져와야 합니다."
exit 1
fi

Comment on lines +143 to +130
Copy link

@coderabbitai coderabbitai bot Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

스크립트 내 환경변수 값이 GitHub Actions 로그에 노출됨

appleboy/ssh-action 은 전달된 script 본문을 그대로 워크플로 로그에 출력합니다.
따라서 아래 구간에서 ${{ secrets.SPRING_BOOT_PRIVATE_IP }} 값이 로그에 평문 출력되어 VPC 내부 IP가 노출됩니다. 이는 23MinL 님이 지속적으로 강조한 “로그에 환경변수 완전 마스킹” 원칙을 위반합니다.

-            cat > .env.production << EOF
+            # secrets 값 노출 방지를 위해 따옴표 보존(<< 'EOF') 및 런타임 치환 사용
+            cat > .env.production << 'EOF'
             ENVIRONMENT=production
             AI_PORT=8000
-            SPRING_BOOT_BASE_URL=http://${{ secrets.SPRING_BOOT_PRIVATE_IP }}:8080
+            SPRING_BOOT_BASE_URL=http://${SPRING_BOOT_PRIVATE_IP}:8080
             BUILD_TARGET=production
             EOF

추가로 SPRING_BOOT_PRIVATE_IP 를 secrets→환경변수 매핑(env:) 으로 전달하고, ssh-actionscript 에서는 $SPRING_BOOT_PRIVATE_IP 형식으로 참조하여 로그 노출을 근본 차단하세요.

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 154-154: trailing spaces

(trailing-spaces)


[error] 160-160: trailing spaces

(trailing-spaces)


[error] 172-172: trailing spaces

(trailing-spaces)


[error] 181-181: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/ci-cd.yml between lines 143 and 181, the script directly
inserts the secret SPRING_BOOT_PRIVATE_IP into the script body, causing it to be
exposed in the GitHub Actions logs. To fix this, move the SPRING_BOOT_PRIVATE_IP
secret into the ssh-action's env section and reference it inside the script
using the environment variable syntax ($SPRING_BOOT_PRIVATE_IP). This prevents
the secret from being printed in the logs while still allowing the script to use
the value securely.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPRING_BOOT_PRIVATE_IP secrets 추가 완료 + 환경변수 중복 문제 수정 완료

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@23MinL 빠른 수정 완료 감사합니다! 🎉

SPRING_BOOT_PRIVATE_IP secrets를 환경변수로 분리하여 GitHub Actions 로그 노출을 방지하고, 환경변수 중복 문제까지 해결해주셨네요. 이제 VPC 내부 IP가 워크플로 로그에 평문으로 노출되지 않아 보안이 강화되었습니다.

특히 appleboy/ssh-action에서 secrets를 env 섹션으로 분리하여 스크립트 내에서 환경변수로 참조하는 방식은 CI/CD 보안 모범 사례를 잘 적용한 사례입니다.


✏️ Learnings added
Learnt from: 23MinL
PR: UruruLab/Ururu-AI#28
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-16T02:29:31.415Z
Learning: 23MinL은 GitHub Actions에서 appleboy/ssh-action 사용 시 secrets 값이 script 본문에 직접 참조되어 로그에 노출되는 보안 위험을 즉시 인식하고, secrets를 env 섹션으로 분리하여 스크립트 내에서 환경변수로 참조하는 방식으로 근본적 해결을 수행하는 proactive한 보안 접근법을 적용한다.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-09T16:21:00.355Z
Learning: 23MinL은 GitHub Actions CI/CD 파이프라인에서 환경변수 보안을 최우선으로 고려하며, cat 명령어로 .env 파일 내용을 로그에 출력하는 것을 제거하여 민감 정보 노출을 방지하는 보안 중심적 접근법을 적용한다. 특히 FastAPI → Spring Boot → ALB 구조에서는 백엔드 연결 정보 보안을 더욱 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-09T15:52:13.709Z
Learning: 23MinL은 CI/CD 파이프라인 설계에서 현실적 제약을 고려한 하이브리드 접근법을 선호한다. GitHub Actions에서는 Docker 이미지 빌드/푸시와 설정 검증까지만 자동화하고, 실제 배포는 보안과 제어를 위해 수동으로 분리하는 방식을 적용한다. 배포 시뮬레이션과 명확한 가이드 제공을 통해 투명성과 실용성을 동시에 확보하는 것을 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#26
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-11T17:05:55.347Z
Learning: 23MinL은 GitHub Actions CI/CD 파이프라인에서 환경변수 노출 방지를 위해 `sed 's/.*$/&<redacted>/'` 명령어를 사용하여 environment variable의 실제 값을 마스킹하는 구체적인 보안 접근법을 적용한다. 이를 통해 docker compose config 출력에서 민감한 정보가 로그에 노출되는 것을 효과적으로 방지한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-09T16:21:02.010Z
Learning: 23MinL은 FastAPI → Spring Boot → ALB 멀티 레이어 아키텍처에서 보안을 더욱 중요하게 고려하며, GitHub Actions 로그에서 환경변수를 완전히 마스킹하는 엄격한 보안 접근법을 적용한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#26
File: .github/workflows/docker-health-check.yml:0-0
Timestamp: 2025-07-11T17:05:46.311Z
Learning: 23MinL은 GitHub Actions 워크플로우에서 환경 변수 보안을 위해 sed를 활용한 <redacted> 처리를 통해 민감한 정보가 로그에 노출되는 것을 방지하는 proactive한 보안 접근법을 적용한다. 공개 리포지토리에서 DB 패스워드나 API 키 등의 중요 정보 유출을 사전에 차단하여 배포 안정성을 확보하는 것을 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-09T15:05:42.278Z
Learning: 23MinL은 GitHub Actions CI/CD 파이프라인에서 보안을 최우선으로 고려하며, secrets 변수 처리 시 echo 대신 printf를 사용하여 로그 노출 위험을 최소화하는 보안 중심적 접근법을 적용한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#26
File: .github/workflows/ci-cd.yml:0-0
Timestamp: 2025-07-11T17:06:01.929Z
Learning: 23MinL은 CI/CD 파이프라인에서 환경 변수 보안 조치를 모든 환경(development, production)에 일관되게 적용하는 것을 중요하게 여긴다. GitHub Actions 로그에서 민감한 정보 노출을 방지하기 위해 sed 명령어를 사용한 값 마스킹 패턴을 동일하게 적용하여 보안 수준을 통일한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#19
File: .github/workflows/docker-health-check.yml:30-40
Timestamp: 2025-07-09T15:06:49.305Z
Learning: 23MinL은 GitHub Actions 워크플로우에서 의존성 관리 시 환경 가정보다 명시적 설치를 선호하며, 일관성 유지를 위해 curl 대신 Python requests를 사용하는 것을 선호한다. ubuntu-latest 환경의 불확실성을 고려하여 pip install --quiet 명령어를 통한 명시적 패키지 설치로 안정성을 확보하는 접근법을 중요하게 여긴다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: scripts/fetch-config.sh:5-9
Timestamp: 2025-07-04T14:44:01.189Z
Learning: 23MinL은 Docker 컨테이너 격리를 충분한 보안 수준으로 판단하며, 컨테이너 내부에서만 실행되는 민감한 작업(GitHub PAT 사용 등)에 대해서는 현재 구현 방식을 적절하다고 평가한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: .gitignore:53-58
Timestamp: 2025-07-04T14:43:24.632Z
Learning: 23MinL은 민감한 설정 파일(.env, config/, ssl/)을 메인 리포지토리에서 분리하여 별도의 private 리포지토리(Ururu-AI-Config)에서 관리하는 보안 중심 접근법을 사용한다. 이를 통해 메인 코드베이스와 민감한 설정을 분리하여 보안을 강화한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: docker-compose.production.yml:15-27
Timestamp: 2025-07-04T14:43:46.253Z
Learning: 23MinL은 현재 요구사항을 만족하는 동시에 향후 확장성을 위한 사전 설정을 유지하는 것을 선호하며, 단계적 성장에 대비한 아키텍처 설계를 중요하게 고려한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/product_tower_service.py:87-89
Timestamp: 2025-07-03T06:22:37.053Z
Learning: 23MinL은 뷰티 용어 정규화에서 순서 최적화, 중복 방지(한번만 사용), 이미 변환된 텍스트 제외, 정규표현식 기반 단어 경계 매칭을 통해 정확성과 효율성을 동시에 확보하는 접근법을 선호한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/product_tower_service.py:87-89
Timestamp: 2025-07-03T06:22:37.053Z
Learning: 23MinL은 뷰티 용어 정규화에서 순서 최적화, 중복 방지(한번만 사용), 이미 변환된 텍스트 제외, 정규표현식 기반 단어 경계 매칭을 통해 정확성과 효율성을 동시에 확보하는 접근법을 선호한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/embedding_service.py:0-0
Timestamp: 2025-07-03T05:41:35.314Z
Learning: 23MinL은 Python 커뮤니티 표준 준수를 중요하게 여기며, 코드 가독성과 IDE 지원 향상을 위해 PEP 8 규칙을 적극적으로 따른다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/embedding_service.py:103-106
Timestamp: 2025-07-03T06:45:40.113Z
Learning: 23MinL은 초기 개발 단계에서 정확성보다 단순성과 의존성 최소화를 우선시하며, 단계별 최적화 접근법을 선호한다. 특히 한국어 텍스트 처리에서 보수적 제한을 통해 안전성을 확보한 후, 추후 성능 측정을 바탕으로 최적화를 진행하는 방식을 적용한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: Dockerfile:0-0
Timestamp: 2025-07-04T14:50:32.456Z
Learning: 23MinL은 Docker 컨테이너 환경에서 Gunicorn 워커 수를 환경변수로 구성하여 환경별 최적화를 수행하는 접근법을 선호한다. 리소스 제한과 일치하는 워커 수 설정을 통해 성능 최적화를 중요하게 고려한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#13
File: docker-compose.yml:0-0
Timestamp: 2025-07-04T14:50:16.061Z
Learning: 23MinL은 Docker Compose 설정에서 복잡한 health check보다는 단순한 depends_on 구조를 선호하며, 시스템 내부의 재시도 로직을 활용하여 안정성을 확보하는 실용적 접근법을 취한다.

Learnt from: 23MinL
PR: UruruLab/Ururu-AI#8
File: app/services/product_tower_service.py:0-0
Timestamp: 2025-07-03T05:43:46.374Z
Learning: 23MinL은 12-Factor App 패턴을 적극적으로 활용하며, 환경변수 기반 설정 관리를 통해 개발/운영 환경 분리, Docker 배포 유연성, 보안 강화를 중요하게 고려한다.

If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

# Docker 컨테이너 배포
echo "🐳 Docker 컨테이너 배포"
cd docker/
docker compose -f docker-compose-ai-prod.yml down || true
docker compose -f docker-compose-ai-prod.yml up -d --build

echo "⏳ 서비스 시작 대기 중..."
sleep 30

# 헬스체크
echo "🔍 헬스체크 시작"
for i in {1..60}; do
if curl -f http://localhost:8000/health 2>/dev/null; then
echo "✅ FastAPI 서비스 헬스체크 통과"
break
fi
if [ $i -eq 60 ]; then
echo "❌ 헬스체크 실패"
docker logs --tail 20 ururu-ai-service
exit 1
fi
sleep 5
done

# 벡터 인덱스 상태 확인
echo "📊 벡터 인덱스 상태 확인"
VECTOR_STATUS=$(curl -s http://localhost:8000/api/vector/status | grep -o '"total_vectors":[0-9]*' | cut -d':' -f2 || echo "0")
echo "벡터 인덱스 상태: $VECTOR_STATUS 개 벡터"

# 임베딩 재생성 (필요시)
if [ "$VECTOR_STATUS" -lt 1000 ]; then
echo "🔄 벡터 인덱스 재생성 시작"
curl -X POST "http://localhost:8000/api/vector/embeddings/batch?batch_size=100&force_recreate=false" || echo "임베딩 재생성 요청 실패"
fi

echo "🎉 FastAPI AI 서비스 배포 완료"
echo "$(date): FastAPI AI 서비스 배포 완료 - commit: $GITHUB_SHA" >> /home/ec2-user/deployment.log

- name: Deployment Completion Notification
if: success()
- name: Deployment Notification
if: always()
run: |
echo "GitHub Actions deployment pipeline completed successfully."
echo "Docker image has been pushed to GitHub Container Registry."
echo "Manual execution required on EC2 server: docker compose pull && docker compose up -d"
if [ "${{ job.status }}" == "success" ]; then
echo "✅ FastAPI AI 서비스 배포 성공"
echo "🌐 AI 서비스: http://43.200.204.67:8000"
echo "📚 API 문서: http://43.200.204.67:8000/docs"
echo "🔗 Spring Boot 연동 준비 완료"
else
echo "❌ FastAPI AI 서비스 배포 실패"
echo "📝 로그 확인: docker logs ururu-ai-service"
fi

- name: Create Deployment Issue on Failure
if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Production AI Service Deployment Failed',
body: `## As Is (Current Issue)

Production AI service automated deployment has failed.

**Deployment Information:**
- Commit: ${context.sha}
- Branch: ${context.ref}
- Execution Time: ${new Date().toISOString()}
- Workflow: ${context.workflow}
## To Be (Expected Behavior)

AI service should be deployed successfully and available for frontend AI recommendation features.

## Deadline

Critical fix required within 1 hour

## References

- [Workflow Execution Log](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})
- [EC2 AI Service Status](http://3.39.69.34:8000/health)
- [AI API Documentation](http://3.39.69.34:8000/docs)
`,
labels: ['urgent', 'ai-service', 'deployment']
})
Loading