pgquery Open the app

pgquery / Self-hosted with Docker

Chapter 14 · Self-hosting

Self-host a Postgres GUI with one Docker command

The quickest way to use pgquery is the hosted app. Run your own copy when your database sits in a private network or on localhost, when you want your own limits, or when queries should not leave your network. It is one image: a Go binary that serves the app and proxies queries.

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.
  • MAX_UPLOAD_MB: largest file the S3 browser uploads, default 100.
  • 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.
  • DEMO_S3_ENDPOINT, DEMO_S3_ACCESS_KEY, DEMO_S3_SECRET_KEY: the same for a sample bucket. Give it a dedicated bucket (DEMO_S3_BUCKET): the seed removes everything that is not part of the sample.

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