Self-Hosting
You can run the full Pia stack on your own infrastructure using Docker Compose.
Requirements
Section titled “Requirements”- Docker and Docker Compose
- A domain with DNS configured
- 1 GB RAM minimum
Quick Start
Section titled “Quick Start”- Clone the repository:
git clone https://github.com/Pia-Ai-dev/Pia.gitcd Pia- Copy and configure the environment file:
cp .env.example .env.prod- 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>- Start the services:
docker compose -f docker-compose.prod.yml up -dArchitecture
Section titled “Architecture”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 |
Caddy Configuration
Section titled “Caddy Configuration”Update the Caddyfile with your domain:
your-domain.com { reverse_proxy pia-server:8080}Caddy handles TLS certificate provisioning automatically via Let’s Encrypt.
Updating
Section titled “Updating”docker compose -f docker-compose.prod.yml pulldocker compose -f docker-compose.prod.yml up -d