From 6f94674fc9d8bb9b3124000dc592354b9f922e5b Mon Sep 17 00:00:00 2001 From: napnap75 Date: Tue, 3 Nov 2026 21:01:00 +0100 Subject: [PATCH] archivist: migrate to PocketBase v0.41.1 (module ganigeorgiev.com/pocketbase/pocketbase); dbx moved to ganigeorgiev.com/pocketbase/dbx; go 1.27 and golang:1.27-alpine builder --- archivist/Dockerfile | 2 +- archivist/arch.md | 4 ++-- archivist/go.mod | 5 +++-- archivist/internal/pbapp/hooks.go | 2 +- archivist/internal/pbapp/setup.go | 2 +- archivist/internal/pipeline/pipeline.go | 4 ++-- archivist/main.go | 4 ++-- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/archivist/Dockerfile b/archivist/Dockerfile index d147972..c7b550b 100644 --- a/archivist/Dockerfile +++ b/archivist/Dockerfile @@ -2,7 +2,7 @@ # the runtime is scratch with only that binary and the files it needs. # --- build stage ------------------------------------------------------------ -FROM golang:1.23-alpine AS build +FROM golang:1.27-alpine AS build WORKDIR /src # ca-certificates and tzdata are copied into the runtime image below. diff --git a/archivist/arch.md b/archivist/arch.md index 82da8de..78e5a35 100644 --- a/archivist/arch.md +++ b/archivist/arch.md @@ -16,7 +16,7 @@ Everything runs offline on the server infrastructure: no cloud APIs, no outbound | Component | Choice | |---|---| -| Framework / runtime | PocketBase (Go framework, single binary) | +| Framework / runtime | PocketBase v0.41.1 (Go framework, single binary; module `ganigeorgiev.com/pocketbase/pocketbase`) | | Language | Go | | Scheduling | `app.Cron()` (S3 poller, periodic tasks) | | S3 | MinIO Go SDK (`github.com/minio/minio-go/v7`) | @@ -261,7 +261,7 @@ The gate is a regression detector for dependency upgrades (PocketBase, minio-go, `Dockerfile`, two-stage build: -- Builder: `golang:1.23-alpine`, CGO disabled, static binary, `TARGETARCH` honored for multi-platform builds under buildx. `go mod tidy` runs there because `go.sum` is not committed; once it is committed, the line becomes `go mod download` for fully reproducible builds. +- Builder: `golang:1.27-alpine` (matches the `go 1.27` directive of PocketBase v0.41.1), CGO disabled, static binary, `TARGETARCH` honored for multi-platform builds under buildx. `go mod tidy` runs there because `go.sum` is not committed; once it is committed, the line becomes `go mod download` for fully reproducible builds. - Runtime: `scratch` with only the `/archivist` binary, the CA bundle (the S3 endpoint is HTTPS by default), the timezone database (the cron and date rendering honor `TZ`), and `/app/pb_data` + `/tmp`, the only writable directories, owned by the unprivileged runtime user 65532. `config.jsonc` is never baked in: it is mounted at runtime, `ARCHIVIST_CONFIG` defaulting to `config.jsonc` relative to `/app`. The container runs as 65532:65532 (non-root), exposes 8090, declares `/app/pb_data` as a volume, and has no shell: `docker exec` is not available. `.dockerignore` keeps the build context to the Go sources; the E2E harness is not part of the image. diff --git a/archivist/go.mod b/archivist/go.mod index 943bcba..fbf9a9c 100644 --- a/archivist/go.mod +++ b/archivist/go.mod @@ -1,12 +1,13 @@ module github.com/napnap75/archivist -go 1.23 +go 1.27 // Run `go mod tidy` to resolve the exact compatible versions. require ( + ganigeorgiev.com/pocketbase/dbx v1.13.0 + ganigeorgiev.com/pocketbase/pocketbase v0.41.1 github.com/expr-lang/expr v1.17.6 github.com/ledongthuc/pdf v0.0.0-20240201144150-fd9d85c880aa github.com/minio/minio-go/v7 v7.0.88 - github.com/pocketbase/pocketbase v0.26.6 github.com/tailscale/hujson v0.4.0 ) diff --git a/archivist/internal/pbapp/hooks.go b/archivist/internal/pbapp/hooks.go index 25338ed..e489b19 100644 --- a/archivist/internal/pbapp/hooks.go +++ b/archivist/internal/pbapp/hooks.go @@ -5,9 +5,9 @@ import ( "fmt" "time" + ganigeorgiev.com/pocketbase/pocketbase/core" "github.com/napnap75/archivist/internal/config" "github.com/napnap75/archivist/internal/storage" - "github.com/pocketbase/pocketbase/core" ) // BindHooks registers the request hooks (US-04, US-22, US-23). diff --git a/archivist/internal/pbapp/setup.go b/archivist/internal/pbapp/setup.go index 3ef1249..95c10e8 100644 --- a/archivist/internal/pbapp/setup.go +++ b/archivist/internal/pbapp/setup.go @@ -6,8 +6,8 @@ import ( "errors" "fmt" + ganigeorgiev.com/pocketbase/pocketbase/core" "github.com/napnap75/archivist/internal/config" - "github.com/pocketbase/pocketbase/core" ) const eventsName = "document_events" diff --git a/archivist/internal/pipeline/pipeline.go b/archivist/internal/pipeline/pipeline.go index bfc47b1..08d6832 100644 --- a/archivist/internal/pipeline/pipeline.go +++ b/archivist/internal/pipeline/pipeline.go @@ -8,12 +8,12 @@ import ( "fmt" "strings" + ganigeorgiev.com/pocketbase/dbx" + ganigeorgiev.com/pocketbase/pocketbase/core" "github.com/ledongthuc/pdf" "github.com/napnap75/archivist/internal/config" "github.com/napnap75/archivist/internal/pbapp" "github.com/napnap75/archivist/internal/storage" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/tools/dbx" ) // pollState remembers size and ETag between two passes (US-10 write-completion wait). diff --git a/archivist/main.go b/archivist/main.go index ae8f0bd..b8dd46f 100644 --- a/archivist/main.go +++ b/archivist/main.go @@ -4,12 +4,12 @@ import ( "log" "os" + ganigeorgiev.com/pocketbase/pocketbase" + ganigeorgiev.com/pocketbase/pocketbase/core" "github.com/napnap75/archivist/internal/config" "github.com/napnap75/archivist/internal/pbapp" "github.com/napnap75/archivist/internal/pipeline" "github.com/napnap75/archivist/internal/storage" - "github.com/pocketbase/pocketbase" - "github.com/pocketbase/pocketbase/core" ) // EnvConfig is the technical configuration, from environment variables (US-01).