🚀 Deploying Permit.io PDP to Heroku

Let’s deploy your Permit.io Policy Decision Point (PDP) to Heroku — the easy way. Follow along!


✅ Prerequisites

Before we get started, make sure you have the following:

  • 🧾 A Heroku account — I'm using the free tier via GitHub Student Pack. Thanks GitHub! 🙌. Make sure you create an app that is the target of your deployment.
  • 🛠️ Installed Heroku CLI
  • 🚫 No need for Docker Desktop installed locally
  • 🐶 A Permit.io account
  • 🧑‍💻 Git installed

🛠️ Setup

  1. Create a working directory
  2. Ensure Heroku CLI is installed:

    heroku -v
    
  3. Login to Heroku:

    heroku login
    
  4. Authenticate with the Heroku Container Registry:

    heroku container:login
    
  5. Make sure you’ve created an app on Heroku

  6. Set environment variables:

    heroku config:set PDP_API_KEY= -a your-app-name
    heroku config:set PDP_DEBUG=True -a your-app-name
    
  7. Set your app to use the container stack:

    heroku stack:set container
    

⚙️ Configuration File

1. Create a Dockerfile

Inside your directory, create a Dockerfile:

# ./created-directory/Dockerfile

FROM permitio/pdp-v2:latest

CMD uvicorn horizon.main:app --host 0.0.0.0 --port $PORT

This ensures Permit PDP uses the correct port that Heroku assigns dynamically.


2. Create a heroku.yml File

This tells Heroku how to build and deploy your Docker container:

# ./created-directory/heroku.yml

build:
  docker:
    web: Dockerfile

🚢 Deployment

  1. Initialize a Git repository:

    git init
    git add .
    git commit -m "Initialize Heroku config"
    
  2. Connect your repo to Heroku:

    heroku git:remote -a yourapp
    
  3. Push to Heroku to build and deploy:

    git push heroku master
    
  4. Open your app in the browser:

    heroku open
    

🎉 Success!

You should see this response:

{"status":"ok","online":true}

Your Permit.io PDP is now live on Heroku! 🔥

Tutorial Video!

Tutorial Video