Files
clean-architecture-backend-…/src/bootstrap/app/compose-lanes/lane-services.yaml
T
DongHyeonka a7f44d8a8d fix(secrets)!: 로컬 비밀 기본값을 __LOCAL_DEV_ 규칙에 맞추고 가림 약속을 구현과 맞춘다
로컬 비밀 기본값(compose·lane·application-local의 DB 비밀번호, MinIO
root, Keycloak admin)이 __LOCAL_DEV_ 접두어 규칙을 따르지 않아 prod
sentinel 검사가 그 값을 알아보지 못한다. secrets-classification.yaml은
구현 없는 masking_rule full_except_last_4를 약속하고, full로 적은 키 일부
(salt·PEM·HMAC/signing key, URI 사용자 정보)를 LogMaskingPatterns가 가리지
않는다. required_test는 없는 시험 이름이다. IP 신뢰 설정을 두 문서가
다르게 적는다(application-local은 framework, rate-limiting은 native).

- 기본값을 __LOCAL_DEV_db_password__·__LOCAL_DEV_minio_root__·
  __LOCAL_DEV_keycloak_admin__로 바꾼다.
- masking_rule을 full|userinfo|none 셋으로 줄이고, LogMaskingPatterns의
  키 목록을 넓히고 URI userinfo와 여러 줄 PEM 블록 가림을 더한다. 시험이 masking_rule 어휘,
  required_test 클래스 존재, full·userinfo 행이 실제로 가려지는지 본다.
  버린 안: full_except_last_4 구현(끝 네 자리를 남길 값이 없다).
- IP 신뢰는 native + 내부 proxy 목록 하나로 적는다.

위험: 로컬 compose 볼륨이 옛 비밀번호로 만들어졌으면 DB 접속이 실패한다
(docs/upgrade/2026-11-round9-observability.md 6행). 운영 값은 바뀌지
않는다.

검증: 위와 같은 desktop 실행(묶음 셋을 합친 트리) rc=0.

Refs: RR9-02-10, RR9-02-12, RR9-02-13
BREAKING CHANGE: 로컬 compose·lane의 비밀 기본값이 바뀐다. 옛 볼륨은
  지우거나 env로 옛 값을 준다(docs/upgrade/2026-11-round9-observability.md 6~7행).
2026-11-13 13:12:09 +09:00

246 lines
11 KiB
YAML

