DocsDeployment

Deployment

Deploy Postrust to Docker, AWS Lambda, Kubernetes, and more.

Docker

docker run -d \
  --name postrust \
  -p 3000:3000 \
  -e DATABASE_URL="postgres://user:pass@host:5432/db" \
  -e PGRST_DB_ANON_ROLE="web_anon" \
  -e PGRST_JWT_SECRET="your-secret-key" \
  postrust/postrust:latest

Docker Compose

docker-compose.yml
version: '3.8'

services:
  postgres:
    image: postgres:16-alpine
    environment:
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: app
    volumes:
      - postgres_data:/var/lib/postgresql/data

  postrust:
    image: postrust/postrust:latest
    depends_on:
      - postgres
    environment:
      DATABASE_URL: postgres://postgres:postgres@postgres:5432/app
      PGRST_DB_ANON_ROLE: web_anon
      PGRST_JWT_SECRET: ${JWT_SECRET}
    ports:
      - "3000:3000"

volumes:
  postgres_data:

AWS Lambda

# Build for Lambda
cargo lambda build --release -p postrust-lambda

# Deploy with AWS SAM
sam build && sam deploy --guided

See the full deployment guide for SAM templates and Serverless Framework examples.

Fly.io

# Install Fly CLI
curl -L https://fly.io/install.sh | sh

# Launch app
fly launch

# Set secrets
fly secrets set DATABASE_URL="postgres://..."
fly secrets set PGRST_JWT_SECRET="..."

# Deploy
fly deploy

Railway

# Install Railway CLI
npm install -g @railway/cli

# Login and initialize
railway login
railway init

# Set variables
railway variables set DATABASE_URL="postgres://..."

# Deploy
railway up

Production Checklist

Use HTTPS/TLS in production
Set strong JWT secret (min 32 characters)
Configure proper CORS origins
Enable Row Level Security on all tables
Set appropriate MAX_ROWS limit
Configure health checks
Set up log aggregation
Enable database backups