: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
chore(devenv): remove the dev minio salvage script (#101154)
Paul D'Ambraefd5e2981934
diff --git a/AGENTS.md b/AGENTS.mdindex ff0c8eecceee..b136f7fa10d1 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -193,7 +193,7 @@ Each rule is tagged with what catches a violation.- **A Python `requests` call to GitHub or Slack under `common/`, `ee/`, `posthog/` or `products/` goes through `posthog/egress/`.** `[lint: github-api-calls-go-through-egress, slack-api-calls-go-through-egress]` Route it through the gated, recorded transport.- **Every other call to those hosts is on review.** `[review]` The rules match an inline URL in a Python `requests` call inside those four directories. A URL bound to a variable first, another transport such as `httpx`, another language, or a caller under `tools/` all pass CI.- **Any other third-party API that needs rate-limiting or egress telemetry belongs there too.** `[review]` Add a `<domain>/` incarnation (GitHub is the reference). No semgrep rule covers a new domain, so a raw client for one reaches master unless a reader catches it. `/routing-outbound-api-calls` decides the route and names the reference domain to copy.-- **Object storage is SeaweedFS — do not add new MinIO dependencies.** `[review]` Both S3-compatible stores are SeaweedFS: `objectstorage` (`:19000`, `OBJECT_STORAGE_*`) for general storage, `seaweedfs` (`:8333`, `SESSION_RECORDING_V2_S3_*`) for session replay v2. MinIO survives only as one-off salvage tooling: `bin/upgrade-objectstorage` (dev) and `bin/migrate-storage-hobby` (hobby) start a temporary container to read an old MinIO volume. Do not add compose services, scripts, tests or docs that stand up a `minio/minio` container. Talk to storage through the existing config and a standard S3 client, never a hardcoded endpoint. Note `objectstorage` registers credentials at runtime and returns `InvalidAccessKeyId` until that finishes, so wait for its readiness sentinel rather than the container start.+- **Object storage is SeaweedFS — do not add new MinIO dependencies.** `[review]` Both S3-compatible stores are SeaweedFS: `objectstorage` (`:19000`, `OBJECT_STORAGE_*`) for general storage, `seaweedfs` (`:8333`, `SESSION_RECORDING_V2_S3_*`) for session replay v2. MinIO survives only as one-off salvage tooling: `bin/migrate-storage-hobby` starts a temporary container to read an old hobby MinIO volume. Do not add compose services, scripts, tests or docs that stand up a `minio/minio` container. Talk to storage through the existing config and a standard S3 client, never a hardcoded endpoint. Note `objectstorage` registers credentials at runtime and returns `InvalidAccessKeyId` until that finishes, so wait for its readiness sentinel rather than the container start.### Django admindiff --git a/bin/upgrade-objectstorage b/bin/upgrade-objectstoragedeleted file mode 100755index 467b6018e921..000000000000--- a/bin/upgrade-objectstorage+++ /dev/null@@ -1,357 +0,0 @@-#!/usr/bin/env bash--set -e-set -o pipefail--# Image used to read the old MinIO data — must match the format the dev/hobby MinIO-# wrote (same RELEASE tag as docker-compose.hobby.yml).-MINIO_IMAGE="quay.io/minio/minio:RELEASE.2025-04-22T22-12-26Z"-TEMP_CONTAINER="objectstorage-salvage-src"-S3_KEY="object_storage_root_user"-S3_SECRET="object_storage_root_password"--show_help() {- cat <<'EOF'-Objectstorage MinIO → SeaweedFS Salvage Script--⚠️ IMPORTANT: This script is for LOCAL DEVELOPMENT environments.--PostHog dev objectstorage now runs SeaweedFS in a fresh named volume-(objectstorage-data). Your old MinIO objects live on the previous (now-orphaned) volume and are invisible to the new SeaweedFS — the on-disk formats-are not compatible, so there is no in-place conversion. This script salvages-them by copying object-by-object over S3.--The script automatically:-- Finds the orphaned MinIO objectstorage volume (looks for /data/.minio.sys)-- Spins up a temporary MinIO container reading that volume-- Copies every bucket into the running SeaweedFS objectstorage-- Removes the temporary container when done--The old MinIO volume is left untouched, so this is safe to run later if you-forgot — and safe to re-run (existing objects are skipped). Remove the old-volume once you've verified the data landed.--Usage:- hogli deploy:upgrade-objectstorage Interactive mode (default)- hogli deploy:upgrade-objectstorage --list List all MinIO volumes- ./bin/upgrade-objectstorage <volume-id> Salvage a specific volume--Examples:- # Interactive: detect the orphaned volume and copy it over- hogli deploy:upgrade-objectstorage-- # Find orphaned MinIO volumes- hogli deploy:upgrade-objectstorage --list-- # Salvage a specific volume- ./bin/upgrade-objectstorage 6e93806fad73d030739a55dd1c6594bf925833dd1a2ef59b3fb14b54bd6f5d73--EOF-}--# A MinIO data volume always has a .minio.sys directory at its root.-is_minio_volume() {- docker run --rm -v "$1:/data:ro" alpine test -d /data/.minio.sys 2>/dev/null-}--list_minio_volumes() {- echo "Scanning for MinIO objectstorage volumes..."- echo ""-- docker volume ls -q | while read -r vol; do- if is_minio_volume "$vol"; then- SIZE=$(docker run --rm -v "$vol:/data:ro" alpine du -sh /data 2>/dev/null | awk '{print $1}' || echo "unknown")- IN_USE=$(docker ps -a --filter "volume=$vol" --format "{{.Names}}" 2>/dev/null)-- if [ -n "$IN_USE" ]; then- echo "✅ $vol"- echo " Size: $SIZE | In use by: $IN_USE"- else- echo "⚠️ $vol"- echo " Size: $SIZE | ORPHANED (not mounted)"- fi- echo ""- fi- done-}--# The compose file in the directory you run this from is authoritative — whoever runs-# the command controls how containers come up. We deliberately do NOT read the running-# container's recorded compose path: the objectstorage container is shared across-# worktrees (same COMPOSE_PROJECT_NAME), so it may have last been started from another-# worktree still on MinIO. Trusting that label would force-recreate MinIO again instead-# of swapping to the SeaweedFS your freshly-pulled compose defines. So: pull, run, done.-detect_compose_file() {- if [ -f "docker-compose.dev.yml" ]; then- echo "docker-compose.dev.yml"- elif [ -f "docker-compose.yml" ]; then- echo "docker-compose.yml"- else- echo ""- fi-}--# Return the first volume that looks like MinIO data and isn't backing a running-# container (the live objectstorage is SeaweedFS, so it won't match anyway).-detect_minio_volume() {- docker volume ls -q | while read -r vol; do- if is_minio_volume "$vol"; then- echo "$vol"- return- fi- done-}--# Image of the running objectstorage container, empty if none is running.-running_objectstorage_image() {- local container- container=$(docker ps --filter "label=com.docker.compose.service=objectstorage" --format "{{.ID}}" | head -1)- [ -z "$container" ] && return- docker inspect "$container" --format '{{.Config.Image}}' 2>/dev/null || true-}--# The destination must be SeaweedFS. If the old MinIO objectstorage is still running-# (branch checked out but `hogli up` not run yet), copying into it would silently-# no-op — the data is already there — and never populate SeaweedFS. Recreate it as-# SeaweedFS first; that orphans the old volume, which is exactly what we salvage from.-ensure_objectstorage_running() {- local COMPOSE_FILE="$1"- local image- image=$(running_objectstorage_image)-- if [ -n "$image" ] && [[ "$image" != *minio* ]]; then- return- fi-- if [ -n "$image" ]; then- echo "objectstorage is still the old MinIO — recreating it as SeaweedFS first..."- docker compose -f "$COMPOSE_FILE" up -d --force-recreate objectstorage- else- echo "Starting objectstorage (SeaweedFS) as the copy destination..."- docker compose -f "$COMPOSE_FILE" up -d objectstorage- fi-- for _ in $(seq 1 30); do- image=$(running_objectstorage_image)- if [ -n "$image" ] && [[ "$image" != *minio* ]]; then- return- fi- sleep 1- done- echo "❌ objectstorage is not running as SeaweedFS. Run 'hogli up' to swap it, then re-run."- exit 1-}--# Host port the running objectstorage publishes for S3 (defaults to 19000).-objectstorage_host_port() {- local container- container=$(docker ps --filter "label=com.docker.compose.service=objectstorage" --format "{{.ID}}" | head -1)- local mapping- mapping=$(docker port "$container" 19000 2>/dev/null | head -1)- if [ -n "$mapping" ]; then- echo "${mapping##*:}"- else- echo "19000"- fi-}--cleanup_temp_container() {- docker rm -f "$TEMP_CONTAINER" >/dev/null 2>&1 || true-}--# boto3 sends buffered (non-streaming) signed PUTs, which open-mode SeaweedFS-# accepts — unlike mc / aws-chunked streaming uploads, which it rejects.-copy_buckets() {- local SRC_ENDPOINT="$1"- local DST_ENDPOINT="$2"-- if ! python3 -c "import boto3" >/dev/null 2>&1; then- echo "❌ boto3 is required. Run this inside the PostHog dev environment (flox)."- exit 1- fi-- python3 - "$SRC_ENDPOINT" "$DST_ENDPOINT" "$S3_KEY" "$S3_SECRET" <<'PY'-import sys, time, boto3-from botocore.config import Config-from botocore.exceptions import ClientError--src_ep, dst_ep, key, secret = sys.argv[1:5]---def client(ep):- return boto3.client(- "s3", endpoint_url=ep, aws_access_key_id=key, aws_secret_access_key=secret,- region_name="us-east-1",- config=Config(s3={"addressing_style": "path"}, signature_version="s3v4"),- )---src, dst = client(src_ep), client(dst_ep)--for name, c in (("source", src), ("destination", dst)):- for _ in range(60):- try:- c.list_buckets()- break- except Exception:- time.sleep(1)- else:- print(f"❌ {name} object storage never became reachable")- sys.exit(1)---def exists(c, bucket, key):- try:- c.head_object(Bucket=bucket, Key=key)- return True- except ClientError:- return False---buckets = [b["Name"] for b in src.list_buckets().get("Buckets", [])]-if not buckets:- print("No buckets on the old volume — nothing to copy.")- sys.exit(0)--copied = skipped = 0-for bucket in buckets:- try:- dst.create_bucket(Bucket=bucket)- except ClientError:- pass- print(f"→ {bucket}")- for page in src.get_paginator("list_objects_v2").paginate(Bucket=bucket):- for obj in page.get("Contents", []):- obj_key = obj["Key"]- if exists(dst, bucket, obj_key):- skipped += 1- continue- o = src.get_object(Bucket=bucket, Key=obj_key)- body = o["Body"].read()- kw = {"Bucket": bucket, "Key": obj_key, "Body": body}- if o.get("ContentType"):- kw["ContentType"] = o["ContentType"]- dst.put_object(**kw)- copied += 1--print(f"✅ Copied {copied} objects ({skipped} already present, skipped)")-PY-}--migrate_volume() {- local SOURCE_VOLUME="$1"- local COMPOSE_FILE="$2"-- if ! is_minio_volume "$SOURCE_VOLUME"; then- echo "❌ Error: Volume $SOURCE_VOLUME does not look like MinIO data (no .minio.sys)"- exit 1- fi-- SIZE=$(docker run --rm -v "$SOURCE_VOLUME:/data:ro" alpine du -sh /data 2>/dev/null | awk '{print $1}' || echo "unknown")- echo "Found MinIO objectstorage volume: $SOURCE_VOLUME ($SIZE)"- echo ""- read -r -p "Copy this data into the running SeaweedFS objectstorage? [y/N] " confirm- if [[ ! "$confirm" =~ ^([yY][eE][sS]|[yY])$ ]]; then- echo "Cancelled."- exit 0- fi-- ensure_objectstorage_running "$COMPOSE_FILE"- DST_PORT=$(objectstorage_host_port)-- cleanup_temp_container- trap cleanup_temp_container EXIT-- echo ""- echo "Step 1: Starting temporary MinIO reading the old volume..."- docker run -d \- --name "$TEMP_CONTAINER" \- -p "127.0.0.1::19000" \- -v "$SOURCE_VOLUME:/data" \- -e MINIO_ROOT_USER="$S3_KEY" \- -e MINIO_ROOT_PASSWORD="$S3_SECRET" \- "$MINIO_IMAGE" \- server --address ":19000" /data >/dev/null-- SRC_MAPPING=$(docker port "$TEMP_CONTAINER" 19000 | head -1)- SRC_PORT="${SRC_MAPPING##*:}"-- echo ""- echo "Step 2: Copying every bucket into SeaweedFS..."- copy_buckets "http://127.0.0.1:$SRC_PORT" "http://127.0.0.1:$DST_PORT"-- echo ""- echo "Step 3: Removing temporary container..."- cleanup_temp_container- trap - EXIT-- echo ""- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "✅ Objectstorage salvage complete!"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo ""- echo "Verify your data, then remove the old MinIO volume to reclaim disk:"- echo " docker volume rm $SOURCE_VOLUME"- echo ""-}--case "${1:-}" in- --help|-h)- show_help- exit 0- ;;-- --list)- list_minio_volumes- exit 0- ;;-- "")- echo ""- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "🪣 Objectstorage MinIO → SeaweedFS salvage"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo ""-- COMPOSE_FILE=$(detect_compose_file)- if [ -z "$COMPOSE_FILE" ]; then- echo "❌ Error: No docker-compose file found"- exit 1- fi- echo "Using compose file: $COMPOSE_FILE"- echo ""-- DETECTED_VOLUME=$(detect_minio_volume)- if [ -n "$DETECTED_VOLUME" ]; then- migrate_volume "$DETECTED_VOLUME" "$COMPOSE_FILE"- else- echo "No MinIO objectstorage data detected — nothing to salvage."- echo ""- echo "If you have data in an orphaned MinIO volume:"- echo " hogli deploy:upgrade-objectstorage --list # List all MinIO volumes"- echo " ./bin/upgrade-objectstorage <volume-id> # Salvage a specific volume"- echo ""- fi- ;;-- *)- VOLUME_ID="$1"-- COMPOSE_FILE=$(detect_compose_file)- if [ -z "$COMPOSE_FILE" ]; then- echo "❌ Error: No docker-compose file found"- exit 1- fi-- echo ""- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "🪣 Objectstorage MinIO → SeaweedFS salvage"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo ""- echo "Using compose file: $COMPOSE_FILE"- echo ""-- migrate_volume "$VOLUME_ID" "$COMPOSE_FILE"- ;;-esacdiff --git a/devenv/news.txt b/devenv/news.txtindex 666f1ad3273d..a35a6af677da 100644--- a/devenv/news.txt+++ b/devenv/news.txt@@ -1,3 +1,6 @@+2026-09-15+hogli deploy:upgrade-objectstorage is gone (MinIO is archived upstream); an old minio objectstorage volume is still on disk, run the script from git history to copy it: git show cbf23e1b406:bin/upgrade-objectstorage > /tmp/salvage && bash /tmp/salvage+2026-08-12localstack is gone (its license stopped being free); if you still have a localstack-main container, run docker rm -f localstack-main to clear it@@ -5,7 +8,7 @@ localstack is gone (its license stopped being free); if you still have a localstsend feedback to the devex team (humans and agents): hogli devex:feedback "..."2026-06-08-objectstorage swapped minio -> seaweedfs; old local files stay on the old volume, run hogli deploy:upgrade-objectstorage to copy them over+objectstorage swapped minio -> seaweedfs; old local files stay on the old volume2026-05-05check product maturity: hogli product:maturity <product>, or --all for a leaderboarddiff --git a/docker-compose.dev-full.yml b/docker-compose.dev-full.ymlindex ba7311101f0c..e32fed63fd75 100644--- a/docker-compose.dev-full.yml+++ b/docker-compose.dev-full.yml@@ -84,8 +84,8 @@ services:ports:- '19000:19000'- '19001:19001'- # Fresh named volume so the swap starts clean; data on the previous volume- # stays salvageable via `hogli deploy:upgrade-objectstorage`.+ # Named volume from the SeaweedFS swap; the old MinIO volume is left in place+ # because SeaweedFS cannot read its on-disk format.volumes:- objectstorage-data:/datadiff --git a/docker-compose.dev.yml b/docker-compose.dev.ymlindex be59d1f1e9da..e909c75e809d 100644--- a/docker-compose.dev.yml+++ b/docker-compose.dev.yml@@ -624,8 +624,8 @@ services:ports:- '19000:19000'- '19001:19001'- # Fresh named volume so the swap starts clean; data on the previous volume- # stays salvageable via `hogli deploy:upgrade-objectstorage`.+ # Named volume from the SeaweedFS swap; the old MinIO volume is left in place+ # because SeaweedFS cannot read its on-disk format.volumes:- objectstorage-data:/datadiff --git a/hogli.yaml b/hogli.yamlindex f69b26f0ed0d..1141b30858ca 100644--- a/hogli.yaml+++ b/hogli.yaml@@ -467,15 +467,6 @@ deploy:\ exports -n # Dry run exports only\n hogli deploy:migrate-storage-hobby\\ --list # List the MinIO volumes on this host"prompt: true- deploy:upgrade-objectstorage:- bin_script: upgrade-objectstorage- description: "Dev: salvage objectstorage data from the old MinIO volume into the\- \ running SeaweedFS (interactive)\n\nExamples:\n hogli deploy:upgrade-objectstorage\- \ # Detect and copy the orphaned MinIO volume\n hogli deploy:upgrade-objectstorage\- \ --list # List all MinIO volumes"- services:- - docker- prompt: truebuild:build:click: hogli_commands.build:build