# Local infra for open.storage: Postgres (ref authority + metadata) and # SeaweedFS (immutable pack storage via its S3 gateway; the tested reference # self-hosted store — issue #133). The service itself runs on the host: # go run ./cmd/openstorage serve (see README.md quickstart) # # Host ports are env-overridable because sibling checkouts/agents may share # the docker daemon; pick a unique compose project name too: # PGPORT=15499 S3PORT=18499 docker compose -p openstorage-$(whoami) up -d --wait # # Postgres and the S3 gateway publish on 127.0.0.1 only: the Postgres # password and the gateway's static Admin identity are public development # defaults. To publish one on every interface on purpose, drop the # `127.0.0.1:` prefix from its `ports:` entry and change those credentials # first. Reach both as 127.0.0.1, not `localhost`, which can resolve to ::1. services: postgres: # postgres:17-alpine (PostgreSQL 17.12 when pinned) by OCI index digest. # Keep in sync with internal/testutil/testimages. image: postgres:17-alpine@sha256:d3244e8ce3f165ee3c93d9c4a4b1d0fe48b3a89e2287b717fdcbbde92d405065 environment: POSTGRES_PASSWORD: postgres ports: - "127.0.0.1:${PGPORT:-15432}:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 2s timeout: 3s retries: 15 seaweedfs: # Qualified recipe (issue #133 Gate 1a-A, PR #142): pinned image, # one-process `weed server -s3`. The static identity below keeps the # published gateway credential-gated (dev-stack parity with the MinIO # root user it replaced); unauthenticated requests get 403. Never # enable versioning or object-lock on data buckets (seaweedfs#8073 # avoidance). # chrislusf/seaweedfs:4.53 by OCI index digest. Keep in sync with # internal/testutil/testimages. image: chrislusf/seaweedfs:4.53@sha256:ccad23e18639c8b98cee17e7100b95830a06077b56d8e5b006d6dcf8ec5e94a0 command: server -s3 -dir=/data -ip.bind=0.0.0.0 -s3.config=/etc/seaweedfs/s3.json configs: - source: seaweedfs-s3 target: /etc/seaweedfs/s3.json ports: - "127.0.0.1:${S3PORT:-18333}:8333" healthcheck: # The gateway's unauthenticated /healthz: it 200s only once the S3 # gateway is actually serving (the port accepts TCP before that), # and it needs no credentials even with SigV4 enforcement on. test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:8333/healthz"] interval: 2s timeout: 3s retries: 30 # Opt-in two-replica app profile (`docker compose --profile replicas up`): # two stateless nodes on the same Postgres+SeaweedFS stack, proving # multi-node statelessness in the README quickstart. Default # `docker compose up` still boots only the backing services above. The # nodes are identical except the host port mapping (and the base URL that # embeds it). Keys come from the host # (`./openstorage keygen --out ./compose-keys/cs-key`, see README). node-a: &node build: . profiles: ["replicas"] restart: on-failure # docker stop sends SIGTERM to serve (PID 1) and SIGKILL after this # period (Docker's default is 10 s). serve needs up to 8 s of drain, # 1 s of git-child kill grace and 1 s for handlers to return, then # teardown, which on S3-WAL includes up to 5 s of instance-lease # release: 15 s. 30 s leaves headroom (issue #480). stop_grace_period: 30s depends_on: postgres: condition: service_healthy seaweedfs: condition: service_healthy environment: &node-env OPENSTORAGE_PG_URL: postgres://postgres:postgres@postgres:5432/postgres # Preserve the existing bucket and dev credentials across the product rename. OPENSTORAGE_S3_URL: "s3://codestorage?endpoint=http://seaweedfs:8333&s3ForcePathStyle=true®ion=us-east-1" # Must match the static identity in the seaweedfs-s3 config below. AWS_ACCESS_KEY_ID: codestorage AWS_SECRET_ACCESS_KEY: codestorage OPENSTORAGE_ORG: selfhost OPENSTORAGE_ORG_PUBKEYS: /keys/cs-key.pub.pem OPENSTORAGE_LISTEN: 0.0.0.0:8080 OPENSTORAGE_BASE_URL: http://127.0.0.1:${NODEA_PORT:-8081} ports: - "${NODEA_PORT:-8081}:8080" volumes: # Only the PUBLIC half: the private key stays on the host for minting. - ${CS_KEYS_DIR:-./compose-keys}/cs-key.pub.pem:/keys/cs-key.pub.pem:ro healthcheck: # /healthz is unauthenticated; wget is busybox, present in the alpine # runtime image. test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/healthz"] interval: 2s timeout: 3s retries: 15 node-b: <<: *node environment: <<: *node-env OPENSTORAGE_BASE_URL: http://127.0.0.1:${NODEB_PORT:-8082} ports: - "${NODEB_PORT:-8082}:8080" configs: # Static S3 identity for the dev stack (development credentials, like the # Postgres password above — not deployment guidance). seaweedfs-s3: content: | {"identities":[{"name":"codestorage","credentials":[{"accessKey":"codestorage","secretKey":"codestorage"}],"actions":["Admin","Read","List","Tagging","Write"]}]}