Files
mtusi2026lab6/infra/seaweedfs/start.sh
T

25 lines
1.1 KiB
Bash

#!/bin/sh
# SeaweedFS all-in-one (master + volume + filer + S3 gateway) for the lab stand.
#
# - master/volume/filer and their web UIs listen on 127.0.0.1 INSIDE the
# container only (-ip.bind): their HTTP API has no authentication and must
# not be reachable from the Docker network. Only the S3 gateway (9000)
# listens on all interfaces, and it requires SigV4 credentials.
# - Identities and rights come from s3.json.template; the secret values are
# substituted at start from Docker secrets into a file readable by root
# only (never stored in Git or in the image).
set -eu
umask 077
s() { cat "/run/secrets/$1"; }
sed -e "s|@ADMIN_ACCESS_KEY@|$(s s3_admin_access_key_id)|" \
-e "s|@ADMIN_SECRET_KEY@|$(s s3_admin_secret_access_key)|" \
-e "s|@API_ACCESS_KEY@|$(s s3_access_key_id)|" \
-e "s|@API_SECRET_KEY@|$(s s3_secret_access_key)|" \
/opt/lab/s3.json.template > /tmp/s3.json
exec weed -logtostderr=true server \
-dir=/data \
-ip=127.0.0.1 -ip.bind=127.0.0.1 \
-master.volumeSizeLimitMB=256 -volume.max=0 \
-s3 -s3.port=9000 -s3.ip.bind=0.0.0.0 -s3.config=/tmp/s3.json