Skip to Content
DocsSelf-HostingRequirements

Requirements

Hardware, software, and infrastructure requirements for running Pug.

Runtime

RequirementVersionNotes
Go1.23+Build the server and workers
Docker20+Local infra via make infra-up
Docker Compose2+Multi-service local stack

Production deployments can run binaries directly without Docker.

Infrastructure services

ServiceVersionPurposeHA notes
PostgreSQL15+Auth, orgs, projects, configRead replicas supported
ClickHouse24+Event storage, analytics queriesCluster for scale
NATS2.10+Async pipeline, JetStream required3-node cluster minimum

CLI commands

The pug binary provides all operations:

# Server pug server # Connect RPC API # Workers pug worker events # Event ingestion + enrichment pug worker profile # Profile writes (identify, alias) pug worker email # Magic link + transactional email pug worker scheduler # Scheduled jobs # Migrations pug postgres migrate # Postgres schema migrations pug clickhouse migrate # ClickHouse schema migrations pug nats migrate # NATS stream setup

In development, make dev starts the server and all workers together with hot reload.

Hardware sizing

Development / staging

ComponentSpec
Server2 vCPU, 4 GB RAM
Postgres1 vCPU, 2 GB RAM, 20 GB disk
ClickHouse2 vCPU, 4 GB RAM, 50 GB disk
NATS1 vCPU, 1 GB RAM

Handles ~100 events/second comfortably.

Production (small)

ComponentSpec
API server2 vCPU, 4 GB RAM (scale horizontally)
Workers2 vCPU, 4 GB RAM (one process per worker type)
Postgres2 vCPU, 8 GB RAM, 100 GB SSD
ClickHouse4 vCPU, 16 GB RAM, 500 GB SSD
NATS2 vCPU, 4 GB RAM

Handles ~1,000 events/second, ~100M stored events.

Production (large)

ComponentSpec
API server4+ replicas, 4 vCPU each
WorkersScale event worker horizontally
PostgresPrimary + 2 read replicas, 16 GB RAM
ClickHouse3-node cluster, 32 GB RAM each
NATS3-node cluster

Handles ~10,000+ events/second. Contact the team for ClickHouse sharding guidance at higher volumes.

Network requirements

PortServiceAccess
8080API serverPublic (behind TLS terminator)
5432PostgresInternal only
8123ClickHouse HTTPInternal only
4222NATSInternal only

The API server is the only public-facing component. All other services should be on a private network.

Production checklist

  • TLS termination configured (nginx, Caddy, or cloud load balancer)
  • X-Forwarded-For forwarded correctly for geo enrichment
  • Postgres automated backups enabled
  • ClickHouse backup strategy defined
  • NATS JetStream persistence on durable storage
  • Secrets in a secrets manager, not in .env files
  • Monitoring on worker lag, API latency, ClickHouse disk usage
  • Log aggregation configured

Further reading

Last updated on