Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
107 lines (104 loc) · 4.71 KB
/
Copy pathdocker-compose.yml
File metadata and controls
107 lines (104 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# 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
services:
postgres:
# postgres:17-alpine (PostgreSQL 17.11 when pinned) by OCI index digest.
# Keep in sync with internal/testutil/testimages.
image: postgres:17-alpine@sha256:eee6c6e1b0894fa4fe0075eb054af9fd1cf39a35321c2d4110626cfe506411fb
environment:
POSTGRES_PASSWORD: postgres
ports:
- "${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.51 by OCI index digest. Keep in sync with
# internal/testutil/testimages.
image: chrislusf/seaweedfs:4.51@sha256:f7a49e3f3972ebed5be2ed4befa4a0c68eb7bdddba6e692d42729ceb545134b8
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:
- "${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"]}]}