Skip to content

Fix/cloudrun deployment#33

Merged
SanghunYun95 merged 83 commits intomainfrom
fix/cloudrun-deployment
Mar 29, 2026
Merged

Fix/cloudrun deployment#33
SanghunYun95 merged 83 commits intomainfrom
fix/cloudrun-deployment

Conversation

@SanghunYun95
Copy link
Copy Markdown
Owner

@SanghunYun95 SanghunYun95 commented Mar 29, 2026

Summary by CodeRabbit

릴리스 노트

  • 버그 수정

    • Cloud Run 배포 신뢰성 개선: 앱이 지정된 포트에서 시작하도록 수정하고 포트 환경 변수 우선 사용을 지원합니다.
    • 권한 및 실행 오류 해결: 비권한 사용자로도 서비스가 정상적으로 실행되도록 파일/디렉터리 권한 문제를 고쳤습니다.
    • 시작 시 필수 설정 누락 시 빠르게 실패하도록 검증을 강화했습니다.
  • Chores

    • 도커 이미지 빌드 최적화: 빌드에 불필요한 파일 제외 및 소스 포함 방식을 개선했습니다.

… (deploy.yml, Dockerfile, ingest_data.py, update_metadata.py)
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
philo-rag Ready Ready Preview, Comment Mar 29, 2026 0:51am

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f3efac91-c0c0-472a-a366-c880c985c925

📥 Commits

Reviewing files that changed from the base of the PR and between c0500ee and 9f8bb52.

📒 Files selected for processing (4)
  • analysis_results.md
  • backend/.dockerignore
  • backend/Dockerfile
  • backend/app/core/config.py
✅ Files skipped from review due to trivial changes (2)
  • backend/.dockerignore
  • analysis_results.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/Dockerfile

📝 Walkthrough

Walkthrough

Cloud Run 배포 실패 원인(컨테이너가 8080 포트에 바인드하지 못함)을 분석한 문서를 추가하고, Dockerfile을 수정해 애플리케이션 소스 복사(COPY . .), 비특권 사용자 권한 및 /app/model_cache 권한 설정, 그리고 런타임에서 ${PORT} 환경변수 기반 포트 바인딩을 적용했습니다. 또한 .dockerignore를 추가하고 Supabase 서비스 키에 환경변수 별칭을 허용하도록 설정을 변경했습니다.

Changes

Cohort / File(s) Summary
Docker 빌드/런타임
backend/Dockerfile, backend/.dockerignore
전체 소스 복사(COPY . .) 추가, appuser 소유권(chown) 및 /app/model_cache 권한 설정(chmod), 런타임 커맨드를 uvicorn ... --port ${PORT:-8080} 형태로 변경. .dockerignore로 빌드 캐시·편집기·테스트·데이터 파일 제외 패턴 추가.
설정/검증 변경
backend/app/core/config.py
SUPABASE_SERVICE_KEY 필드를 Pydantic Field로 변경하며 AliasChoices("SUPABASE_SERVICE_KEY", "SUPABASE_SERVICE_ROLE_KEY")를 허용. 앱 시작 시 SUPABASE_URL 또는 서비스 키 누락시 즉시 RuntimeError로 실패하도록 검증 추가.
문서(트러블슈팅)
analysis_results.md
Cloud Run 배포 실패 조사 결과 및 원인(소스 미복사로 인한 uvicorn 모듈 불가 및 포트 바인딩 실패)과 적용한 Docker 수정 사항 기록.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 컨테이너 속 포트에 귀 기울이며,
소스 한 점 놓치던 밤을 지나
복사하고 권한 나누니 우당탕 아닌 우아한 시작,
Cloud Run 위에서 살며시 뛰노는 나의 앱,
당근 한 입과 함께 축하하노라 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목 'Fix/cloudrun deployment'은 주요 변경 사항인 Cloud Run 배포 문제 해결을 반영하지만, 'Fix'는 구체성이 부족하여 실제 문제(Docker 설정 및 환경 변수)를 명확히 드러내지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cloudrun-deployment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@analysis_results.md`:
- Around line 32-34: 문구 "`main`에 push"가 직접 푸시로 오해될 수 있으므로 문장을 명확히 수정하세요: "PR을
main 브랜치에 머지(merge)하면 GitHub Actions 워크플로우가 트리거됩니다" 또는 "PR 머지 후 main에 병합될 때
워크플로우가 실행됩니다"처럼 PR 머지 기준으로 동작을 분명히 설명하도록 변경하고, 해당 문구를 포함한 문장(현재 "`main`에 push"
텍스트)을 찾아 "PR 머지" 또는 "병합 시 트리거" 표현으로 대체하세요.

In `@backend/.dockerignore`:
- Around line 36-39: The .dockerignore currently re-includes operational scripts
via the negation rules for scripts/ingest_all_data.py, scripts/ingest_data.py,
scripts/update_db_metadata.py and scripts/update_metadata.py, which causes
non-runtime tooling to be copied into production images; remove the four
negation lines (or replace them with an explicit exclude of the entire scripts/
directory and only allow specific runtime entrypoints if any) so that scripts/
is excluded from the production image, or alternatively move these operational
scripts into a separate tooling/ directory and ensure .dockerignore excludes
that directory; update the .dockerignore rules accordingly to prevent
re-including those filenames.

In `@backend/app/core/config.py`:
- Around line 13-16: The SUPABASE_SERVICE_KEY Field currently has a default
empty string which delays missing-secret failures to runtime; update the Field
in core.config so the value is required at startup (e.g., replace the "" default
with a required sentinel like ... or add a pydantic validator that raises if
SUPABASE_SERVICE_KEY is empty) and keep the
AliasChoices("SUPABASE_SERVICE_KEY","SUPABASE_SERVICE_ROLE_KEY") alias; ensure
the change triggers a fast-fail on app start (so services/database.py will not
proceed with a missing key).

In `@backend/Dockerfile`:
- Around line 42-44: The current Docker CMD uses "sh -c" without exec causing
the shell to remain PID 1 and potentially intercept termination signals; update
the CMD so uvicorn becomes the PID 1 process by using an exec form inside the
shell: replace the existing CMD invocation with a form that runs "sh -c" but
prefixes the uvicorn command with exec (e.g., CMD ["sh", "-c", "exec uvicorn
app.main:app --host 0.0.0.0 --port ${PORT:-8080} --proxy-headers"]) so the shell
expands ${PORT:-8080} and then replaces itself with the uvicorn process to
ensure proper SIGTERM delivery.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f9e39e4-12d9-4c95-9220-556812fed563

📥 Commits

Reviewing files that changed from the base of the PR and between c330a3d and c0500ee.

📒 Files selected for processing (4)
  • analysis_results.md
  • backend/.dockerignore
  • backend/Dockerfile
  • backend/app/core/config.py

Comment thread analysis_results.md
Comment thread backend/.dockerignore Outdated
Comment thread backend/app/core/config.py
Comment thread backend/Dockerfile Outdated
…le exec, fail-fast config, .dockerignore cleanup)
@SanghunYun95 SanghunYun95 merged commit f3171a3 into main Mar 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant