Skip to content

Remove the Postgres storage backend - #29

Merged
jdtw merged 1 commit into
mainfrom
chore/drop-postgres-backend
Aug 1, 2026
Merged

jdtw merged 1 commit into
mainfrom
chore/drop-postgres-backend

Conversation

@jdtw

@jdtw jdtw commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Why

The managed Postgres cluster has been destroyed and the service runs on SQLite, so PostgresStore is a code path that can no longer be reached — there is nothing left to connect to.

Keeping it wasn't neutral, either. Storage selection fell through to Postgres whenever SQLITE_PATH was unset, so a missing variable produced a confusing dial-and-fail at startup rather than naming the actual problem.

What

Removed: postgres.go, postgres_test.go, links.sql, docker_test.sh, local_test.sh, dev/psql.sh, sqlite_test.sh.

SQLITE_PATH is now required unless --ephemeral is passed, and the error says exactly that:

links: SQLITE_PATH environment variable must be set (or pass -ephemeral)

Dependencies: pgx/v5 plus pgpassfile, pgservicefile and puddle leave the module. modernc.org/sqlite becomes a direct requirement.

CI stops provisioning a database. No Postgres service container, no schema-seeding step, no DATABASE_URL — it was standing up a database purely to exercise code that no longer exists.

Three test wrappers collapse into one. test.sh now provisions its own SQLite file in its scratch directory, so the end-to-end suite needs no database server and cleans up after itself.

Dev stack drops its db service and keeps data in a named links_data volume.

Drive-by fix

dev/Dockerfile pinned golang:1.24-alpine while go.mod requires 1.25.0. Alpine images set GOTOOLCHAIN=local, so it can't self-upgrade:

go: go.mod requires go >= 1.25.0 (running go 1.24.13; GOTOOLCHAIN=local)

docker compose up — the quickstart the README points at — has been failing to build since the Go bump. This is pre-existing and unrelated to the Postgres removal, but it surfaced while verifying the dev environment and it would have been dishonest to document a quickstart I'd just watched fail. Bumped to match the production Dockerfile.

Testing

  • go build, go vet, gofmt, go test ./... all clean
  • ./test.sh passes end to end with no database server, leaving no scratch directory behind
  • Startup paths checked directly: missing SQLITE_PATH gives the fatal above; --ephemeral starts in-memory
  • Dev stack stood up for real (docker compose up --build): server opens SQLite, a link added through the dev client redirects correctly, web frontend returns 200
  • Both documented dev behaviors verified: data survives restart, and down -v wipes it

Tradeoff

SQLite pins the app to a single machine in a single region with no replication. That's already how it runs, and it suits the workload — but horizontal scaling would mean reintroducing a networked database rather than reviving this one. It stays in git history.

🤖 Generated with Claude Code

The managed Postgres cluster this talked to has been destroyed and the
service runs on SQLite, so PostgresStore is a code path that can no longer
be reached: there is nothing left to connect to.

Keeping it was not neutral. Storage selection fell through to Postgres
whenever SQLITE_PATH was unset, so a missing variable produced a confusing
dial failure at startup instead of naming the actual problem. SQLITE_PATH
is now required unless -ephemeral is passed, and the error says so.

Removing it also takes pgx and three transitive dependencies out of the
module, and lets CI stop provisioning a Postgres service container and
seeding a schema purely to exercise unreachable code.

The three test wrappers collapse into one. test.sh now provisions its own
SQLite file in its scratch directory, so the end-to-end suite needs no
database server; docker_test.sh, local_test.sh and sqlite_test.sh are all
redundant. The dev compose stack drops its database service and keeps its
data in a named volume.

Separately, dev/Dockerfile pinned golang:1.24-alpine while go.mod requires
1.25.0. Alpine images set GOTOOLCHAIN=local, so `docker compose up` -- the
quickstart the README points at -- has been failing to build since the Go
bump. Bumped to match the production Dockerfile.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jdtw
jdtw merged commit 23f1d16 into main Aug 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant