Files
clean-architecture-backend-…/infra/fileserver/compose/docker-compose.fileserver.yml
T
DongHyeonka 5786126cfa fix!: 남은 리뷰 항목과 합친 뒤 드러난 결함을 고친다
문제: 앞 커밋 뒤에도 알림·파일 서버 묶음이 합쳐지지 않았고, 포트 다수에
fake와 실제 구현이 함께 통과하는 공유 계약이 없었고, SpotBugs가 신뢰도
HIGH만 봤고, application-core에 관계없는 클래스 묶음 패키지(outbound)가
있었다. 묶음을 합치자 lane·검사가 새로 드러낸 결함도 있었다(JpaOutbox
Store가 읽기 전용 트랜잭션에서 이벤트를 조용히 잃음, gRPC admission
controller가 public synchronized라 외부 lock에 막힘, 소비자 decode 타입
등록 경로 없음, compose Redis 익명 접근, local-fileserver lane DB 없음).

방법: 리뷰 README 15절에 남은 결정을 모두 적고 그대로 고쳤다. 트랜잭션·
멱등성·발행·notification 포트에 testFixtures 계약 키트를 두고 fake와
PG·Redis 구현이 상속한다(fake 변이로 계약이 잡는지 확인). SpotBugs는
MEDIUM으로 내리고 진짜 결함은 고치고 오탐은 위치·패턴별 이유를 단
제외로 처리했다. 업무 기능 패키지 규칙을 application-core/CLAUDE.md에
정본으로 두고 ArchUnit 2개와 생성 명령이 강제한다. compose Redis는
infra/redis-sdk ACL로 뜬다. 묶음별 결과는 리뷰 README 16절에 있다.

위험·한계: APP_FLYWAY_ENABLED가 dev·prod에도 적용된다. app.security
오타 키가 이제 기동을 막는다. SES 콜백 replay 창 기본값이 1시간이다.
템플릿 패키지 목록은 CLAUDE.md 표와 TemplatePackageOwnership 두 곳에
있고 일치 검사는 없다. 실제 CI runner 실행은 확인하지 못했다.

검증: ci, mainCheck, integrationCheck, -p optional-platforms ci
integrationCheck, performanceCheck, releaseCheck(-PgitRevision),
verify-compose-profile-contracts(18 lane) 통과. compose lane 실제 기동:
local-fileserver, notification ingest·serving·handoff, local-redis,
all-adapters(smoke 3개 포함).

Refs: docs/reviews/2026-11-01-maturity-review/README.md 15·16절
BREAKING CHANGE: APP_FLYWAY_ENABLED가 dev·prod 프로필에도 적용되고,
app.security의 모르는 키는 기동을 거부한다. MessageHandler에
schemaVersions()가 생겨 decode 목록을 handler 선언에서 만든다.
2026-11-03 19:52:06 +09:00

59 lines
3.0 KiB
YAML

# =============================================================================
# Fileserver capability overlay — the storage volume, added only when the capability is selected.
#
# Usage, on top of a stack whose image carries the fileserver module (a service that selected
# `:composition:fileserver-platform`, or COMPOSITION=qualification):
# docker compose -f docker-compose.yml -f docker-compose.local.yml \
# -f infra/fileserver/compose/docker-compose.fileserver.yml up
#
# Why a file of its own (review 2026-11-01 07-08, capability criterion 7): the default image and
# docker-compose.yml carry no fileserver, so they no longer carry its volume either. Before, every
# container — default composition included — mounted a volume for a module it did not have, and the
# image declared it a VOLUME. It sits with the rest of the capability's infrastructure
# (infra/fileserver), so removing the capability removes it with that directory.
#
# The volume is a named volume, not a tmpfs and not the read-only root: published content must
# outlive the container that wrote it. Back it with real storage in any deployment that keeps files.
# Kubernetes does the same job with a PersistentVolumeClaim and the pod's fsGroup
# (infra/fileserver/kubernetes/pvc-certification-job.yaml).
#
# Ownership. The application runs as the image's non-root `app` account (src/Dockerfile). Docker
# seeds a fresh named volume's owner from the image directory at the mount point, and the image has
# no such directory any more; a reused volume or a host bind mount keeps whatever owner it had.
# Left like that, the volume is root's, every write is refused, and the module's storage probe stops
# startup with "storage root is not writable". fileserver-storage-init fixes the owner each time
# before the application starts: it runs once, as root, in the application's own image, and chowns
# to the `app` account by name, so the owner follows the image rather than a uid written here.
# =============================================================================
services:
fileserver-storage-init:
# The image the app service builds and tags. Never pulled: Compose builds it for `app` first,
# and a registry has no image by this local tag.
image: caskeleton:${BUILD_VERSION:-0.0.1_local_0000000}-${COMPOSITION:-default}
pull_policy: never
user: "0:0"
entrypoint:
- "sh"
- "-c"
- "chown app:app /var/lib/backend/files && chmod 0750 /var/lib/backend/files"
read_only: true
network_mode: none
volumes:
- fileserver-data:/var/lib/backend/files
restart: "no"
app:
depends_on:
fileserver-storage-init:
condition: service_completed_successfully
environment:
# The mount and the root the module writes to must name one path. This is also the module's
# default (config/module-defaults/fileserver.yml), stated so that moving one moves the other.
APP_FILESERVER_PLATFORM_STORAGE_ROOT: "/var/lib/backend/files"
volumes:
- fileserver-data:/var/lib/backend/files
volumes:
fileserver-data: