Add vault-utils and one-shot local bootstrap - #2
Conversation
Move bootstrap into a Go library and CLI so isolation can be tested with go test (HTTP 403), and Compose unseal is a one-shot instead of a long-running sidecar.
./setup.sh was skipping Postgres when credentials were already enabled in .env, so bootstrap failed looking up the database host.
Image pull noise on stderr was mixed into CombinedOutput, so docker port failed on GitHub Actions.
Keep operator-facing behavior. Drop essay comments from Compose, CI, and local scripts.
Compose runs bootstrap once by default. CI isolation is go test. tenant-offboard is in the image. Remove the bash sidecar and bash local bootstrap scripts.
|
We're making good progress, but I'm having trouble tracking everything because it's hard to understand the organization scheme. I think the only top-level directories should be:
That leaves me confused with scripts, tests, and config dir. |
…-dev passwords as Vault -dev.
|
@BSick7 The top-level Current layout:
Go tests live next to the library ( |
|
Incrementally getting better.
|
|
Let me optimize it ! |
…nce as Go tests. Vault bootstrap is only vault-utils. Compose keeps setup, snapshot, and reset. Isolation then credentials no longer 404s on database roles.
|
Revision
|
|
Bootstrap only initializes a cluster (init, unseal, configure, tokens, revoke root) and persists key material through a KeyStore interface so cloud platforms can plug in secret managers. Tenants are created explicitly with tenants create. Policy templates use Go text/template. compose.yml carries inline digest-pinned images. Snapshot take, list, verify, and restore move from bash into the binary.
|
Revision:
Question: should |
Summary
Self-hosted Vault CE cluster for the local platform: one-command setup, path-based tenant isolation, optional dynamic PostgreSQL credentials, and a
vault-utilsGo binary that owns all Vault logic. Shell is limited to Docker Compose orchestration.Revision 3
bootstrap local|aws|azure|gcp,tenants create|destroy,snapshot take|list|verify|restore,healthsubcommand structure; cloud platforms return not-implemented.KeyStoreinterface (FileKeyStorelocally) so cloud platforms can plug in secret managers and share the bootstrap code.tenants create <id>.BOOTSTRAP_DIRdefaults to./.bootstrapon the host, sovault-utils bootstrap localworks without Compose; the container still uses/bootstrap.text/template({{.KVMount}}) instead of@@KEY@@.docker-compose.ymlrenamed tocompose.yml; images are digest-pinned inline, image env vars removed.snapshot.shandstop.shfolded into the binary (snapshotsubcommands; stop isdocker compose down). Remaining scripts (setup.sh,reset.sh,lib.sh,runtime-test.sh) only orchestrate Compose.Test plan
go test -short ./...andgo test ./internal/vaultcluster(isolation, credentials, isolation-then-credentials) pass.