feat(lps): docker-compose 에 lps-admin 추가 + 환경설정 config.local.toml 단일화

- lps-admin 컨테이너화: Vite 정적 빌드 → nginx, /v1·/healthz·/readyz 를
  lps-api:9600 으로 동일출처 프록시(빌드 타임 API URL 주입 불필요)
- lps-api/worker: APP_ENV=local 고정 + DB_HOST override(도메인 backend·negodata·agent
  와 동일 패턴), config.<env>.toml 마운트 방식 폐기
- server_configs 에 DB 접속 env override(_apply_db_env_override) 복원
- config.dev/prod.toml.example 제거 — 환경 구분 없이 config.local.toml 하나
  (prod 서버도 그 서버의 config.local.toml + docker compose up -d)
- run_docker.sh 환경 선택 제거·lps-admin 포함, README·operations 문서 갱신

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
민헌andClaude Opus 4.8 committed 2026-07-16 11:54:32 +09:00
1 parent d111610555
commit dc8c288f68
10 files changed
+188 -230

No files matched your search

+30 -17
View File
@@ -9,6 +9,8 @@
# negodata 서버: http://localhost:9400/docs
# agent 서버: http://localhost:9500/docs
# anchoring 배치: 포트 없음 — 상주 스케줄러(격주 토 00:00 KST), docker logs anchoring 으로 확인
# lps API: http://localhost:9600/docs
# lps admin: http://localhost:3400 (nginx → /v1·/healthz 는 lps-api 로 프록시)
#
# DB 준비(최초 1회): postgres-init 의 SQL 을 대상 DB 에 적용한다.
# psql -h <host> -p <port> -U <user> -f postgres-init/00-init.sql (스키마 전체: negosium_db + 도메인·learning·anchoring schema)
@@ -118,26 +120,20 @@ services:
max-size: "10m"
max-file: "5"
# ── LPS (인터넷 최저가 검색) ──────────────────────────────────
# API(요청 접수, lean) + 워커(크롤, 헤드풀 Chromium+Xvfb). DB 는 외부(host.docker.internal).
# ── 설정은 TOML 하나(2026-07-13 협의 — .env/env 주입 제거) ──
# 환경(dev/prod)은 APP_ENV 로 선택: ./lps/config/config.<APP_ENV>.toml(미커밋, example 복사)을 마운트해 읽는다.
# 실행은 ./lps/run_docker.sh(대화형) 권장 — 설정 파일 검증·prod 안전장치까지 처리.
# 이미지에는 시크릿이 없고, 마운트를 잊으면 기동 시 FileNotFoundError 로 즉시 실패한다.
# 값 변경 = toml 수정 + docker compose restart (스케일·알림·guard 키 전부 toml 섹션에서).
# LPS API (인터넷 최저가 검색 — 요청 접수/조회, lean). 설정·시크릿은 config.local.toml 하나(미커밋, 마운트).
lps-api:
build:
context: ./lps
dockerfile: Dockerfile
container_name: lps-api
environment:
APP_ENV: ${APP_ENV:-dev}
APP_ENV: local
DB_HOST: ${LPS_DB_HOST-host.docker.internal} # 컨테이너→호스트 DB (config.local.toml 의 127.0.0.1 override)
PYTHONUNBUFFERED: "1"
volumes:
- ./lps/config/config.${APP_ENV:-dev}.toml:/app/config/config.${APP_ENV:-dev}.toml:ro
- ./lps/config/config.local.toml:/app/config/config.local.toml:ro
ports:
# prod 는 LPS_API_BIND=127.0.0.1 로 호스트 내부(리버스프록시)만 접근 허용(run_docker.sh 가 자동 설정)
- "${LPS_API_BIND:-0.0.0.0}:9600:9600"
- "${LPS_API_BIND:-0.0.0.0}:9600:9600" # prod 는 LPS_API_BIND=127.0.0.1 로 내부만 개방(리버스프록시 뒤)
extra_hosts:
- "host.docker.internal:host-gateway"
labels:
@@ -147,23 +143,40 @@ services:
driver: json-file
options: { max-size: "10m", max-file: "5" }
# LPS 워커 (크롤 — 헤드풀 Chromium+Xvfb, headless 는 안티봇에 탐지됨). config.local.toml 공유.
lps-worker:
build:
context: ./lps
dockerfile: Dockerfile.worker # Chromium + Xvfb (headless 는 안티봇에 탐지됨)
dockerfile: Dockerfile.worker
container_name: lps-worker
environment:
APP_ENV: ${APP_ENV:-dev} # → 마운트된 config.<APP_ENV>.toml 사용(동시성·폴백·예산·알림 전부 toml)
APP_ENV: local
DB_HOST: ${LPS_DB_HOST-host.docker.internal} # 컨테이너→호스트 DB (config.local.toml 의 127.0.0.1 override)
PYTHONUNBUFFERED: "1"
volumes:
- ./lps/config/config.${APP_ENV:-dev}.toml:/app/config/config.${APP_ENV:-dev}.toml:ro
- lps-profiles:/profiles # Chrome 프로필(쿠키) 영속 — [WorkerConfig].profile_dir=/profiles
- ./lps/config/config.local.toml:/app/config/config.local.toml:ro
- lps-profiles:/profiles # Chrome 프로필(쿠키) 영속
extra_hosts:
- "host.docker.internal:host-gateway"
shm_size: "1gb" # Chrome 는 /dev/shm 을 많이 씀 — 부족하면 탭 크래시
stop_grace_period: 75s # graceful 종료 유예([WorkerConfig].shutdown_grace_sec=60 + 정리 여유) — 기본 10s 면 하던 잡 마무리 전에 SIGKILL
stop_grace_period: 75s # graceful 종료 유예(worker shutdown_grace_sec=60 + 여유)
labels:
autoheal: "true" # 하트비트 HEALTHCHECK 실패(행/좀비) 시 autoheal 이 재시작
autoheal: "true" # 하트비트 실패(행/좀비) 시 autoheal 재시작
restart: unless-stopped
logging:
driver: json-file
options: { max-size: "10m", max-file: "5" }
# LPS 관리자 UI (정적 React → nginx). /v1·/healthz·/readyz 는 nginx 가 lps-api:9600 으로 프록시(앱은 상대경로 호출).
lps-admin:
build:
context: ./lps-admin
dockerfile: Dockerfile
container_name: lps-admin
ports:
- "3400:80"
depends_on:
- lps-api
restart: unless-stopped
logging:
driver: json-file