๐ 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
- Create a working directory
-
Ensure Heroku CLI is installed:
heroku -v
-
Login to Heroku:
heroku login
-
Authenticate with the Heroku Container Registry:
heroku container:login
Make sure youโve created an app on Heroku
-
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
-
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
-
Initialize a Git repository:
git init git add . git commit -m "Initialize Heroku config"
-
Connect your repo to Heroku:
heroku git:remote -a yourapp
-
Push to Heroku to build and deploy:
git push heroku master
-
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! ๐ฅ
Top comments (0)