π 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)