VACUUM snapshot metadata through the sqlite driver, not a CLI (closes #120)
check / check (pull_request) Failing after 1s
check / check (pull_request) Failing after 1s
snapshot create vacuumed the exported metadata database by shelling out to a sqlite3 binary, so a backup failed at the very end on any host without that CLI. vacuumDatabase now opens the database with the modernc.org/sqlite driver and runs VACUUM through it, outside any transaction; internal/snapshot no longer imports os/exec. The database opens in WAL mode, so the close after VACUUM checkpoints the rewrite into the main file that is compressed and uploaded. A new test deletes marked rows, vacuums, and asserts the file shrank and no longer holds the deleted bytes. script/bootstrap and the Dockerfile stop installing the CLI in both the test-build and the shipped runtime stage, so the image no longer carries the dependency this change removes. Model: opus-4-8
This commit is contained in:
+5
-3
@@ -22,8 +22,10 @@ FROM golang:1.26.1-alpine@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f
|
||||
|
||||
ARG VERSION=dev
|
||||
|
||||
# Install build dependencies for CGO (mattn/go-sqlite3) and sqlite3 CLI (tests)
|
||||
RUN apk add --no-cache make build-base sqlite
|
||||
# Build tooling: make, plus a C toolchain because `go test -race` needs cgo.
|
||||
# The sqlite driver is pure Go (modernc.org/sqlite), so no sqlite library or
|
||||
# CLI is required.
|
||||
RUN apk add --no-cache make build-base
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
@@ -71,7 +73,7 @@ RUN CGO_ENABLED=0 go build -ldflags "-X 'sneak.berlin/go/vaultik/internal/global
|
||||
# alpine:3.21, 2026-02-25
|
||||
FROM alpine:3.21@sha256:c3f8e73fdb79deaebaa2037150150191b9dcbfba68b4a46d70103204c53f4709
|
||||
|
||||
RUN apk add --no-cache ca-certificates sqlite
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /vaultik /usr/local/bin/vaultik
|
||||
|
||||
Reference in New Issue
Block a user