# =============================================================================
# compose lane 전용 서비스 — 개발 환경(저장소 루트 compose.yaml)에는 없다.
#
# 스키마 적용 one-shot 둘과 smoke client 넷이다. 모두 profile이 있어서 lane이 그 profile을 댈 때만 뜬다.
# 어느 lane이 무엇을 쓰는지는 compose-profile-contracts.json이 정한다. 이 파일은 compose.yaml 뒤에
# -f로 합쳐지므로 경로는 저장소 루트 기준이다.
#
# profile 서비스
# schema-streams db-migrate-capabilities, db-promote-capabilities
# smoke-auth auth-smoke
# smoke-graphql graphql-smoke
# smoke-objectstorage object-storage-smoke
# smoke-notification notification-smoke
# =============================================================================
# The object storage smoke client runs the MinIO server image (see below). YAML anchors do not cross
# files, so this is a second copy of compose.yaml's default; ComposeMinioImageMatchesEvidenceTest
# holds both to the measured evidence digest.
x-local-minio-image: &local-minio-image "${LOCAL_MINIO_IMAGE:-pgsty/minio@sha256:b6bfe7239bfc83fb90d31612d9704d86039dd714f7904b3f1ad68f211e602372}"
services:
# ---- Capability schema streams ------------------------------------------------
# Two pre-start one-shots, in this order, because a capability stream is an operator sequence
# rather than a property.
#
# Install: each stream under db/migration/jpa keeps its own Flyway history table — they all declare
# a V1, so one Flyway pointed at all of them fails outright — and each registers itself
# INSTALLED_INACTIVE.
#
# Promote: an operator sanctions the installed schema, and the application refuses to start until
# that has happened. That is the fail-closed half of the same design, so it cannot be folded into
# the install step without making "the tables exist" and "this is sanctioned" the same event.
#
# They are also two images because they must be: flyway/flyway ships no psql, so the promotion
# could not have run in the migration container at all.
#
# Both run before `up`, not with the smoke clients after it — the application is what they are a
# precondition for. The lane contract's preStartServices carries that ordering.
db-migrate-capabilities:
profiles:
- schema-streams
image: flyway/flyway:11.1.0
depends_on:
db:
condition: service_healthy
entrypoint: ["/bin/sh", "/opt/capability-streams/apply-capability-streams.sh"]
environment:
PGHOST: "db"
PGUSER: "${APP_DATASOURCE_USERNAME:-ca_skeleton}"
PGPASSWORD: "${APP_DATASOURCE_PASSWORD:-__LOCAL_DEV_db_password__}"
PGDATABASE: "${POSTGRES_DB:-ca_skeleton}"
CAPABILITY_STREAMS: "${CAPABILITY_STREAMS:-}"
volumes:
- type: bind
source: ./src/bootstrap/app/compose-lanes/postgres/apply-capability-streams.sh
target: /opt/capability-streams/apply-capability-streams.sh
read_only: true
- type: bind
source: ./src/adapter/outbound/persistence-jpa/src/main/resources/db/migration
target: /flyway/sql
read_only: true
- type: bind
source: ./src/adapter/outbound/persistence-notification/src/main/resources/db/migration/jpa/notification-platform
target: /flyway/streams/notification-platform
read_only: true
- type: bind
source: ./src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver
target: /flyway/streams/fileserver
read_only: true
networks:
- caskeleton-infra
restart: "no"
db-promote-capabilities:
profiles:
- schema-streams
image: postgres:16-alpine
depends_on:
db:
condition: service_healthy
entrypoint: ["/bin/sh", "/opt/capability-streams/promote-capability-streams.sh"]
environment:
PGHOST: "db"
PGUSER: "${APP_DATASOURCE_USERNAME:-ca_skeleton}"
PGPASSWORD: "${APP_DATASOURCE_PASSWORD:-__LOCAL_DEV_db_password__}"
PGDATABASE: "${POSTGRES_DB:-ca_skeleton}"
CAPABILITY_STREAMS: "${CAPABILITY_STREAMS:-}"
volumes:
- type: bind
source: ./src/bootstrap/app/compose-lanes/postgres/promote-capability-streams.sh
target: /opt/capability-streams/promote-capability-streams.sh
read_only: true
networks:
- caskeleton-infra
restart: "no"
# ---- One-shot smoke clients --------------------------------------------------
# Never `up --wait` targets. Each is run with `run --rm` and must exit zero; a missing, skipped or
# non-zero one fails its lane rather than being treated as "not applicable".
graphql-smoke:
profiles:
- smoke-graphql
image: curlimages/curl:8.10.1
depends_on:
keycloak:
condition: service_healthy
# uid 0 for the mounted 0600 client secret, same as auth-smoke.
user: "0:0"
entrypoint: ["/bin/sh", "/opt/smoke/graphql-smoke.sh"]
environment:
APP_BASE_URL: "http://app:8080"
KEYCLOAK_ISSUER: "http://keycloak:8080/realms/ca-skeleton"
KEYCLOAK_CLIENT_ID: "ca-skeleton-api"
# Spring for GraphQL serves its own endpoint through a router function rather than an
# annotated controller, so the presentation base-path prefix does not apply to it.
GRAPHQL_PATH: "${GRAPHQL_PATH:-/graphql}"
volumes:
- type: bind
source: ./src/bootstrap/app/compose-lanes/smoke
target: /opt/smoke
read_only: true
secrets:
- keycloak-graphql-smoke-client-secret
networks:
- caskeleton-infra
restart: "no"
auth-smoke:
profiles:
- smoke-auth
image: curlimages/curl:8.10.1
depends_on:
keycloak:
condition: service_healthy
# The client secret is written on the host at mode 0600 by the qualification wrapper and mounted
# in. The Keycloak image happens to run as the same uid the wrapper writes as; this image runs as
# uid 100, so it read "Permission denied" and the lane failed on the smoke client rather than on
# anything it was checking. Compose ignores the secret's uid/gid/mode options outside swarm, so
# the container reads it as root instead. The two alternatives are both worse: loosening the host
# file to world-readable leaves a credential readable by every process on the machine, and passing
# the value as an environment variable puts it in `docker compose config` output and in ps.
user: "0:0"
entrypoint: ["/bin/sh", "/opt/smoke/auth-smoke.sh"]
environment:
# The same issuer URL the application is given. A token obtained from one URL and validated
# against another proves nothing, and localhost means a different host inside each container.
KEYCLOAK_ISSUER: "http://keycloak:8080/realms/ca-skeleton"
KEYCLOAK_CLIENT_ID: "ca-skeleton-api"
APP_BASE_URL: "http://app:8080"
# Supplied per runtime, because the same endpoint has two addresses: application-local.yml
# pins presentation.api-base-path to /api and the shipped default is /v1. The qualification
# wrapper exports the value that matches the lane's Spring runtime.
APP_HEALTH_PATH: "${APP_HEALTH_PATH:-/v1/healthcheck}"
volumes:
- type: bind
source: ./src/bootstrap/app/compose-lanes/smoke
target: /opt/smoke
read_only: true
secrets:
- keycloak-graphql-smoke-client-secret
networks:
- caskeleton-infra
restart: "no"
# The server image, not the mc client image: the mc image ships no sed, grep or cmp, and the round-trip
# client needs a digest tool. See smoke/object-storage-smoke.sh for how that went unnoticed. The
# lane already pulls this image for the server itself.
object-storage-smoke:
profiles:
- smoke-objectstorage
image: *local-minio-image
depends_on:
minio-init:
condition: service_completed_successfully
entrypoint: ["/bin/sh", "/opt/smoke/object-storage-smoke.sh"]
environment:
MINIO_ENDPOINT: "http://minio:9000"
MINIO_ROOT_USER: "${MINIO_ROOT_USER:-caskeleton}"
MINIO_ROOT_PASSWORD: "${MINIO_ROOT_PASSWORD:-__LOCAL_DEV_minio_root__}"
MINIO_BUCKET: "${MINIO_BUCKET:-ca-skeleton-objects}"
volumes:
- type: bind
source: ./src/bootstrap/app/compose-lanes/smoke
target: /opt/smoke
read_only: true
networks:
- caskeleton-infra
restart: "no"
notification-smoke:
profiles:
- smoke-notification
image: curlimages/curl:8.10.1
depends_on:
keycloak:
condition: service_healthy
# uid 0 for the same reason auth-smoke uses it: the mounted client secret is mode 0600 on the
# host and this image otherwise runs as uid 100, which reads "Permission denied". The lane then
# fails on the smoke client rather than on anything it was checking.
user: "0:0"
entrypoint: ["/bin/sh", "/opt/smoke/notification-smoke.sh"]
environment:
APP_BASE_URL: "http://app:8080"
MAILPIT_BASE_URL: "http://mailpit:8025"
# ingest | serving | handoff-verify — which phase of the lane this invocation is.
#
# No default, deliberately. It defaulted to `ingest`, and local-notification-serving therefore
# ran the ingest assertions — "accepted, and nothing was delivered" — against an application in
# SERVING mode. The lane passed while testing the opposite of what it is named for, and would
# have kept passing for as long as the check happened to run before the dispatch worker. An
# unset value now renders empty and the client refuses it.
# `:-` and not a value: an explicit empty default keeps Compose from warning about an unset
# variable on every lane that never runs this client, while still rendering empty so the
# client refuses it.
NOTIFICATION_SMOKE_PHASE: "${NOTIFICATION_SMOKE_PHASE:-}"
APP_BASE_PATH: "${APP_BASE_PATH:-/api}"
# Submission and template publication are authenticated like every other non-public path, so
# this client obtains a token the same way auth-smoke does — client credentials against the
# same issuer URL the application validates against.
KEYCLOAK_ISSUER: "http://keycloak:8080/realms/ca-skeleton"
KEYCLOAK_CLIENT_ID: "ca-skeleton-api"
volumes:
- type: bind
source: ./src/bootstrap/app/compose-lanes/smoke
target: /opt/smoke
read_only: true
# The handoff lane runs this client twice in one project and the second run needs the request
# id the first accepted, so the state lives in a named volume that outlives a `run --rm`
# container and is removed with the project by the teardown's --volumes.
#
# Its own path, not a subdirectory of the script mount above: a volume nested inside a
# read-only bind cannot be created, because the runtime has to mkdir the mountpoint in a
# filesystem it was just told is read-only.
- type: volume
source: caskeleton-notification-smoke-state
target: /opt/notification-smoke-state
secrets:
- keycloak-graphql-smoke-client-secret
networks:
- caskeleton-infra
restart: "no"
volumes:
caskeleton-notification-smoke-state:
driver: local