다른 개발자가 어느 환경이든 같은 방식으로 띄울 수 있게 한다.
환경 = APP_ENV 가 고르는 config.<env>.toml 하나(구조 동일, 값만 다름).
- config.docker.toml → config.dev.toml 개명, config.prod.toml.example 신설
(prod 성격 반영: api_keys 필수 표기·debug 로그 금지·웹훅 권장).
- compose 의 lps 서비스 APP_ENV/마운트를 ${APP_ENV:-dev} 로 파라미터화,
API 포트를 ${LPS_API_BIND:-0.0.0.0} 바인드로 노출 제어.
- run_docker.sh(대화형) 신설: 환경 선택 → 설정 파일 검증(없으면 example
복사 제안) → 기동/재시작/중지/로그. prod 는 guard 키 비면 경고 후
확인받고, LPS_API_BIND=127.0.0.1 자동 설정(외부는 리버스프록시 경유).
- 운영 가이드에 환경 개요 표, README 빠른 시작에 Docker 실행 추가.
- 검증: 스크립트 문법·compose(dev/prod) 파싱·APP_ENV=dev 로딩·145 passed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
81 lines
2.6 KiB
Plaintext
81 lines
2.6 KiB
Plaintext
# dev(개발 서버, Docker) 설정 — 복사해서 사용: cp config.dev.toml.example config.dev.toml
|
|
# 실제 config.dev.toml 은 시크릿 포함이라 커밋하지 않는다(.gitignore: *.toml).
|
|
#
|
|
# 실행: ./lps/run_docker.sh 에서 dev 선택(권장) 또는 APP_ENV=dev docker compose up -d lps-api lps-worker
|
|
# compose 가 이 파일을 컨테이너에 마운트하고 APP_ENV 로 선택한다. 이미지에는 시크릿이 없다 —
|
|
# 마운트를 잊으면 기동 시 FileNotFoundError 로 즉시 실패(조용한 오동작 없음).
|
|
# local 과의 차이만 주석으로 표시 — 나머지 의미는 config.local.toml.example 참고.
|
|
|
|
[WebServerConfig]
|
|
server_name = "LpsServer"
|
|
port = 9600
|
|
process_count = 1 # API 병목은 드묾(단일로 ~1,100 RPS 실측). 부하 대비 시에만 코어 수만큼
|
|
is_ssl = false
|
|
is_test = false
|
|
cors_origins = []
|
|
api_keys = [] # dev 는 개방 모드(협의: guard 는 prod 전용)
|
|
|
|
[LogConfig]
|
|
print_console = true
|
|
log_level = "info"
|
|
|
|
[MainDBConfig]
|
|
db_type = "postgresql"
|
|
name = "lps_db"
|
|
write_host = "host.docker.internal" # 컨테이너 → 호스트 DB (전용 DB 서버면 그 호스트로)
|
|
write_port = 5432
|
|
write_id = "<DB_USER>"
|
|
write_pw = "<DB_PASSWORD>"
|
|
read_host = "host.docker.internal"
|
|
read_port = 5432
|
|
read_id = "<DB_USER>"
|
|
read_pw = "<DB_PASSWORD>"
|
|
show_log = false
|
|
pool_size = 10
|
|
max_overflow = 20
|
|
connection_budget = 40 # 전용 PG(max_connections≈100)면 90 근처로 상향
|
|
sslmode = ""
|
|
|
|
[WorkerConfig]
|
|
concurrency = 1
|
|
fallbacks = []
|
|
profile_dir = "/profiles" # compose 의 영속 볼륨(lps-profiles) — 재시작에도 cf_clearance 유지
|
|
job_deadline_sec = 300
|
|
shutdown_grace_sec = 60
|
|
chrome_channel = "chrome"
|
|
chrome_executable = "/usr/bin/chromium" # 컨테이너는 시스템 chromium + Xvfb(headful)
|
|
heartbeat_file = "/tmp/lps_worker_heartbeat"
|
|
|
|
[AlertConfig]
|
|
webhook = "" # Slack 호환 웹훅 — 채우면 임계 알림 전송(docs/operations.md)
|
|
cooldown_min = 30
|
|
dead_1h = 20
|
|
blocks_1h = 80
|
|
queue_lag_sec = 300
|
|
pool_pct = 90
|
|
source_fail_30m = 5
|
|
deadline_1h = 5
|
|
cost_1h_usd = 1.0
|
|
ports_low_pct = 30
|
|
block_sessions_6h = 1
|
|
|
|
[NaverConfig]
|
|
[[NaverConfig.keys]]
|
|
id = "<NAVER_CLIENT_ID>"
|
|
secret = "<NAVER_CLIENT_SECRET>"
|
|
|
|
[OpenAIConfig]
|
|
api_key = "<OPENAI_API_KEY>" # 비면 AI 판정 OFF
|
|
model = "gpt-4o-mini"
|
|
|
|
[DecodoConfig]
|
|
host = "" # 4종(호스트·계정·포트범위) 비면 프록시 미사용(직접 연결)
|
|
username = ""
|
|
password = ""
|
|
port_start = 0
|
|
port_end = 0
|
|
session_minutes = 10
|
|
cost_per_gb = 0.0
|
|
ip_request_budget = 3
|
|
port_cooldown_sec = 0
|