forked from mtusi2026/mtusi2026lab7
LB ходит в API только с клиентским сертификатом нужной identity, остальные связи проверяют серверный сертификат, root token в приложение не попадает. Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
1.7 KiB
Bash
63 lines
1.7 KiB
Bash
#!/bin/sh
|
|
# One SeaweedFS process bound to localhost. HAProxy in this network namespace
|
|
# is the TLS endpoint other containers use.
|
|
set -eu
|
|
: "${S3_BUCKET:?}"
|
|
admin_key=$(cat /run/secrets/s3_admin_access)
|
|
admin_secret=$(cat /run/secrets/s3_admin_secret)
|
|
api_key=$(cat /run/secrets/s3_api_access)
|
|
api_secret=$(cat /run/secrets/s3_api_secret)
|
|
worker_key=$(cat /run/secrets/s3_worker_access)
|
|
worker_secret=$(cat /run/secrets/s3_worker_secret)
|
|
|
|
cat > /tmp/s3.json <<EOF
|
|
{
|
|
"identities": [
|
|
{"name": "anonymous", "actions": []},
|
|
{
|
|
"name": "s3-admin",
|
|
"credentials": [{"accessKey": "${admin_key}", "secretKey": "${admin_secret}"}],
|
|
"actions": ["Admin:${S3_BUCKET}"]
|
|
},
|
|
{
|
|
"name": "messenger-api",
|
|
"credentials": [{"accessKey": "${api_key}", "secretKey": "${api_secret}"}],
|
|
"actions": [
|
|
"Read:${S3_BUCKET}",
|
|
"Read:${S3_BUCKET}/*",
|
|
"List:${S3_BUCKET}",
|
|
"Write:${S3_BUCKET}/staging/*",
|
|
"Write:${S3_BUCKET}/originals/*",
|
|
"Tagging:${S3_BUCKET}/*"
|
|
]
|
|
},
|
|
{
|
|
"name": "messenger-worker",
|
|
"credentials": [{"accessKey": "${worker_key}", "secretKey": "${worker_secret}"}],
|
|
"actions": [
|
|
"Read:${S3_BUCKET}/staging/*",
|
|
"Read:${S3_BUCKET}/originals/*",
|
|
"Read:${S3_BUCKET}/variants/*",
|
|
"List:${S3_BUCKET}",
|
|
"Write:${S3_BUCKET}/originals/*",
|
|
"Write:${S3_BUCKET}/variants/*",
|
|
"Write:${S3_BUCKET}/staging/*",
|
|
"Tagging:${S3_BUCKET}/*"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
|
|
exec weed server \
|
|
-dir=/data \
|
|
-ip.bind=127.0.0.1 \
|
|
-master.port=9333 \
|
|
-volume.port=8080 \
|
|
-filer \
|
|
-filer.port=8888 \
|
|
-filer.exposeDirectoryData=false \
|
|
-s3 \
|
|
-s3.port=19000 \
|
|
-s3.config=/tmp/s3.json
|