Skip to content

- PostHog a product management tool

This week, I read an article on dev.to about some excellent OpenSource tools. Being a bit partial to free candy, I decided to check them out. Where I am working right now, a lot of the tooling and UI seems to be internal. We have a new product owner, who I asked if they had used PostHog before, as well as asking in a UX chat-group I have been a part of for some years.

Getting Started

I Had written a note, which was something simple like "look at posthog". I knew it had mentioned analytics and feature flags, which are two areas I am quite passionate about. Duck Duck Go was my friend here.

They are clearly going the Open-Source with commercial backing route, which made finding the instructions less straightforward than smaller projects, which generally have everything a few clicks away. I Clicked "get started", then on the left-hand side used the "Open Source" link where they were attempting to funnel me to the SaaS version. If you like SaaS, or are less technically minded, this might be a better option for you.

From the OpenSource page, you are dropped into the docs, where I feel quite at home. They have a one-click deploy to Heroku, which I love. And also documentation for a lot of different platforms. I wanted to try this locally, as I feel I need to know more before deploying anything to the internet. I have a lovely 128GB RAM server I can throw things onto and forget about, with a slither of the AWS bill. It's local, but I love it.

Slightly less clear than I would like

The instructions for docker suggest that I need to git clone the posthog repository. This was unfortunate, as I really did not want to look at the source code yet. If it were not enjoyable, reasonably turn-key, I might have glanced and never touched it again.

I had been playing with some other software, which also used Docker and docker-compose to deploy and aside from some confusion around the necessity of their CLI; it was a lot easier to configure and play with.

Eventually I tested the following setup, which I prefer. It's a single file, not a repo. Does not care about GitHub, or git, or archives. Just one text file, and an internet connection.

docker-compose.yml
services:
    db:
        container_name: posthog_db
        environment:
            POSTGRES_DB: posthog
            POSTGRES_PASSWORD: posthog
            POSTGRES_USER: posthog
        image: postgres:13-alpine
        volumes:
            - postgres-data:/var/lib/postgresql/data
    redis:
        container_name: posthog_redis
        image: redis:6-alpine
    web:
        container_name: posthog_web
        depends_on:
            - db
            - redis
        environment:
            DATABASE_URL: postgres://posthog:posthog@db:5432/posthog
            REDIS_URL: redis://redis:6379/
            SECRET_KEY: fwkh34tr7rfihskjhf47fyworshfs
            DEBUG: 'true'
            SITE_URL: http://192.168.99.102:8000
            JS_URL: http://192.168.99.102:8234
            DISABLE_SECURE_SSL_REDIRECT: 'true'
            ALLOWED_HOSTS: '*'
        image: posthog/posthog:latest
        links:
            - db:db
            - redis:redis
        ports:
            - 8000:8000
            - 80:8000
volumes:
    postgres-data:
version: '3'

Some notes on this

  • This is for running on my local windows machine.
  • http://192.168.99.102 is the docker-machine address. Yours will likely be http://127.0.0.1/ or http://localhost
  • This is pulling the latest edge build. That might lead to stability issues if you try.
  • I just mashed some keys to get the secret key
  • Because I am running locally, I provided the following options
    • DEBUG - set to true, so I could see what I screw up.
    • SITE_URL - I wanted to be sure.
    • JS_URL - I wanted to be sure.
    • DISABLE_SECURE_SSL_REDIRECT - Not setting this seemed to be pain.
    • ALLOWED_HOSTS - by the time I got here, I just wanted to be sure.

All I had to type after this was docker-compose up -d and a few minutes later, I had a working install.

Things I like

  • Visually appealing to me.
  • Has keyboard shortcuts, and surfaces them in non-annoying way.
  • Session recording was an option.
  • Support for multiple projects.
  • Support for plugins, with clear documentation on authoring.
  • Setting up Integration came with code examples.
  • Slack Community.
  • Powerful feature flagging.

Things I would change

  • I Had to turn on session recording.
  • The session recording close button sometimes breaks, needing a refresh.
  • Because of the GitHub advice, I first used docker-compose.dev.yml... On windows.
  • I Think their docker-compose should be distributed standalone.
  • I Think their tagging strategy of latest and latest-release should be latest and latest-edge / nightly.
  • Feature flagging is on/off, which is fine, but also involves more dev work.
  • The API seemed to be missing an endpoint, to get all features or experiments for a user.
  • The API seemed to be missing an endpoint, to post a batch of events / activities.
  • No obvious way to Opt users out of experiments.

Conclusion

If you have never used PostHog, try it out. I would rate it 4.5 out of 5 stars, and mostly because of non-OpenSource tooling I have built and worked with in the past. Do not build your own. Go buy something, and strongly-consider PostHog, as it respects your freedoms.

By