pgquery

pgquery / Self-hosted with Docker

Chapter 13 · Self-hosting

Self-host a Postgres GUI with one Docker command

pgquery is one image: a Go binary that serves the app and proxies queries. Run it on your laptop, a VPS or inside your cluster.

Run

docker run -p 54280:54280 ghcr.io/hxndrik/pgquery

Open http://localhost:54280. Images are published for amd64 and arm64.

Docker Compose

services:
  pgquery:
    image: ghcr.io/hxndrik/pgquery
    ports:
      - "54280:54280"
    environment:
      RATE_LIMIT_RPM: 120
    restart: unless-stopped

Settings

  • PORT: listen port, default 54280.
  • RATE_LIMIT_RPM: requests per minute per client IP.
  • MAX_QUERY_TIMEOUT and MAX_ROWS: limits per query.
  • DEMO_DATABASE_URL: run a public demo. pgquery seeds a sample database, serves it read-only and resets it daily (DEMO_RESET_INTERVAL). Instances with a demo also refuse private and local addresses.

Security notes

pgquery has no login of its own. Anyone who can reach it can use it to connect to databases they have credentials for. Put it behind your VPN, an authenticating reverse proxy (oauth2-proxy, Authelia, Cloudflare Access) or bind it to localhost.

Source: github.com/Hxndrik/pgquery

Questions

Does the container store my passwords?

No. Connection strings are saved in your browser and sent with each request; the container keeps no state.

Can I run it on a Raspberry Pi?

Yes. There is an arm64 image.

More chapters