Docker & Setup
The all-in-one server, the production-shaped cluster, and the lab profile
Everything in this module lives in seaweedfs/ in the repository. One
binary, weed, plays every role; the first argument picks which.
The minimal setup
compose.yaml runs weed server: a master, a volume server, a filer and
the S3 gateway in a single process, with no authentication.
services:
seaweedfs:
image: chrislusf/seaweedfs:4.48
command: server -dir=/data -s3 -s3.port=8333
ports: ["9333:9333", "8888:8888", "8333:8333"]
volumes: [seaweedfs_data:/data]docker compose up -d
aws --endpoint-url http://localhost:8333 s3 mb s3://scratch
aws --endpoint-url http://localhost:8333 s3 cp README.md s3://scratch/It's perfect for a laptop or CI, and it has no redundancy at all: one process, one disk, one copy of everything.
The production-shaped cluster
compose_prod.yaml runs each role as its own container, the way you'd run
them on separate machines:
docker compose down
docker compose -f compose_prod.yaml up -d
curl -s localhost:9333/cluster/status
{"IsLeader":true,"Leader":"master-1:9333.19333","Peers":["master-3:9333.19333","master-2:9333.19333"],"MaxVolumeId":50}| What | Where |
|---|---|
| S3 API | http://localhost:8333 (path-style addressing, region us-east-1) |
| Master UI: topology, volumes, leader | http://localhost:9333 |
| Filer UI: browse buckets as directories | http://localhost:8888 |
| Metrics | masters 9324 / 9331 / 9332, volumes 9325-9327 and 9330, filer and S3 9328 |
Real deployments run each volume server on its own machine with its own
disks, and set -rack and -dataCenter to match the physical layout.
Those labels are the only thing SeaweedFS knows about your failure
domains. If two "racks" share a power supply, replication across them
protects less than it appears to.
The lab profile
The Python labs use boto3, the AWS SDK. They run in a container on the
cluster's network:
docker compose -f compose_prod.yaml --profile labs build labs
docker compose -f compose_prod.yaml run --rm labs python s3_basics.pylabs/common.py builds an S3 client for a named identity, pointed at
http://filer:8333 with path-style addressing
(http://host/bucket/key rather than http://bucket.host/key), which
self-hosted stores need unless you set up wildcard DNS.
The labs service deliberately has no depends_on. While building the
durability drill, docker compose run labs quietly started the volume
servers that had just been stopped, because they were dependencies of
the filer, which was a dependency of labs. The drill reported every
object readable with two servers "down." See
The Durability Drill.
Lab
- Start the minimal stack, create a bucket with the AWS CLI, and open the
filer UI at http://localhost:8888 to find it under
/buckets. - Switch to the cluster. In the master UI, find the leader and the four volume servers with their racks.
- Stop the leader master. How long until
/cluster/statuson another master names a new one? (It took 13 seconds here.)