Skip to content
Merged
Show file tree
Hide file tree
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 Mar 2, 2026
8a01e1d
fix: apply coderabbit review suggestions
SanghunYun95 Mar 2, 2026
133442a
fix(backend): apply coderabbit review feedback for db and mapping scr…
SanghunYun95 Mar 2, 2026
43d1722
fix(backend): address additional coderabbit PR inline comments
SanghunYun95 Mar 2, 2026
0dd84a4
refactor(backend): use shared env parser and HTTPS for API
SanghunYun95 Mar 3, 2026
3057ad7
fix(backend): allow key rotation for all errors in book mapping
SanghunYun95 Mar 3, 2026
fc24774
feat: implement dynamic chat title and dynamic philosopher highlighting
SanghunYun95 Mar 3, 2026
cdbc817
fix: apply CodeRabbit PR review feedback
SanghunYun95 Mar 3, 2026
6c7566d
fix(pr): address CodeRabbit review feedback on backend tools and DB s…
SanghunYun95 Mar 3, 2026
78fc51a
chore: resolve merge conflicts
SanghunYun95 Mar 3, 2026
9de894d
fix(pr): address additional CodeRabbit comments
SanghunYun95 Mar 3, 2026
3d773d7
style: update welcome messages and input placeholder to be more gener…
SanghunYun95 Mar 3, 2026
4335bee
fix(pr): address additional CodeRabbit feedback for title truncation …
SanghunYun95 Mar 3, 2026
7298aac
UI: Remove redundant buttons (useful, copy, regenerate) from MessageList
SanghunYun95 Mar 3, 2026
30dd215
Merge branch 'main' into feat/book-metadata
SanghunYun95 Mar 3, 2026
ce91d6a
Refactor: apply CodeRabbit review suggestions
SanghunYun95 Mar 3, 2026
0bd1fcd
docs: rewrite README for interviewers
SanghunYun95 Mar 3, 2026
1196e30
docs, refactor: refine README and MessageList observer logic per PR c…
SanghunYun95 Mar 3, 2026
1b31b83
refactor: resolve observer unmount leak, Biome formatting, exhaustive…
SanghunYun95 Mar 3, 2026
e1ec3fc
fix: clear visibleMessages on unmount & use targeted eslint disable
SanghunYun95 Mar 3, 2026
36bd572
docs, refactor: disable philosopher filtering & update README examples
SanghunYun95 Mar 3, 2026
f13f327
refactor: apply PR refinements for mapping script and observers
SanghunYun95 Mar 3, 2026
1a9358b
Merge origin/main into feat/book-metadata (Resolve conflicts)
SanghunYun95 Mar 3, 2026
5d2841d
Fix: apply CodeRabbit feedback for React hooks and Tailwind
SanghunYun95 Mar 3, 2026
2584e3b
Feat: support multiple GEMINI_API_KEYS via comma-separated env var fo…
SanghunYun95 Mar 4, 2026
2395400
Fix: apply PR CodeRabbit round 8 feedback and add favicon
SanghunYun95 Mar 4, 2026
a0f719c
Fix: resolve conflicts and apply PR CodeRabbit round 9 feedback
SanghunYun95 Mar 4, 2026
789bdf4
Fix: apply PR CodeRabbit round 10 feedback
SanghunYun95 Mar 4, 2026
4c33094
Fix: apply PR CodeRabbit round 11 feedback
SanghunYun95 Mar 4, 2026
c9b0b91
Fix: apply PR CodeRabbit round 12 feedback
SanghunYun95 Mar 4, 2026
f24b224
fix(backend): preload models on startup and use async invokes to prev…
SanghunYun95 Mar 4, 2026
622a663
test: update mocks for refactored async llm/embedding functions
SanghunYun95 Mar 4, 2026
9eedd78
fix(pr): address lint, magic numbers, and use favicon for logo
SanghunYun95 Mar 4, 2026
4d878c2
fix(pr): resolve conflicts and add sizes prop to next/image
SanghunYun95 Mar 4, 2026
8495460
fix(backend): load models in background to prevent startup timeout on…
SanghunYun95 Mar 5, 2026
110049b
fix(backend): resolve conflict and apply PR feedback (timeouts, track…
SanghunYun95 Mar 5, 2026
105a59c
fix(backend): add graceful teardown for preload task on shutdown
SanghunYun95 Mar 5, 2026
7d918eb
feat(backend): add /ready endpoint and handle CancelledError in preload
SanghunYun95 Mar 5, 2026
382f90e
fix(backend): handle CancelledError properly in /ready readiness probe
SanghunYun95 Mar 5, 2026
1987897
fix(backend): lazy load ML models in chat routes to avoid Uvicorn sta…
SanghunYun95 Mar 5, 2026
f11491c
fix(backend): add error logging to /ready endpoint for better observa…
SanghunYun95 Mar 5, 2026
cad791b
refactor(backend): use else block for successful return in readiness …
SanghunYun95 Mar 5, 2026
e94fbe2
refactor(backend): use logger.warning in /ready, catch Exception in l…
SanghunYun95 Mar 5, 2026
359511c
Merge branch 'main' into feat/book-metadata and apply lifespan except…
SanghunYun95 Mar 5, 2026
f187cb1
fix: handle zero-chunk LLM responses, add prompt injection defense, a…
SanghunYun95 Mar 5, 2026
95be5fa
fix(backend): use HuggingFace Inference API for embeddings to resolve…
SanghunYun95 Mar 6, 2026
2c0f465
fix(backend): address CodeRabbit PR feedback for llm.py cleanup, chat…
SanghunYun95 Mar 6, 2026
bfe167c
fix: resolve merge conflicts and restore PR feedback fixes
SanghunYun95 Mar 6, 2026
9b00c6c
fix(backend): increase timeouts and add timing logs to debug latency
SanghunYun95 Mar 6, 2026
bba2528
fix: resolve merge conflicts and apply coderabbit feedback (timeout, …
SanghunYun95 Mar 6, 2026
ad7e026
refactor(backend): extract timeout constant and add semaphore for DB RPC
SanghunYun95 Mar 6, 2026
ff949ea
feat: migrate LLM service from Google Gemini to OpenAI (gpt-4o-mini)
SanghunYun95 Mar 6, 2026
d406f0b
fix: address PR feedback for chat timeouts and dependencies
SanghunYun95 Mar 6, 2026
e60cc1a
Merge main and address PR comments on logger formatting
SanghunYun95 Mar 6, 2026
1dc51b4
chore: update agent skills
SanghunYun95 Mar 25, 2026
13a7538
Merge branch 'main' into feat/migrate-to-openai
SanghunYun95 Mar 25, 2026
da4d56d
feat: add keep-alive GitHub Action
SanghunYun95 Mar 25, 2026
52b0474
feat: add keep-alive github action
SanghunYun95 Mar 25, 2026
98c26b9
chore: refactor keep-alive action based on review comments
SanghunYun95 Mar 25, 2026
2e2d75d
fix: increase keep-alive timeout to 120s and improve robustness
SanghunYun95 Mar 25, 2026
d77ef69
chore: resolve merge conflict in keep-alive workflow
SanghunYun95 Mar 25, 2026
a4f65e0
fix: adjust keep-alive endpoints for Render (GET required) and Supaba…
SanghunYun95 Mar 25, 2026
24c81d9
refactor: improve curl error handling in keep-alive action as suggest…
SanghunYun95 Mar 25, 2026
1ff42a1
merge: resolve conflict in keep-alive workflow by keeping fixed logic
SanghunYun95 Mar 25, 2026
c507e59
fix: chat input Enter behavior and remove keep-alive CronJob
SanghunYun95 Mar 26, 2026
37d655f
chore: resolve conflict by removing keep-alive cronjob (migrated to C…
SanghunYun95 Mar 26, 2026
19dba21
feat: optimize Philo-RAG data pipeline with 101 books and 31.8% effic…
SanghunYun95 Mar 28, 2026
5298f64
refactor: address CodeRabbit review comments (BOM removal, error hand…
SanghunYun95 Mar 28, 2026
14f1890
refactor: implement atomic failure handling in update_metadata.py
SanghunYun95 Mar 28, 2026
d5fa21d
refactor: improve metadata update atomicity using batch upsert
SanghunYun95 Mar 28, 2026
549a06e
Refactor: Update JSONB path syntax and optimize metadata update query
SanghunYun95 Mar 28, 2026
67f412f
feat: migrate infrastructure to GCP Cloud Run and Firebase Hosting
SanghunYun95 Mar 28, 2026
81a2a2c
fix: sync package-lock.json with package.json to fix build failure
SanghunYun95 Mar 28, 2026
2f1db46
Refactoring Philo-RAG: Robustness and Security improvements as per PR…
SanghunYun95 Mar 28, 2026
c0921d7
Merge main into feature/migrate-to-gcp and resolve conflicts in favor…
SanghunYun95 Mar 28, 2026
5f312a9
chore: revert to GCP_SA_KEY for GitHub Actions authentication
SanghunYun95 Mar 28, 2026
deace5d
chore: resolve merge conflicts and apply CodeRabbit PR feedback fixes…
SanghunYun95 Mar 28, 2026
84d0547
fix: Dockerfile build error by creating user before chown and updatin…
SanghunYun95 Mar 28, 2026
735b2f9
chore: resolve merge conflicts in Dockerfile and finalize CodeRabbit …
SanghunYun95 Mar 28, 2026
03b6db7
fix: switch to non-root user before pre-loading models in Dockerfile
SanghunYun95 Mar 28, 2026
a1c972c
chore: resolve merge conflicts in Dockerfile (fix user creation seque…
SanghunYun95 Mar 28, 2026
c0500ee
fix(backend): fix Cloud Run deployment by adding missing source code …
SanghunYun95 Mar 29, 2026
9f8bb52
chore: resolve merge conflicts and apply PR review feedback (Dockerfi…
SanghunYun95 Mar 29, 2026
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
36 changes: 36 additions & 0 deletions analysis_results.md
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 워크플로우가 트리거됩니다.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
> [!TIP]
> Once the deployment is successful, you can verify the status through the Cloud Run URL or the readiness check endpoint: `/ready`.
35 changes: 35 additions & 0 deletions backend/.dockerignore
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/
14 changes: 9 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ RUN pip install --no-cache-dir -r requirements.txt

# Create a non-privileged user first so we can use it for directory ownership
RUN adduser --disabled-password --gecos "" appuser && \
mkdir -p /app/model_cache && \
chown -R appuser:appuser /app && \
mkdir -p /app/model_cache

# Copy source code and fix permissions
COPY . .
RUN chown -R appuser:appuser /app && \
chmod 755 /app/model_cache

ENV HF_HOME=/app/model_cache
Expand All @@ -33,8 +36,9 @@ USER appuser
# This runs as 'appuser', matching the runtime environment
RUN python -c "from langchain_huggingface import HuggingFaceEmbeddings; HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L6-v2', model_kwargs={'device': 'cpu'})"

# Expose the port
# Expose the port (Cloud Run defaults to 8080, but can be overridden by $PORT)
EXPOSE 8080

# Command to run the application (0.0.0.0 for Cloud Run)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--proxy-headers"]
# Command to run the application using the PORT environment variable with exec form
# We use exec to ensure uvicorn becomes the PID 1 process and handles termination signals properly
CMD ["sh", "-c", "exec uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8080} --proxy-headers"]
12 changes: 11 additions & 1 deletion backend/app/core/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
from pydantic import Field, AliasChoices
from pydantic_settings import BaseSettings, SettingsConfigDict

class Settings(BaseSettings):
Expand All @@ -9,7 +10,10 @@ class Settings(BaseSettings):

# Supabase Settings
SUPABASE_URL: str = ""
SUPABASE_SERVICE_KEY: str = "" # Use Service Role Key for backend operations
SUPABASE_SERVICE_KEY: str = Field(
"",
validation_alias=AliasChoices("SUPABASE_SERVICE_KEY", "SUPABASE_SERVICE_ROLE_KEY")
) # Use Service Role Key for backend operations
Comment thread
coderabbitai[bot] marked this conversation as resolved.

model_config = SettingsConfigDict(
env_file=str(Path(__file__).resolve().parents[3] / ".env"),
Expand All @@ -18,3 +22,9 @@ class Settings(BaseSettings):
)

settings = Settings()

# Fail-fast validation: ensure essential secrets are configured at startup
if not settings.SUPABASE_URL or not settings.SUPABASE_SERVICE_KEY:
raise RuntimeError(
"SUPABASE_URL and SUPABASE_SERVICE_KEY (or SUPABASE_SERVICE_ROLE_KEY) must be configured in environment variables."
)