10 Sentinels Active
SENTINEL 01: [AEGIS] AUDITING POCKETBASE INFRASTRUCTURE...
Back to Self-Hosted Stacks
PostHog

Deploy PostHog

๐Ÿฆ” PostHog is an all-in-one developer platform for building successful products. We offer product analytics, web analytics, session replay, error tracking, feature flags, experimentation, surveys, data warehouse, a CDP, and an AI product assistant to help debug your code, ship features faster, and keep all your usage and customer data in one stack.

Quick Start

1

Create a directory

mkdir posthog-self-hosted && cd posthog-self-hosted
2

Create config file

Copy the content from the Config tab below into a file named docker-compose.yml

3

Deploy

docker compose up -d
Fast Track

Deploy PostHog in Minutes

Use our optimized Docker templates to deploy PostHog on any cloud provider. Get $200 in free credit to start on DigitalOcean.

Start with free creditDeploy on DigitalOcean
$200

Metadata

License
Other
Language
Python
Last Updated
10/14/2026
Category
Analytics

Configuration

yaml

# โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
# ๐Ÿš€ BUILT & MAINTAINED BY THE ALTSTACK
# ๐ŸŒ https://thealtstack.com
# ๐Ÿ’ก Open-source deployment templates for modern self-hosting.
# โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

# Docker Compose for PostHog (Hobby/Self-Hosted)
version: '3.8'

services:
  posthog_db:
    image: postgres:12-alpine
    container_name: posthog-db
    environment:
      - POSTGRES_PASSWORD=posthog
      - POSTGRES_DB=posthog
      - POSTGRES_USER=posthog
    volumes:
      - posthog_pg_data:/var/lib/postgresql/data
    networks:
      - posthog_net
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U posthog"]
      interval: 10s
      timeout: 5s
      retries: 5

  posthog_redis:
    image: redis:6-alpine
    container_name: posthog-redis
    networks:
      - posthog_net
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  posthog_web:
    image: posthog/posthog:latest
    container_name: posthog-web
    ports:
      - "8000:8000"
    environment:
      - DATABASE_URL=postgres://posthog:posthog@posthog_db:5432/posthog
      - REDIS_URL=redis://posthog_redis:6379/
      - SECRET_KEY=${SECRET_KEY:-replace-me-with-a-long-secret-key-for-posthog}
      - SITE_URL=http://localhost:8000
    depends_on:
      posthog_db:
        condition: service_healthy
      posthog_redis:
        condition: service_healthy
    networks:
      - posthog_net
    healthcheck:
      test: ["CMD", "wget", "--spider", "-q", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  posthog_worker:
    image: posthog/posthog:latest
    container_name: posthog-worker
    command: ./bin/docker-worker-celery
    environment:
      - DATABASE_URL=postgres://posthog:posthog@posthog_db:5432/posthog
      - REDIS_URL=redis://posthog_redis:6379/
      - SECRET_KEY=${SECRET_KEY:-replace-me-with-a-long-secret-key-for-posthog}
      - SITE_URL=http://localhost:8000
    depends_on:
      posthog_db:
        condition: service_healthy
      posthog_redis:
        condition: service_healthy
    networks:
      - posthog_net

networks:
  posthog_net:
    driver: bridge

volumes:
  posthog_pg_data:

Community Notes

Help others by adding context, corrections, or warnings about this tool. Sign in to contribute.

No community notes yet. Be the first to add context.