# ============================================================================= # 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