Skip to content

Self-Hosting

You can run the full Pia stack on your own infrastructure using Docker Compose.

  • Docker and Docker Compose
  • A domain with DNS configured
  • 1 GB RAM minimum
  1. Get the deployment bundle:

Pia Server is source-available. Request the server source, the deployment files used below (docker-compose.prod.yml, .env.example, Caddyfile) and access to the container images from kontakt@pia-ai.de — the same address that issues the licence. Unpack what you get back, then run the remaining steps from that directory.

  1. Copy and configure the environment file:
Terminal window
cp .env.example .env.prod
  1. Set the required environment variables in .env.prod:
JWT_SECRET_KEY=<generate-a-random-64-char-string>
ENCRYPTION_MASTER_KEY=<generate-a-random-64-char-string>
POSTGRES_PASSWORD=<strong-password>
  1. Start the services:
Terminal window
docker compose -f docker-compose.prod.yml up -d

The production stack consists of:

Service Image Port Purpose
Caddy caddy:2-alpine 80, 443 Reverse proxy + auto HTTPS
Pia Server ghcr.io/pia-ai-dev/pia-server 8080 API server
PostgreSQL postgres:17-alpine 5432 Database

Update the Caddyfile with your domain:

your-domain.com {
reverse_proxy pia-server:8080
}

Caddy handles TLS certificate provisioning automatically via Let’s Encrypt.

Terminal window
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d