Files
mtusi2026lab6/s3

SeaweedFS identities

infra/s3/s3.json is mounted read-only into the seaweedfs container and is the single source of truth for S3 credentials and permissions.

  • admin is used only by the one-shot s3-init service (bucket creation and probing). It is never given to the API and must not be placed in .env: the API service loads .env as an environment file. Compose supplies the synthetic admin values to s3-init directly.
  • app is used by the API and by presigned uploads. It can read/write only messenger-attachments/attachments/* and messenger-attachments/staging/*, and list the bucket for the orphan sweeper.

The credentials are synthetic values for the local stand. .env.example carries the same values for the API and scripts/check_s3_creds.py fails the offline check if they drift. Replace them in .env for any non-local run.

Verify manually:

# anonymous requests are denied
docker compose exec -T seaweedfs \
  wget -qO- http://127.0.0.1:8333/messenger-attachments/attachments/missing

# the app identity cannot write outside its prefixes
docker compose run --rm s3-init   # probes this and exits non-zero on violation