: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
#!/bin/bash
set -o pipefail
set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
mkdir -p "$DIR/../share"
if [ ! -f "$DIR/../share/GeoLite2-City.mmdb" ] || [ ! -f "$DIR/../share/GeoLite2-City.json" ]; then
rm -f "$DIR/../share/GeoLite2-City.mmdb" "$DIR/../share/GeoLite2-City.json"
TMPFILE=$(mktemp)
trap 'rm -f "$TMPFILE"' EXIT
echo "Downloading GeoLite2-City.mmdb..."
if curl -L "https://mmdbcdn.posthog.net/" \
--http1.1 \
--fail \
--retry 10 \
--retry-max-time 300 \
--retry-all-errors \
--connect-timeout 10 \
--speed-limit 10240 \
--speed-time 30 \
--progress-bar \
--show-error \
--output "$TMPFILE"; then
echo "Download successful, decompressing..."
brotli --decompress --output="$DIR/../share/GeoLite2-City.mmdb" "$TMPFILE"
else
echo "Download failed after retries"
exit 1
fi
DATE=$(date +"%Y-%m-%d")
echo "{ \"date\": \"$DATE\" }" >"$DIR/../share/GeoLite2-City.json"
chmod 644 "$DIR/../share/GeoLite2-City.mmdb" "$DIR/../share/GeoLite2-City.json"
fi