Deploying from Source

Why Source Install

To install from source, you need to build the source code and take care of the dependencies yourself. Likewise, you also need to be aware of all the features of the package so that you can build it accordingly.

Although it may be time consuming and difficult to manage, installing from source has a few advantages:

  • Just like our other deployments, always stay updated, whether it be a security patch or a new feature!
  • Add features which may not be provided in the binary.
  • Install it in a location you wish.

In short, installing from source gives you access to enhanced customization but takes a lot of effort. On the other hand, installation from a a pre-pacakged binary (e.g. Heroku One-Click Install or Docker Image) is easier but you can't customize as you wish.

If there is no desire to customize your source, we strongly recommend other deployment options like Heroku, Docker, etc.


Step By Step Installation

  1. Run the following:

    git clone 
    cd posthog && yarn build
    pip install -r requirements.txt
    export DATABASE_URL=''
    export REDIS_URL=''
    python runserver
    python collectstatic
  2. To start the server and worker, run:

    ./bin/docker-server & ./bin/docker-worker

We reccomend using something like Supervisor to keep this command running. This is important because once you exit the current shell the process will stop. This happens for example when you terminate an SSH session. As such, you need to run these commands in detached mode, which Supervisor allows you to do.