Run RustFS with a private bucket in the stand
MinIO community images can no longer be pulled on this arm64 host, so the stand runs RustFS 1.0.4 pinned by digest as non-root with a read only root, no published port, the console off and data on the s3data volume. A one-off s3-init with rc v0.1.36 creates the bucket, keeps it private for anonymous clients, creates the API user with a policy on the objects and listing of that one bucket, imports a lifecycle rule for incomplete multipart uploads and checks itself; the API replicas start only after it succeeded. Root keys reach only s3, s3-init and the operator s3-cli; the API gets its own key and the S3 settings through an anchor merged into its environment. secrets.sh creates hex S3 keys, the restart hook restarts S3 next to PostgreSQL and Valkey and waits until it is healthy, the limits policy covers the S3 services, and the stack evidence lists the new packages. The object storage adapter is tested against a throwaway RustFS of the same image: a 10 MiB round trip, a missing object, an idempotent delete and an unreachable endpoint failing within the request budget. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f9760fc098
commit
5aa766acff
@@ -35,8 +35,9 @@ for r in csv.DictReader(sys.stdin.read().lstrip("# ").splitlines()):
|
||||
grep -h -E 'image:|@sha256' compose.yaml Dockerfile | sed 's/^ */ /'
|
||||
echo "python in image: $(docker exec "$(docker compose ps -q api | head -1)" python -V)"
|
||||
echo "haproxy: $(docker compose exec -T lb haproxy -v | head -1)"
|
||||
echo "rustfs: $(docker compose exec -T s3 rustfs --version 2>/dev/null | head -1)"
|
||||
echo "packages (uv.lock):"
|
||||
for name in fastapi uvicorn uvicorn-worker gunicorn asyncpg argon2-cffi pydantic pydantic-settings dishka structlog redis; do
|
||||
for name in fastapi uvicorn uvicorn-worker gunicorn asyncpg argon2-cffi pydantic pydantic-settings dishka structlog redis aiobotocore botocore aiohttp pillow; do
|
||||
printf ' %s %s\n' "$name" "$(sed -n "/^name = \"$name\"$/{n;s/version = \"\(.*\)\"/\1/p;}" uv.lock)"
|
||||
done
|
||||
echo "process users (service uid command):"
|
||||
|
||||
+27
-3
@@ -7,10 +7,17 @@ import time
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
S3_CLIENT_SECRETS = ["s3_access_key_id", "s3_root_password", "s3_root_user", "s3_secret_access_key"]
|
||||
POLICY = {
|
||||
"lb": {"secrets": [], "volumes": [], "networks": ["backend", "edge"], "ports": True},
|
||||
"api": {
|
||||
"secrets": ["cache_url", "cursor_secret", "database_url"],
|
||||
"secrets": [
|
||||
"cache_url",
|
||||
"cursor_secret",
|
||||
"database_url",
|
||||
"s3_access_key_id",
|
||||
"s3_secret_access_key",
|
||||
],
|
||||
"volumes": [],
|
||||
"networks": ["backend"],
|
||||
},
|
||||
@@ -18,6 +25,13 @@ POLICY = {
|
||||
"postgres": {"secrets": ["postgres_password"], "volumes": ["pgdata"], "networks": ["backend"]},
|
||||
"valkey": {"secrets": ["valkey.conf"], "volumes": ["valkeydata"], "networks": ["backend"]},
|
||||
"k6": {"secrets": [], "volumes": [], "networks": ["edge"]},
|
||||
"s3": {
|
||||
"secrets": ["s3_root_password", "s3_root_user"],
|
||||
"volumes": ["s3data"],
|
||||
"networks": ["backend"],
|
||||
},
|
||||
"s3-init": {"secrets": S3_CLIENT_SECRETS, "volumes": [], "networks": ["backend"]},
|
||||
"s3-cli": {"secrets": S3_CLIENT_SECRETS, "volumes": [], "networks": ["backend"]},
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +113,17 @@ def main():
|
||||
parser.add_argument("--out", help="text report, written only after a complete check")
|
||||
args = parser.parse_args()
|
||||
problems = []
|
||||
_, raw = run("docker", "compose", "--profile", "bench", "config", "--format", "json")
|
||||
_, raw = run(
|
||||
"docker",
|
||||
"compose",
|
||||
"--profile",
|
||||
"bench",
|
||||
"--profile",
|
||||
"tools",
|
||||
"config",
|
||||
"--format",
|
||||
"json",
|
||||
)
|
||||
config = json.loads(raw)
|
||||
services = [
|
||||
declared(name, service, config.get("networks", {}), problems)
|
||||
@@ -110,7 +134,7 @@ def main():
|
||||
problems.append("no running api replicas to inspect")
|
||||
lines = [
|
||||
f"date: {time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())}",
|
||||
"$ docker compose --profile bench config --format json (declared)",
|
||||
"$ docker compose --profile bench --profile tools config --format json (declared)",
|
||||
*table(["service", "cpus/mem", "ports", "secrets", "volumes", "networks", "ro"], services),
|
||||
"",
|
||||
"$ docker inspect (running containers: hostname = X-Instance-Id, applied limits)",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
defined=$(docker compose config --services)
|
||||
stores=""
|
||||
for service in ${STATE_SERVICES:-postgres valkey}; do
|
||||
for service in ${STATE_SERVICES:-postgres valkey s3}; do
|
||||
if printf '%s\n' "$defined" | grep -qx "$service"; then stores="$stores $service"; fi
|
||||
done
|
||||
[ -n "$stores" ] || { echo "no state services found" >&2; exit 3; }
|
||||
|
||||
@@ -17,4 +17,8 @@ put cursor_secret "$(random)"
|
||||
put valkey_password "$(random)"
|
||||
put valkey.conf "requirepass $(cat secrets/valkey_password)"
|
||||
put cache_url "redis://:$(cat secrets/valkey_password)@valkey:6379/0"
|
||||
put s3_root_user "root$(random | cut -c1-16)"
|
||||
put s3_root_password "$(random)"
|
||||
put s3_access_key_id "api$(random | cut -c1-16)"
|
||||
put s3_secret_access_key "$(random)"
|
||||
[ -f .env ] || { cp .env.example .env; echo "создан .env из .env.example"; }
|
||||
|
||||
Reference in New Issue
Block a user