PostHog is a developer-friendly open-source product analytics tool. With PostHog, you can automate the collection of events on your websites and apps and analyze them without sending data to third parties.
By deploying your PostHog application on Koyeb you benefit from native autoscaling, Automatic HTTPS (SSL) on all apps you deployed, high availability, and global load-balancing & CDN to make your applications global.
To successfully deploy PostHog on Koyeb, you need:
In order to deploy your PostHog app to Koyeb, you have to follow these steps:
Start by creating a new Koyeb App we will deploy and run PostHog. In a terminal execute the following commands to create a new App:
koyeb app create posthog
With the PostHog Koyeb App created, we now can deploy the Redis service required by PostHog. In a terminal, execute the following command to deploy the Redis instance:
koyeb service create redis -a posthog --docker redis:6-alpine --ports 6379:tcp --routes ""
Koyeb Secrets allow you to securely store and retrieve sensitive information like passwords. All Secret values are automatically encrypted server-side to ensure secure storage. To find out more about Koyeb Secrets, read our documentation about it here.
For PostHog to work, you must create a
SECRET_KEY that is unique to your PostHog instance. This
SECRET_KEY is very important because it is used to encrypt cookies and password reset emails.
To create your
SECRET_KEY and store it as a Koyeb Secret, in your terminal execute:
openssl rand -hex 32 | koyeb secret create posthog-secret-key --value-from-stdin
The command below generates a new key and creates a new Koyeb Secret
posthog-secret to securely store the key on Koyeb.
Create a Koyeb secret to securely store your PostgreSQL connection URL.
In the terminal execute the following command and replace the following values with your own:
<DB_USERNAME>: PostgreSQL username
<DB_PASSWORD>: PostgreSQL password
<DB_HOST>: PostgreSQL host
<DB_PORT>: PostgreSQL port
<DB_NAME>: PostgreSQL database name
$koyeb secret create posthog-db-url ✔ Enter your secret: postgres://<DB_USERNAME>:<DB_PASSWORD>@<DB_HOST>:<DB_PORT>/<DB_NAME>
With al the previous steps completed, you are ready to deploy PostHog on Koyeb. In the terminal execute the following command:
koyeb service create posthog -a posthog --docker posthog/posthog:latest --ports 8000:http --routes /:8000 --env REDIS_URL=redis://redis --env SECRET_KEY=@posthog-secret-key --env DATABASE_URL=@posthog-db-url --env IS_BEHIND_PROXY=1
Within a few minutes you will be able to access your PostHog instance at
You can track the deployment logs in your terminal with this command:
koyeb service logs posthog
Your PostHog application is now running on Koyeb and benefits from native autoscaling, automatic HTTPS (SSL), auto-healing, and global load-balancing across our edge network.
In this guide, we saw how easy it is to deploy PostHog on Koyeb and how to interact with the Koyeb platform using the CLI.
If you would like to read more Koyeb tutorials, checkout out our tutorials collection. Have an idea for a tutorial you'd like us to cover? Let us know by joining the conversation over on the Koyeb Slack community!
Want to deploy your workloads on Koyeb? We let you run web apps, APIs, background workers, and more using git-based deployment or Docker containers! Enjoy native autoscaling, free SSL, a global edge network, and built-in service mesh and discovery with near zero configuration. Sign up and get started now
Koyeb is a developer-friendly serverless platform to deploy any apps globally.Start for free
Deploy 2 services for free and enjoy our predictable pricing as you grow
Get up and running in 5 minutes