Back to all templates
PostHog logo

PostHog

Application2048MB+ RAM

Product analytics with session recordings and feature flags

analyticsproductsession-recordingfeature-flags

Deploy PostHog in 3 Steps

1

Connect Your VPS

Add your server credentials to Server Compass

2

Select PostHog

Choose from our template library

3

Deploy & Configure

Fill in settings and click Deploy

No Docker knowledge required
Step-by-step deployment guide

Deploy PostHog on a VPS with Server Compass

Use the PostHog template in Server Compass to deploy the official self-hosted hobby stack with PostgreSQL, Redis, ClickHouse, Redpanda, Temporal, object storage, and PostHog services on your VPS, then verify the web UI in a browser.

About 12 minutesBrowser verified
1
Step 1

Open the server Apps tab

Select your VPS, open the Apps tab, and start a new app deployment. Keep sensitive server details hidden before capturing or sharing screenshots.

Server Compass Apps tab before creating a PostHog app
2
Step 2

Choose an app template

Click New App and choose the template deployment path so Server Compass can load the built-in catalog.

Choosing to deploy an app from a Server Compass template
3
Step 3

Search for PostHog

Use the template picker search to find PostHog in the Server Compass template catalog.

Searching for PostHog in the Server Compass template picker
4
Step 4

Select the PostHog template

Choose the PostHog template. Server Compass fills the host port, public domain, generated secrets, official image settings, and proxy values used by the generated hobby stack.

PostHog template selected in Server Compass
5
Step 5

Review the PostHog settings

Confirm the app name and compose services. In this run, the app was named posthog-demo and used host port 4800.

Reviewing PostHog project settings and compose services
6
Step 6

Deploy PostHog

Review the generated environment values, confirm the port is available, and click Deploy Now.

Reviewing PostHog environment variables and port before deployment
7
Step 7

Watch the deployment progress

Keep the deployment modal open while Server Compass uploads the compose file, prepares the official PostHog hobby files, pulls the service images, starts the containers, and verifies the stack.

Server Compass deploying the PostHog template on the VPS
8
Step 8

Confirm PostHog is running

After deployment finishes, return to the Apps tab and confirm the PostHog app is marked Running with its application URL available.

PostHog template running in the Server Compass Apps tab
9
Step 9

Open PostHog in the browser

Open the application URL in a browser. The PostHog preflight web UI confirms the site is reachable and core services are responding.

The deployed PostHog web UI loaded in a browser

After PostHog Opens

  • Create the first PostHog account and organization before production use.
  • Configure product event ingestion, HTTPS, email, and user access before production use.
  • Add a domain and HTTPS before exposing the analytics dashboard to users.
  • Back up the PostHog PostgreSQL and ClickHouse volumes before relying on it for production analytics.

Verified Result

The PostHog preflight web UI loaded successfully in Chromium at http://167.233.138.53:4800/.

PostHog deployment questions

What does the PostHog template deploy?

It deploys the official PostHog hobby stack, including PostHog web/worker services, PostgreSQL, Redis, ClickHouse, Redpanda, Temporal, object storage, Browserless, and supporting ingestion services.

Which port did the tutorial use?

The tutorial used host port 4800, which maps to the PostHog Caddy proxy on container port 80.

Why does the guide stop at the preflight web UI?

The tutorial verifies a clean first-run deployment because real analytics events, users, projects, and access settings depend on your production server.

Should this become a blog post?

No. The deployment guide should live on the PostHog template detail page and be linked from the reusable template deployment docs page.

Manual Deployment Guide

Manual PostHog Setup

For terminal enthusiasts: deploy PostHog manually with these simple steps.

1

Connect to Your Remote Server

Begin by establishing a secure connection to your server through the terminal.

terminal
# Access your VPS
ssh root@YOUR_SERVER_IP

# With SSH key authentication
ssh -i ~/.ssh/your-private-key root@YOUR_SERVER_IP

First time? Ensure Docker is installed first: curl -fsSL https://get.docker.com | sh

2

Set Up Your App Folder

Create a dedicated folder for your application files.

terminal
# Create and navigate to project directory
mkdir -p ~/apps/posthog
cd ~/apps/posthog
3

Set Up Docker Compose

Create the following docker-compose.yml in your project directory:

docker-compose.yml
services:
  posthog:
    image: posthog/posthog:latest
    ports:
      - "8000:8000"
    environment:
      - DATABASE_URL=postgres://posthog:<your-db-password>@db:5432/posthog
      - REDIS_URL=redis://redis:6379
      - SECRET_KEY=<your-secret-key>
      - SITE_URL=<your-site-url>
    restart: unless-stopped
    depends_on:
      - db
      - redis
      - clickhouse

  db:
    image: postgres:16-alpine
    environment:
      - POSTGRES_USER=posthog
      - POSTGRES_PASSWORD=<your-db-password>
      - POSTGRES_DB=posthog
    volumes:
      - postgres_data:/var/lib/postgresql/data
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    restart: unless-stopped

  clickhouse:
    image: clickhouse/clickhouse-server:latest
    volumes:
      - clickhouse_data:/var/lib/clickhouse
    restart: unless-stopped

volumes:
  postgres_data:
  clickhouse_data:
Environment Configuration
PORTHost port(default: 8000)
SITE_URLSite URL
SECRET_KEYSecret key
DB_PASSWORDDB password
4

Spin Up the Stack

Run Docker Compose to launch your application.

terminal
# Launch the stack
docker compose up -d

# Verify container status
docker compose ps

# Follow the logs
docker compose logs --follow
5

Open the Application Port

Configure UFW to allow traffic to your application.

terminal
# Allow the application port through firewall
sudo ufw allow 8000/tcp
sudo ufw reload

# Access your app at:
# http://your-server-ip:8000
Skip the Terminal

Make it simple with Server Compass.

Deploy PostHog without touching the command line. Server Compass gives you a clean UI for one-click deployments.

  • No terminal required
  • Point-and-click setup
  • Auto SSL certificates
  • Rolling deployments
  • Health monitoring
  • Instant rollbacks
Download Server Compass$29 one-time • Lifetime license

After Deployment

After deploying PostHog with Server Compass, complete these steps to finish setup

1

Create admin account

2

Create project

3

Install tracking snippet

Need help? Check out our documentation for detailed guides.

PostHog FAQ

Common questions about self-hosting PostHog

How do I deploy PostHog with Server Compass?

Simply download Server Compass, connect to your VPS, and select PostHog from the templates list. Fill in the required configuration and click Deploy. The entire process takes under 3 minutes.

What are the system requirements for PostHog?

PostHog requires a minimum of 2048MB RAM. We recommend a VPS with at least 4096MB RAM for optimal performance. Any modern Linux server with Docker support will work.

Can I migrate my existing PostHog data?

Yes! Server Compass provides volume mapping that allows you to import existing data. You can also use standard PostHog backup and restore procedures.

How do I update PostHog to the latest version?

Server Compass makes updates easy. Simply click the Update button in your deployment dashboard, and the latest PostHog image will be pulled and deployed with zero downtime.

Is PostHog free to self-host?

PostHog is open-source software. You only pay for your VPS hosting (typically $5-20/month) and optionally Server Compass ($29 one-time). No subscription fees or per-seat pricing.

Ready to Self-Host PostHog?

Download Server Compass and deploy PostHog to your VPS in under 3 minutes. No Docker expertise required.

Download Server Compass