Two bugs exposed by the integration suite:
1. (production) pins.origins is NOT NULL DEFAULT '{}', but pgx
serialises a Go nil []string as SQL NULL — so every Create/Replace
whose caller omitted origins (an optional field per the IPFS
Pinning Service spec) was 500ing on the NOT NULL constraint. The
openapi/pin-service paths pass origins through verbatim, so any
client POST without "origins" hit this. Normalise nil -> []string{}
at the store boundary in both pinStore.Create and pinStore.Replace.
2. (test I introduced last commit) SET LOCAL does not accept bound
parameters; the RLS integration test was getting a 42601 syntax
error. Switch to SELECT set_config('anchorage.org_id', $1, true),
which is parameterisable and keeps the value out of the SQL string.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
anchorage
Highly-available, multi-tenant IPFS Pinning Service wire-compatible with the IPFS Pinning Services API spec.
Each anchorage instance is paired 1:1 with its own Kubo daemon and joins an embedded NATS cluster for signaling. Postgres is the source of truth for all durable state (pins, placements, orgs, users, tokens, audit log).
Status: skeleton complete, milestones 1–22 all landed end-to-end. The in-memory store is in place for dev; the pgx-backed store slots in once sqlc generates the code from sqlc.yaml + queries/.
See:
- docs/architecture.md
- docs/cluster-ops.md — drain / maintenance procedures
- docs/auth-flow.md — how anchorage handles humans + API clients
- docs/authentik-setup.md — configuring Authentik as the OIDC provider
- deploy/README.md — deb/rpm install + Swarm stack deploy
Quickstart (dev)
make build
./bin/anchorage version
Layout
cmd/anchorage/— thinmainentry point.internal/cmd/— Cobra command tree (version, soonserve,migrate,admin).internal/app/anchorage/— composition root (wires deps, lifecycle).internal/pkg/— domain packages (config,store,pin,ipfs, ...).configs/— example Viper YAML.docs/— architecture, auth flow, operations.
Development
make check # fmt + vet + lint + test + vuln
make test # go test -race ./...
make build # ./bin/anchorage
Description
Languages
Go
94.8%
PLpgSQL
2.9%
Makefile
0.9%
Dockerfile
0.7%
Shell
0.7%