Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Posthog Unlocked Setup

Karambir Singh Nain edited this page Sep 24, 2023 · 4 revisions

Installation

Primarily docker compose is supported to run Posthog Installation. Use Posthog Official installation docs and change the docker image of posthog for web, worker and async migration to: ghcr.io/karambir/posthog-unlocked:latest.

Use the docker-compose.hobby.yml file.

Some helpful environment vars to be set in .env file for docker compose:

IS_DOCKER="true"
NODE_ENV="production"

# Django Web service
SECRET_KEY="randomkey"
SITE_URL="https://posthog.example.com"
DISABLE_SECURE_SSL_REDIRECT=True
IS_BEHIND_PROXY=True
# Trust all proxies or only trust host nginx
TRUST_ALL_PROXIES=True
# TRUSTED_PROXIES
DEPLOYMENT="onprem"

# Enable self capture
# See posthog/utils.py:206 line
# Capture posthog events in the same instance, not posthog.com
SELF_CAPTURE=True

Also add email related settings(in .env) for password reset and user invites to work:

EMAIL_ENABLED=True
EMAIL_HOST="smtphost.com"
EMAIL_PORT=587
EMAIL_HOST_USER="smtpuser"
EMAIL_HOST_PASSWORD="smtppassword"
EMAIL_USE_TLS=True
EMAIL_DEFAULT_FROM="user@example.com"

Setup

Once docker compose

Posthog unlocked has hard disabled signup, so you can't signup from web ui. Instead we have a small django management script to create a user. Checkout https://github.com/karambir/posthog-unlocked/blob/master/posthog/management/commands/create_staff_user.py

docker compose exec web python manage.py create_staff_user --first-name ExampleUser --email user@example.com --password examplePassword --org-name ExampleOrg

Once this is created, you can login, create and invite other users from web ui.

Clone this wiki locally