:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(dev): register seaweedfs s3 identities so presigned post uploads work (#63223)
Aleksander Błaszkiewicz2616d2c870f4
diff --git a/docker-compose.base.yml b/docker-compose.base.ymlindex 16eb19e902ec..650e28e18d20 100644--- a/docker-compose.base.yml+++ b/docker-compose.base.yml@@ -238,11 +238,16 @@ services:objectstorage:# SeaweedFS, S3-compatible object storage on objectstorage:19000.- # Run in default open-access mode (no -s3.config) so every credential pair our- # test/CI/dev code uses just works — including object_storage_root_user and- # any/any. Identity-based auth (-s3.config) was tried first but triggers known- # SeaweedFS SigV4 signature failures and presigned-URL regressions; see- # seaweedfs/seaweedfs #6635 and discussion #3976.+ # No static -s3.config (it triggers known SeaweedFS SigV4 signature failures and+ # presigned-URL regressions; see seaweedfs/seaweedfs #6635 and discussion #3976),+ # but pure open-access mode doesn't work either: the POST-policy handler always+ # looks the access key up in the identity store (no open-access bypass, also on+ # master), so presigned POST uploads — error tracking symbol sets via posthog-cli —+ # fail with InvalidAccessKeyId when no identities exist. The bootstrap loop below+ # therefore registers the canonical dev credentials at runtime via `s3.configure`+ # (which doesn't hit the static-config regressions), plus an `anonymous` identity+ # so unsigned clients keep working. Signed requests with any other access key are+ # rejected — everything in this repo uses object_storage_root_user against :19000.# Pin >= 4.05: that's the first release that persists Content-Encoding metadata# (4.03/4.04 silently drop it, breaking gzipped objects that rely on the header# round-tripping). 4.29 is the newest release that's been out at least two weeks.@@ -251,21 +256,28 @@ services:entrypoint:- /bin/sh- -c- # Background a create-and-verify loop and exec weed as PID 1 so SIGTERM+ # Background a setup-and-verify loop and exec weed as PID 1 so SIGTERM# reaches it directly. `weed shell` exits 0 as long as the master is- # reachable, even if individual `s3.bucket.create` commands fail (e.g. while- # the filer is still coming up), so we run create+list in one session and- # only touch the sentinel once `s3.bucket.list` reports every required bucket.+ # reachable, even if individual commands fail (e.g. while the filer is still+ # coming up), and setup output can't be grepped for success markers anyway:+ # the identity is also named `posthog`, so its configure echo would shadow+ # the `posthog` bucket check. The sentinel is therefore only touched once+ # read-only `s3.bucket.list` / `s3.configure` sessions report every required+ # bucket and identity from actual persisted state.- |(while true; do- OUT=$$(printf 's3.bucket.create -name posthog\ns3.bucket.create -name ducklake-dev\ns3.bucket.create -name ai-blobs\ns3.bucket.list\n' \- | /usr/bin/weed shell -master=localhost:19001 2>&1 || true)- if echo "$$OUT" | grep -q posthog \- && echo "$$OUT" | grep -q ducklake-dev \- && echo "$$OUT" | grep -q ai-blobs; then+ printf 's3.configure -access_key=object_storage_root_user -secret_key=object_storage_root_password -user=posthog -actions=Admin -apply\ns3.configure -user=anonymous -actions=Admin -apply\ns3.bucket.create -name posthog\ns3.bucket.create -name ducklake-dev\ns3.bucket.create -name ai-blobs\n' \+ | /usr/bin/weed shell -master=localhost:19001 >/dev/null 2>&1 || true+ BUCKETS=$$(echo 's3.bucket.list' | /usr/bin/weed shell -master=localhost:19001 2>/dev/null || true)+ IDENTITIES=$$(echo 's3.configure' | /usr/bin/weed shell -master=localhost:19001 2>/dev/null || true)+ if echo "$$BUCKETS" | grep -q posthog \+ && echo "$$BUCKETS" | grep -q ducklake-dev \+ && echo "$$BUCKETS" | grep -q ai-blobs \+ && echo "$$IDENTITIES" | grep -q object_storage_root_user \+ && echo "$$IDENTITIES" | grep -q anonymous; thentouch /tmp/objectstorage-ready- echo "Objectstorage SeaweedFS ready with required buckets"+ echo "Objectstorage SeaweedFS ready with required buckets and identities"breakfisleep 1diff --git a/rust/docker-compose.yml b/rust/docker-compose.ymlindex 6b464df127e0..007f973ea057 100644--- a/rust/docker-compose.yml+++ b/rust/docker-compose.yml@@ -50,9 +50,10 @@ services:objectstorage:# SeaweedFS, S3-compatible object storage on objectstorage:19000.- # Open-access mode (no -s3.config) so any credential pair our code uses just works.- # See docker-compose.base.yml `objectstorage` for full rationale (incl. the >= 4.05- # Content-Encoding pin).+ # The bootstrap loop registers the canonical dev credentials plus an anonymous+ # identity — SeaweedFS's POST-policy handler rejects presigned POST uploads when+ # no identities exist. See docker-compose.base.yml `objectstorage` for full+ # rationale (incl. the >= 4.05 Content-Encoding pin).image: chrislusf/seaweedfs:4.29restart: on-failureports:@@ -64,12 +65,16 @@ services:- |(while true; do- OUT=$$(printf 's3.bucket.create -name capture\ns3.bucket.create -name posthog\ns3.bucket.list\n' \- | /usr/bin/weed shell -master=localhost:19001 2>&1 || true)- if echo "$$OUT" | grep -q capture \- && echo "$$OUT" | grep -q posthog; then+ printf 's3.configure -access_key=object_storage_root_user -secret_key=object_storage_root_password -user=posthog -actions=Admin -apply\ns3.configure -user=anonymous -actions=Admin -apply\ns3.bucket.create -name capture\ns3.bucket.create -name posthog\n' \+ | /usr/bin/weed shell -master=localhost:19001 >/dev/null 2>&1 || true+ BUCKETS=$$(echo 's3.bucket.list' | /usr/bin/weed shell -master=localhost:19001 2>/dev/null || true)+ IDENTITIES=$$(echo 's3.configure' | /usr/bin/weed shell -master=localhost:19001 2>/dev/null || true)+ if echo "$$BUCKETS" | grep -q capture \+ && echo "$$BUCKETS" | grep -q posthog \+ && echo "$$IDENTITIES" | grep -q object_storage_root_user \+ && echo "$$IDENTITIES" | grep -q anonymous; thentouch /tmp/objectstorage-ready- echo "Objectstorage SeaweedFS ready with required buckets"+ echo "Objectstorage SeaweedFS ready with required buckets and identities"breakfisleep 1