2026-02-14 07:18:06 -08:00
|
|
|
---
|
|
|
|
|
title: Connect to Postgres
|
Doc review: connect-to-postgres, create-release-artifact-workflow, deploy-k8s-service (#191)
## Summary
Review session covering 3 docs, plus a codebase-wide cleanup:
### Docs reviewed
- **connect-to-postgres** — verified end-to-end (psql connection tested), stamped
- **create-release-artifact-workflow** — clarified that `build-blumeops.yaml` is only a version bump example (not a packages API example)
- **deploy-k8s-service** — fixed stale repoURL (`indri:2200` → `forge.ops.eblu.me:2222`), wrong Caddy config keys (`upstream` → `backend`, added missing `host`), updated Homepage group to "Services", added Tailscale tag documentation
### Codebase cleanup
- Migrated all remaining `op item get --fields` calls to `op read` URI syntax across 7 files (docs, READMEs, YAML comments)
- Simplified the `op read` vs `op item get` guidance in CLAUDE.md
## Side findings (not addressed)
- New `immich-pg` CNPG cluster not yet documented in the postgresql reference card
## Test plan
- [x] `psql` connection to `pg.ops.eblu.me` verified
- [x] All pre-commit hooks pass
- [x] `docs-check-links`, `docs-check-index`, `docs-check-frontmatter` pass
Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/191
2026-02-15 07:42:01 -08:00
|
|
|
modified: 2026-02-15
|
|
|
|
|
last-reviewed: 2026-02-15
|
2026-02-14 07:18:06 -08:00
|
|
|
tags:
|
|
|
|
|
- how-to
|
|
|
|
|
- database
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Connect to Postgres
|
|
|
|
|
|
|
|
|
|
How to connect to the [[postgresql]] cluster as a superuser using `psql`.
|
|
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
|
|
- `psql` installed (`brew install libpq` on macOS)
|
|
|
|
|
- [1Password CLI](https://developer.1password.com/docs/cli/) (`op`) installed and signed in
|
|
|
|
|
- Machine on the tailnet (e.g. [[gilbert]])
|
|
|
|
|
|
|
|
|
|
## Connect
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
PGPASSWORD=$(op read "op://blumeops/postgres/password") psql -h pg.ops.eblu.me -U eblume -d postgres
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This connects as the `eblume` superuser. To connect to a specific database, replace `postgres` with the database name (e.g. `miniflux`, `teslamate`).
|
|
|
|
|
|
|
|
|
|
## Useful Queries
|
|
|
|
|
|
|
|
|
|
```sql
|
|
|
|
|
-- List databases
|
|
|
|
|
\l
|
|
|
|
|
|
|
|
|
|
-- List roles
|
|
|
|
|
\du
|
|
|
|
|
|
|
|
|
|
-- Check cluster status (CNPG)
|
|
|
|
|
SELECT pg_is_in_recovery();
|
|
|
|
|
|
|
|
|
|
-- Show active connections
|
|
|
|
|
SELECT datname, usename, client_addr, state
|
|
|
|
|
FROM pg_stat_activity
|
|
|
|
|
WHERE state IS NOT NULL;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Related
|
|
|
|
|
|
|
|
|
|
- [[postgresql]] - Service reference
|
|
|
|
|
- [[borgmatic]] - Database backup
|
|
|
|
|
- [[troubleshooting]] - Cluster health checks
|