-
Notifications
You must be signed in to change notification settings - Fork 0
Fix/cloudrun deployment #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
5a5407a
feat: integrate korean book metadata and UI citations
SanghunYun95 8a01e1d
fix: apply coderabbit review suggestions
SanghunYun95 133442a
fix(backend): apply coderabbit review feedback for db and mapping scr…
SanghunYun95 43d1722
fix(backend): address additional coderabbit PR inline comments
SanghunYun95 0dd84a4
refactor(backend): use shared env parser and HTTPS for API
SanghunYun95 3057ad7
fix(backend): allow key rotation for all errors in book mapping
SanghunYun95 fc24774
feat: implement dynamic chat title and dynamic philosopher highlighting
SanghunYun95 cdbc817
fix: apply CodeRabbit PR review feedback
SanghunYun95 6c7566d
fix(pr): address CodeRabbit review feedback on backend tools and DB s…
SanghunYun95 78fc51a
chore: resolve merge conflicts
SanghunYun95 9de894d
fix(pr): address additional CodeRabbit comments
SanghunYun95 3d773d7
style: update welcome messages and input placeholder to be more gener…
SanghunYun95 4335bee
fix(pr): address additional CodeRabbit feedback for title truncation …
SanghunYun95 7298aac
UI: Remove redundant buttons (useful, copy, regenerate) from MessageList
SanghunYun95 30dd215
Merge branch 'main' into feat/book-metadata
SanghunYun95 ce91d6a
Refactor: apply CodeRabbit review suggestions
SanghunYun95 0bd1fcd
docs: rewrite README for interviewers
SanghunYun95 1196e30
docs, refactor: refine README and MessageList observer logic per PR c…
SanghunYun95 1b31b83
refactor: resolve observer unmount leak, Biome formatting, exhaustive…
SanghunYun95 e1ec3fc
fix: clear visibleMessages on unmount & use targeted eslint disable
SanghunYun95 36bd572
docs, refactor: disable philosopher filtering & update README examples
SanghunYun95 f13f327
refactor: apply PR refinements for mapping script and observers
SanghunYun95 1a9358b
Merge origin/main into feat/book-metadata (Resolve conflicts)
SanghunYun95 5d2841d
Fix: apply CodeRabbit feedback for React hooks and Tailwind
SanghunYun95 2584e3b
Feat: support multiple GEMINI_API_KEYS via comma-separated env var fo…
SanghunYun95 2395400
Fix: apply PR CodeRabbit round 8 feedback and add favicon
SanghunYun95 a0f719c
Fix: resolve conflicts and apply PR CodeRabbit round 9 feedback
SanghunYun95 789bdf4
Fix: apply PR CodeRabbit round 10 feedback
SanghunYun95 4c33094
Fix: apply PR CodeRabbit round 11 feedback
SanghunYun95 c9b0b91
Fix: apply PR CodeRabbit round 12 feedback
SanghunYun95 f24b224
fix(backend): preload models on startup and use async invokes to prev…
SanghunYun95 622a663
test: update mocks for refactored async llm/embedding functions
SanghunYun95 9eedd78
fix(pr): address lint, magic numbers, and use favicon for logo
SanghunYun95 4d878c2
fix(pr): resolve conflicts and add sizes prop to next/image
SanghunYun95 8495460
fix(backend): load models in background to prevent startup timeout on…
SanghunYun95 110049b
fix(backend): resolve conflict and apply PR feedback (timeouts, track…
SanghunYun95 105a59c
fix(backend): add graceful teardown for preload task on shutdown
SanghunYun95 7d918eb
feat(backend): add /ready endpoint and handle CancelledError in preload
SanghunYun95 382f90e
fix(backend): handle CancelledError properly in /ready readiness probe
SanghunYun95 1987897
fix(backend): lazy load ML models in chat routes to avoid Uvicorn sta…
SanghunYun95 f11491c
fix(backend): add error logging to /ready endpoint for better observa…
SanghunYun95 cad791b
refactor(backend): use else block for successful return in readiness …
SanghunYun95 e94fbe2
refactor(backend): use logger.warning in /ready, catch Exception in l…
SanghunYun95 359511c
Merge branch 'main' into feat/book-metadata and apply lifespan except…
SanghunYun95 f187cb1
fix: handle zero-chunk LLM responses, add prompt injection defense, a…
SanghunYun95 95be5fa
fix(backend): use HuggingFace Inference API for embeddings to resolve…
SanghunYun95 2c0f465
fix(backend): address CodeRabbit PR feedback for llm.py cleanup, chat…
SanghunYun95 bfe167c
fix: resolve merge conflicts and restore PR feedback fixes
SanghunYun95 9b00c6c
fix(backend): increase timeouts and add timing logs to debug latency
SanghunYun95 bba2528
fix: resolve merge conflicts and apply coderabbit feedback (timeout, …
SanghunYun95 ad7e026
refactor(backend): extract timeout constant and add semaphore for DB RPC
SanghunYun95 ff949ea
feat: migrate LLM service from Google Gemini to OpenAI (gpt-4o-mini)
SanghunYun95 d406f0b
fix: address PR feedback for chat timeouts and dependencies
SanghunYun95 e60cc1a
Merge main and address PR comments on logger formatting
SanghunYun95 1dc51b4
chore: update agent skills
SanghunYun95 13a7538
Merge branch 'main' into feat/migrate-to-openai
SanghunYun95 da4d56d
feat: add keep-alive GitHub Action
SanghunYun95 52b0474
feat: add keep-alive github action
SanghunYun95 98c26b9
chore: refactor keep-alive action based on review comments
SanghunYun95 2e2d75d
fix: increase keep-alive timeout to 120s and improve robustness
SanghunYun95 d77ef69
chore: resolve merge conflict in keep-alive workflow
SanghunYun95 a4f65e0
fix: adjust keep-alive endpoints for Render (GET required) and Supaba…
SanghunYun95 24c81d9
refactor: improve curl error handling in keep-alive action as suggest…
SanghunYun95 1ff42a1
merge: resolve conflict in keep-alive workflow by keeping fixed logic
SanghunYun95 c507e59
fix: chat input Enter behavior and remove keep-alive CronJob
SanghunYun95 37d655f
chore: resolve conflict by removing keep-alive cronjob (migrated to C…
SanghunYun95 19dba21
feat: optimize Philo-RAG data pipeline with 101 books and 31.8% effic…
SanghunYun95 5298f64
refactor: address CodeRabbit review comments (BOM removal, error hand…
SanghunYun95 14f1890
refactor: implement atomic failure handling in update_metadata.py
SanghunYun95 d5fa21d
refactor: improve metadata update atomicity using batch upsert
SanghunYun95 549a06e
Refactor: Update JSONB path syntax and optimize metadata update query
SanghunYun95 67f412f
feat: migrate infrastructure to GCP Cloud Run and Firebase Hosting
SanghunYun95 81a2a2c
fix: sync package-lock.json with package.json to fix build failure
SanghunYun95 2f1db46
Refactoring Philo-RAG: Robustness and Security improvements as per PR…
SanghunYun95 c0921d7
Merge main into feature/migrate-to-gcp and resolve conflicts in favor…
SanghunYun95 5f312a9
chore: revert to GCP_SA_KEY for GitHub Actions authentication
SanghunYun95 deace5d
chore: resolve merge conflicts and apply CodeRabbit PR feedback fixes…
SanghunYun95 84d0547
fix: Dockerfile build error by creating user before chown and updatin…
SanghunYun95 735b2f9
chore: resolve merge conflicts in Dockerfile and finalize CodeRabbit …
SanghunYun95 03b6db7
fix: switch to non-root user before pre-loading models in Dockerfile
SanghunYun95 a1c972c
chore: resolve merge conflicts in Dockerfile (fix user creation seque…
SanghunYun95 c0500ee
fix(backend): fix Cloud Run deployment by adding missing source code …
SanghunYun95 9f8bb52
chore: resolve merge conflicts and apply PR review feedback (Dockerfi…
SanghunYun95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Cloud Run Deployment Troubleshooting Report | ||
|
|
||
| The deployment failure in Google Cloud Run was caused by the application failing to start and listen on the expected port (8080) within the allocated timeout. | ||
|
|
||
| ## Root Cause Analysis | ||
|
|
||
| After investigating the `backend/Dockerfile`, I identified that the **source code was not being copied into the container**. The `Dockerfile` only included `COPY requirements.txt .`, which resulted in a container with all dependencies installed but missing the `app` directory and its logic. Consequently, `uvicorn` was unable to find `app.main:app`, causing the container to crash immediately or fail to bind to the port. | ||
|
|
||
| ## Changes Applied | ||
|
|
||
| ### 1. Update `backend/Dockerfile` | ||
| I modified the `Dockerfile` to include the following improvements: | ||
| - **Added `COPY . .`**: Ensured that the backend source code is properly included in the image. | ||
| - **Fixed Permissions**: Added a `chown` command to ensure the non-privileged `appuser` owns the application directory, preventing permission errors during runtime. | ||
| - **Improved Port Handling**: Updated the `CMD` to use the `${PORT}` environment variable provided by Cloud Run, with a fallback to `8080`. | ||
|
|
||
| ```dockerfile | ||
| # ... after pip install ... | ||
|
|
||
| # Copy source code and fix permissions | ||
| COPY . . | ||
| RUN chown -R appuser:appuser /app && \ | ||
| chmod 755 /app/model_cache | ||
|
|
||
| # ... | ||
|
|
||
| # Command to run the application using the PORT environment variable | ||
| CMD ["sh", "-c", "exec uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8080} --proxy-headers"] | ||
| ``` | ||
|
|
||
| ## Next Steps | ||
| 1. **Commit the changes**: The fixed `Dockerfile` is now ready to be pushed to the repository. | ||
| 2. **Re-run the GitHub Action**: PR을 `main` 브랜치에 머지(merge)하면 GitHub Actions 워크플로우가 트리거됩니다. | ||
|
|
||
| > [!TIP] | ||
| > Once the deployment is successful, you can verify the status through the Cloud Run URL or the readiness check endpoint: `/ready`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| __pycache__/ | ||
| *.pyc | ||
| *.pyo | ||
| *.pyd | ||
| .Python | ||
| env/ | ||
| .env | ||
| .venv/ | ||
| pip-log.txt | ||
| pip-delete-this-directory.txt | ||
| .tox/ | ||
| .coverage | ||
| .coverage.* | ||
| .cache | ||
| nosetests.xml | ||
| coverage.xml | ||
| *,cover | ||
| .hypothesis/ | ||
| .pytest_cache/ | ||
| .vscode/ | ||
| .idea/ | ||
| .git/ | ||
| .github/ | ||
| README.md | ||
| requirements-dev.txt | ||
| pytest.ini | ||
| pytest_log.txt | ||
| pytest_log_utf8.txt | ||
| update_metadata.sql | ||
| verify_and_clear.py | ||
| download_books.py | ||
| check_progress.py | ||
| data/ | ||
| tests/ | ||
| scripts/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.