fix(docker): Docker 배포 설정 오류 수정#49
Conversation
- Pull Request: develop → main - First stable version ready for production
- rag pipeline fastapi에서 처리 - langchain과 결합 - elasticsearch 데이터 저장 for(keyword, vector)
- 백엔드에서는 rag 검색만 진행 - 키워드(파일원본,제목,본문)검색+백터검색 3/7 - unstructed io 관련설정 제거
- Dockerfile 베이스 이미지 변경 (openjdk:21-slim -> eclipse-temurin:21-jre-jammy) - application-docker.yml에서 localhost를 Docker 서비스명으로 변경 - DB 자격증명을 docker-compose.yml과 일치시킴 (user/password) - MinIO secret-key를 docker-compose.yml과 일치시킴 - 임베딩 모델을 bge-m3:latest로 통일 - profile-specific 파일에서 spring.profiles.active 제거 - IDE 및 빌드 아티팩트를 .gitignore에 추가 Closes #48
|
악.. 트롤짓 커버 감사합니다람쥐 |
There was a problem hiding this comment.
Pull request overview
This PR fixes Docker deployment configuration errors (Issue #48) by updating base images, migrating to a Python FastAPI-based RAG service, and correcting environment configurations for container networking.
- Replaces non-existent
openjdk:21-slimwitheclipse-temurin:21-jre-jammy - Implements new Python RAG service with FastAPI, replacing direct Elasticsearch/Ollama integration in Java
- Updates service URLs from localhost to Docker service names (postgres, elasticsearch, ollama, minio)
Reviewed changes
Copilot reviewed 38 out of 63 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| core/Dockerfile | Updates base image to eclipse-temurin:21-jre-jammy |
| docker-compose.yml | Adds RAG service, updates model to bge-m3:latest, removes unstructured-api |
| core/src/main/resources/application-docker.yml | Configures service URLs for Docker networking, adds RAG service URL |
| core/src/main/resources/application.yml | Updates local dev config with RAG service URL |
| core/src/main/java/com/opencontext/controller/SourceController.java | Integrates RAG service via REST API |
| core/src/main/java/com/opencontext/service/FileStorageService.java | Adds presigned URL generation for MinIO |
| core/src/main/java/com/opencontext/config/SecurityConfig.java | Disables API key authentication (security risk) |
| rag/* | Complete Python FastAPI RAG service implementation |
| .gitignore | Adds .cursor/, .gradle-user-home/, pycache/ |
| rag/**/pycache/* | Python cache files incorrectly committed |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| app.add_middleware( | ||
| CORSMiddleware, | ||
| allow_origins=["*"], # In production, restrict to specific origins |
There was a problem hiding this comment.
The CORS middleware is configured to allow all origins ("*") with credentials enabled. This is a security risk in production as it allows any website to make authenticated requests to the API. Consider restricting allowed origins to specific domains or making this configurable via environment variables.
| hibernate: | ||
| ddl-auto: validate | ||
| show-sql: true | ||
| ddl-auto: update |
There was a problem hiding this comment.
The ddl-auto setting has been changed from 'validate' to 'update' in the Docker configuration. This allows Hibernate to automatically modify the database schema, which can be dangerous in production as it may lead to unintended schema changes or data loss. Consider using 'validate' with proper Flyway migrations or making this environment-specific.
| ddl-auto: update | |
| ddl-auto: validate |
| # Flyway Configuration (Docker) | ||
| # Flyway Configuration | ||
| flyway: | ||
| baseline-on-migrate: true |
There was a problem hiding this comment.
The Flyway configuration locations and validate-on-migrate settings have been removed. This removes important database migration validation and could lead to deployment issues if migrations are not properly tracked. These settings should be retained to ensure database schema consistency.
| baseline-on-migrate: true | |
| baseline-on-migrate: true | |
| locations: classpath:db/migration | |
| validate-on-migrate: true |
| if settings.elasticsearch_url.startswith("https"): | ||
| client_params["verify_certs"] = settings.elasticsearch_verify_certs | ||
| if not settings.elasticsearch_verify_certs: | ||
| # Suppress SSL warnings in development | ||
| import urllib3 | ||
| urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
There was a problem hiding this comment.
The elasticsearch_verify_certs configuration defaults to True but SSL warnings are disabled when set to False. This suppresses important security warnings in development. Consider logging a warning message instead of completely disabling urllib3 warnings, so other security issues aren't masked.
| @app.exception_handler(Exception) | ||
| async def general_exception_handler(request: Request, exc: Exception): | ||
| """Handle unexpected exceptions.""" | ||
| logger.error(f"Unexpected error: {str(exc)}", exc_info=True) | ||
| return JSONResponse( | ||
| status_code=500, | ||
| content={"detail": "Internal server error"} | ||
| ) |
There was a problem hiding this comment.
The error handler catches all exceptions and returns a generic "Internal server error" message without logging the full exception details for security. However, this makes debugging production issues difficult. Consider adding a request ID to the response and logging it with full exception details server-side for troubleshooting.
| import logging | ||
|
|
||
| from app.config.settings import settings | ||
| from app.utils.exceptions import RagServiceException, rag_exception_handler |
There was a problem hiding this comment.
Import of 'rag_exception_handler' is not used.
| Internal API called by core/ service after file upload. | ||
| """ | ||
| import logging | ||
| from fastapi import APIRouter, HTTPException |
There was a problem hiding this comment.
Import of 'HTTPException' is not used.
| from fastapi import APIRouter, HTTPException | |
| from fastapi import APIRouter |
| from app.models.responses import ProcessResponse | ||
| from app.services.parsing import DocumentParsingService | ||
| from app.services.chunking import ChunkingService | ||
| from app.services.embedding import EmbeddingService |
There was a problem hiding this comment.
Import of 'EmbeddingService' is not used.
| from app.services.embedding import EmbeddingService |
| from app.services.parsing import DocumentParsingService | ||
| from app.services.chunking import ChunkingService | ||
| from app.services.embedding import EmbeddingService | ||
| from app.services.indexing import IndexingService |
There was a problem hiding this comment.
Import of 'IndexingService' is not used.
| from app.services.indexing import IndexingService |
| Provides accurate token counting for content retrieval with truncation support. | ||
| """ | ||
| import tiktoken | ||
| from typing import Optional |
There was a problem hiding this comment.
Import of 'Optional' is not used.
요약
Issue #48에서 보고된 Docker 환경 설정 오류를 수정했습니다.
변경 사항
1. Dockerfile 베이스 이미지 변경
openjdk:21-slim(존재하지 않음) ->eclipse-temurin:21-jre-jammy2. application-docker.yml 수정
3. docker-compose.yml 수정
bge-m3:latest로 통일 (PR Feature/rag/#37 #46 설명과 일치)4. .gitignore 추가
.cursor/(IDE).gradle-user-home/(Gradle 캐시)__pycache__/,*.pyc,*.pyo(Python 캐시)테스트
관련 이슈
Closes #48