Deploy PostHog


PostHog is an open source product analytics platform made with developers in mind. It automates collection of events and behavior metrics in web and mobile applications, providing complete product analytics with an API and full SQL access to your data. PostHog’s features include:

  • Event-based analytics at a user level — see which users are doing what in your application.
  • Complete control over your data — host it yourself.
  • Automatically capture clicks and page views to do analyze what your users are doing retroactively.
  • Feature flags understand the impact of new features before rolling them out more widely.
  • Libraries for JS, Python, Ruby, Node, Go and an API for everything else else.
  • Beautiful graphs, funnels, user cohorts, user paths and dashboards.

PostHog Screenshot


You can host your own instance of PostHog on Render with just a couple of clicks. This includes a production-ready PostHog instance that's ready to scale to billions of events with the following services:
  • Render’s fully managed PostgreSQL.
  • A private Redis instance.
  • A background worker for asynchronous processing.
  • PostHog’s web dashboard with free managed SSL and custom domain support.

Your instance will be up in a few minutes and you will be able to log in and get your write key and code snippets to add PostHog to your site or mobile app.


Click Deploy to Render below to set up PostHog on Render.

Deploy to Render


The rest of this document explains how to set up PostHog on Render manually.

Create a Database

Create a new managed PostgreSQL instance on Render. The database should be up in a few minutes; wait for it to go live before moving to the next step.

Note your database internal connection string; you will need it later.

Create a Redis Instance

Create a new private Redis instance using the Redis deployment guide and make a note of the service name and port.

Deploy PostHog

  1. Fork render-examples/posthog on GitHub or click Use this template.
  2. First, we will set up PostHog’s Celery worker: create a new Background Worker on Render and give Render’s GitHub app permission to access your new repository. Make sure the Environment is set to Docker and pick a name for your worker.
  3. Under Advanced, make sure to pick the right Dockerfile and context for the background worker:

    PropertyValue
    Docker Build Context Directory./worker
    Dockerfile Path./worker/Dockerfile
  4. Add the following environment variables.

    KeyValue
    POSTHOG_REDIS_HOSTyour Redis service name
    POSTHOG_REDIS_PORTyour Redis service port
    DATABASE_URLyour database internal connection string
  5. Click Create Background Worker to deploy your worker.
  6. Now, we will create PostHog’s web server: create a new Web Service on Render. Set Environment to Docker and pick a name for your service, for example: posthog.
  7. Under Advanced, pick correct Dockerfile for the server container:

    PropertyValue
    Docker Build Context Directory./server
    Dockerfile Path./server/Dockerfile
  8. Add the following environment variables.

    KeyValue
    IS_BEHIND_PROXY1 (Without this PostHog would greet you with redirection loop!)
    POSTHOG_REDIS_HOSTyour Redis service name
    POSTHOG_REDIS_PORTyour Redis instance listening port
    DATABASE_URLyour database internal connection string

That’s it! Save your web service to deploy PostHog on Render. Your PostHog instance will be available on your .onrender.com URL as soon as your first deploy is live. You can configure it by going to https://your-subdomain.onrender.com and start using PostHog.

PostHog welcome screen

See PostHog Docs for more.