
Deploy PgDog
PgDog 0.1 Postgres connection pooler and load balancer, with Postgres.
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host PgDog on Railway
PgDog is a modern PostgreSQL connection pooler, load balancer and sharding proxy written in Rust. Applications connect to it like a normal Postgres server, and it multiplexes many client connections onto a small pool of server connections with transaction pooling, health checks and failover. It is a newer alternative to PgBouncer.
About Hosting PgDog
This template deploys PgDog v0.1.59 from the official image in front of a Railway Postgres database. The start command writes the pooler and user config from Railway references, so the database and credentials are wired up automatically, with a pool of 20 server connections. Apps connect to PgDog over the private network on port 6432 with the normal Postgres credentials, and external clients use the Railway TCP proxy. An admin database with its own generated password shows pools and statistics. PgDog keeps no state, so it needs no volume and fits the Hobby plan.
Common Use Cases
- Handling many short-lived connections from serverless functions and autoscaled services
- Reducing Postgres memory use by pooling connections
- A foundation for read replicas, load balancing and sharding later
Dependencies for PgDog Hosting
ghcr.io/pgdogdev/pgdog:v0.1.59(official image)- Railway Postgres (
ghcr.io/railwayapp-templates/postgres-ssl:18) with a volume - A Railway TCP proxy for external clients
Deployment Dependencies
Implementation Details
| Service | Image | Networking | Storage |
|---|---|---|---|
| pgdog | ghcr.io/pgdogdev/pgdog:v0.1.59 | private 6432; TCP proxy to 6432; health on 8080 | none |
| Postgres | Railway Postgres 18 | private only | volume |
DATABASE_URL=${{pgdog.DATABASE_URL}} # inside Railway
DATABASE_PUBLIC_URL=${{pgdog.DATABASE_PUBLIC_URL}} # external, via TCP proxy
psql "postgres://admin:$PGDOG_ADMIN_PASSWORD@:6432/admin" -c "SHOW POOLS"
| Variable | Default | Purpose |
|---|---|---|
PGDOG_POOL_SIZE | 20 | Server connections per pool |
PGDOG_ADMIN_PASSWORD | generated | Admin database password |
Notes:
- Transaction pooling is the default: session features such as
SETand advisory locks behave per transaction. UseSET LOCALin transactions. - The TCP proxy carries Postgres traffic without TLS from PgDog; prefer the private network.
This is a community-maintained deployment package and does not imply affiliation with or endorsement by the PgDog project or its maintainers.
Why Deploy PgDog on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying PgDog on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content