refactor: audit log to Postgres + split /healthz liveness from Pulp status

- audit.record_deploy 를 JSONL 파일 → Postgres deploy_audit 테이블로 (재배포 휘발 방지)
  - psycopg 지연 import, _write 는 테스트에서 monkeypatch 지점, DATABASE_URL 사용
  - 감사 기록 실패는 배포 완료를 막지 않고 UI 경고(audit_ok)
- /healthz: Pulp 무관 라이브니스 {"ok":true} (컨테이너 health check),
  Pulp 연결 배지는 /pulp-status 로 분리 (대시보드가 폴링)
- config: DATABASE_URL 추가, audit_log_path 제거

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 13:42:11 +09:00
parent 7ad6d65a11
commit aef4124da0
8 changed files with 95 additions and 35 deletions

View File

@@ -187,7 +187,9 @@ def deploy(
502,
)
# 6) 감사 로그 (이전 버전 기록 = 롤백 추적). 기록 실패해도 배포는 이미 완료.
# 6) 감사 로그 (이전 버전 기록 = 롤백 추적). DB 기록 실패해도 배포는 이미 완료됐으므로
# 500 으로 죽이지 않고 audit_ok=False 로 UI 에 경고한다.
# TODO(운영): 감사 필수 정책이면 기록 실패 시 배포를 거부(hard-fail)하도록 강화.
audit_ok = True
try:
audit.record_deploy(
@@ -197,7 +199,7 @@ def deploy(
to_version=ctx["target_number"],
publication_href=pub_href,
)
except OSError:
except Exception: # noqa: BLE001 - DB/드라이버 오류 등 기록 실패는 배포 완료를 막지 않음
audit_ok = False
# 7) 성공: 버전 목록 OOB 갱신 + 모달 성공 표시