A helpful little TUI for connecting to remote Postgres databases
  • Go 99.7%
  • Dockerfile 0.3%
Find a file
2026-04-07 16:42:37 -06:00
.claude fix: tweaks to backup and restore 2026-04-07 13:35:52 -06:00
.github Initial commit 2026-03-22 00:13:48 +00:00
.gitignore review and fixes 2026-03-21 19:00:04 -06:00
.goreleaser.yml Initial commit 2026-03-22 00:13:48 +00:00
.mise.toml Initial commit 2026-03-22 00:13:48 +00:00
backup.go fix: broken tests 2026-04-07 16:42:37 -06:00
backup_test.go fix: tweaks to backup and restore 2026-04-07 13:35:52 -06:00
clipboard.go Initial commit 2026-03-22 00:13:48 +00:00
clipboard_test.go review and fixes 2026-03-21 19:00:04 -06:00
config.go feat: implement backup and restore functionality with progress tracking 2026-04-06 16:31:02 -06:00
config.yaml.example Initial commit 2026-03-22 00:13:48 +00:00
config_test.go review and fixes 2026-03-21 19:00:04 -06:00
discovery.go refactor: update Docker command handling to use user permissions first, falling back to sudo 2026-04-06 16:31:10 -06:00
discovery_test.go review and fixes 2026-03-21 19:00:04 -06:00
Dockerfile Initial commit 2026-03-22 00:13:48 +00:00
Dockerfile.goreleaser Initial commit 2026-03-22 00:13:48 +00:00
go.mod Initial commit 2026-03-22 00:13:48 +00:00
go.sum Initial commit 2026-03-22 00:13:48 +00:00
help.go feat: implement backup and restore functionality with progress tracking 2026-04-06 16:31:02 -06:00
LICENSE Initial commit 2026-03-22 00:13:48 +00:00
logo.png Add logo image and update README for visual enhancement 2026-03-22 09:18:56 -06:00
main.go review and fixes 2026-03-21 19:00:04 -06:00
ports.go Initial commit 2026-03-22 00:13:48 +00:00
ports_test.go review and fixes 2026-03-21 19:00:04 -06:00
README.md refactor: update Docker command handling to use user permissions first, falling back to sudo 2026-04-06 16:31:10 -06:00
sshclient.go refactor: update Docker command handling to use user permissions first, falling back to sudo 2026-04-06 16:31:10 -06:00
sshclient_test.go review and fixes 2026-03-21 19:00:04 -06:00
styles.go fix: tweaks to backup and restore 2026-04-07 13:35:52 -06:00
styles_test.go review and fixes 2026-03-21 19:00:04 -06:00
taglines.go Initial commit 2026-03-22 00:13:48 +00:00
tunnel.go refactor: update Docker command handling to use user permissions first, falling back to sudo 2026-04-06 16:31:10 -06:00
ui.go fix: tweaks to backup and restore 2026-04-07 13:35:52 -06:00
updater.go Initial commit 2026-03-22 00:13:48 +00:00
updater_test.go review and fixes 2026-03-21 19:00:04 -06:00

DrillBit logo

DrillBit

Terminal UI for managing SSH tunnels to PostgreSQL databases across Docker environments.

DrillBit connects to your SSH hosts, discovers running PostgreSQL containers (including PostGIS and TimescaleDB), and lets you open tunnels to them with a single keypress. It assigns deterministic local ports so your connection strings stay stable across restarts.

Features

  • Auto-discovery of PostgreSQL, PostGIS, and TimescaleDB containers via Docker
  • SSH tunnel management with connection pooling and automatic reconnection
  • Deterministic ports — same host/container always maps to the same local port
  • Credential overrides — set user/password/database per container and persist to config
  • Autoconnect — mark databases to connect on startup
  • SQL client integration — launch pgcli or psql directly from the UI
  • Clipboard support — copy passwords or connection strings (auto-clears after 30s)
  • Self-update with Sigstore signature verification
  • Fuzzy filtering to quickly find databases across many hosts

Requirements

  • SSH access to remote hosts (key-based auth via ssh-agent or key files)
  • Docker running on the remote hosts
  • Docker access on the remote hosts (tries user permissions first, falls back to sudo)
  • Containers must have POSTGRES_PASSWORD set as an environment variable

Installation

Homebrew (macOS/Linux)

brew install jclement/tap/drillbit

Pre-built Binaries

Download the latest release for your platform from the releases page.

Docker

docker run --rm -it \
  -v ./config.yaml:/config.yaml \
  -v ~/.ssh:/root/.ssh:ro \
  ghcr.io/jclement/drillbit -c /config.yaml

Configuration

Create a config.yaml (or run drillbit once to scaffold one at ~/.config/drillbit/config.yaml):

hosts:
  - name: prod-server-1
    user: deploy
    env: prod                              # environment label (optional)
    databases:
      - container: myapp_db_1
        auto: true                         # connect on startup
      - container: otherapp_db_1
        auto: false
        password: custom-override-password # optional override
        user: myuser                       # optional override
        database: mydb                     # optional override

  - name: prod-server-2
    env: prod
    # No databases listed — will discover all Postgres containers on this host

  - name: test-server-1
    env: test
    databases:
      - container: testapp_db_1
        auto: true

See config.yaml.example for a complete example.

How discovery works

For each configured host, DrillBit:

  1. Opens an SSH connection (respects ~/.ssh/config for HostName, User, Port, IdentityFile)
  2. Runs docker ps to find containers with postgres, postgis, or timescale images (falls back to sudo docker if needed)
  3. Runs docker inspect to extract POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB
  4. Only shows containers that have POSTGRES_PASSWORD set

CLI Flags

drillbit [options]

Options:
  -c, --config <path>   Config file (default: ~/.config/drillbit/config.yaml)
  -e, --edit            Open config in $EDITOR
  -v, --version         Show version
  -h, --help            Show this help

Flags can be combined: drillbit -c /path/to/config.yaml -e opens a custom config in your editor.

Keybindings

Key Action
Space Toggle connect / disconnect
Enter Connect / launch SQL client (pgcli/psql)
c Configure overrides (user/password/db)
a Toggle autoconnect
y Copy menu (then p for password, c for connection string)
/ Filter entries (fuzzy search)
Esc Clear filter / quit (confirms if connections active)
r / Ctrl+R Refresh — re-discover all hosts
j / k / Up / Down Navigate
? Toggle help
u Update to latest version (when available)

Vibe coded with Claude