DEV Community

Cover image for Deploy Permit.IO PDP To Heroku Under 5 Mins! [Video Included]
Aidityas Adhakim
Aidityas Adhakim

Posted on

Deploy Permit.IO PDP To Heroku Under 5 Mins! [Video Included]

πŸš€ 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=<your-permit-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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

🚒 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}
Enter fullscreen mode Exit fullscreen mode

Your Permit.io PDP is now live on Heroku! πŸ”₯

Tutorial Video!

Tutorial Video

Top comments (0)