Skip to content

: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.

fix(replay): repair local rasterizer worker startup (#100795)

Oliver Browne8471862b083b
diff --git a/bin/temporal-recording-rasterizer-worker b/bin/temporal-recording-rasterizer-worker
index ae01c0be7223..c3cc29e6e99d 100755
--- a/bin/temporal-recording-rasterizer-worker
+++ b/bin/temporal-recording-rasterizer-worker
@@ -1,6 +1,7 @@
#!/bin/bash
set -e
+set -o pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
@@ -75,20 +76,24 @@ fi
# the linux/amd64 emulation Docker uses on macOS. Local dev script only — prod
# runs from the Helm chart, not this script.
echo "Starting recording-rasterizer container..."
+video_storage_endpoint="${VIDEO_EXPORT_OBJECT_STORAGE_ENDPOINT:-http://posthog-objectstorage-1:19000}"
+if [[ "$video_storage_endpoint" =~ ^http://(127\.0\.0\.1|localhost)([:/?#].*)?$ ]]; then
+ video_storage_endpoint="http://host.docker.internal${BASH_REMATCH[2]}"
+fi
# nosemgrep: trailofbits.generic.container-privileged.container-privileged
-docker run --rm \
+docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined \
--name "$CONTAINER_NAME" \
--network posthog_default \
--platform linux/amd64 \
--add-host localhost:host-gateway \
- --security-opt seccomp=unconfined \
- --security-opt apparmor=unconfined \
+ --add-host host.docker.internal:host-gateway \
+ -e NODE_ENV=development \
-e TEMPORAL_HOST="${TEMPORAL_HOST:-posthog-temporal-1}" \
-e TEMPORAL_PORT="${TEMPORAL_PORT:-7233}" \
-e RECORDING_API_BASE_URL="${RECORDING_API_BASE_URL:-http://host.docker.internal:6741}" \
-e INTERNAL_API_SECRET="${INTERNAL_API_SECRET:-posthog123}" \
-e SITE_URL="${SITE_URL:-http://host.docker.internal:8000}" \
- -e VIDEO_EXPORT_OBJECT_STORAGE_ENDPOINT="${VIDEO_EXPORT_OBJECT_STORAGE_ENDPOINT:-http://posthog-objectstorage-1:19000}" \
+ -e VIDEO_EXPORT_OBJECT_STORAGE_ENDPOINT="$video_storage_endpoint" \
-e AWS_ACCESS_KEY_ID=object_storage_root_user \
-e AWS_SECRET_ACCESS_KEY=object_storage_root_password \
-e DISABLE_BROWSER_SECURITY="${DISABLE_BROWSER_SECURITY:-1}" \
diff --git a/docs/published/handbook/engineering/developing-locally.md b/docs/published/handbook/engineering/developing-locally.md
index f2c8b6678791..008c5a781389 100644
--- a/docs/published/handbook/engineering/developing-locally.md
+++ b/docs/published/handbook/engineering/developing-locally.md
@@ -162,6 +162,8 @@ You can now change PostHog in any way you want. See [Project structure](./projec
By default, `hogli start` runs a minimal set of services (enough for product analytics). To customize which services start, run `hogli dev:setup` which lets you select intents based on the products you're working on. Your choices are saved and used automatically by `hogli start`.
+The session replay video export worker builds a Docker image on its first start, then reuses the cached image. It runs in development mode to accept Django's default development key. The launcher translates HTTP loopback storage URLs to `host.docker.internal`, preserving optional ports and paths. It maps that hostname to Docker's host gateway so the container can reach host object storage on native Linux too. A worker startup failure returns a nonzero exit code.
+
### Setting environment variables
Three env files come into play when `hogli start` runs: