From 5c77e0a455f8e7365a0fd43edcef6bb0f80a0853 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Mon, 25 May 2026 22:34:20 +0200 Subject: [PATCH 1/2] fix(deps): bump eventsourced/pg to v2.0.2, eventsourced to v1.23.0 pg v1.19.0+ auto-runs an idempotency migration whose partial index used a non-IMMUTABLE now() predicate, which Postgres rejects at creation. That failed pg.New() at startup and crash-looped the service (silently, exit 0). schemas was on the broken pg v1.20.0. The fix is in pg's v2 line; v2.0.0/v2.0.1 were unconsumable (go.mod module path lacked the required /v2 suffix), corrected in v2.0.2. Bump to: - gitlab.com/unboundsoftware/eventsourced/pg/v2 v2.0.2 - gitlab.com/unboundsoftware/eventsourced/eventsourced v1.23.0 (required by pg/v2) Only the import path changes (.../pg -> .../pg/v2); package stays `pg`, no call sites change. --- cmd/service/service.go | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/service/service.go b/cmd/service/service.go index 2332dae..0cf29bb 100644 --- a/cmd/service/service.go +++ b/cmd/service/service.go @@ -24,7 +24,7 @@ import ( "github.com/vektah/gqlparser/v2/ast" "gitlab.com/unboundsoftware/eventsourced/amqp" "gitlab.com/unboundsoftware/eventsourced/eventsourced" - "gitlab.com/unboundsoftware/eventsourced/pg" + "gitlab.com/unboundsoftware/eventsourced/pg/v2" "gitea.unbound.se/unboundsoftware/schemas/cache" "gitea.unbound.se/unboundsoftware/schemas/domain" diff --git a/go.mod b/go.mod index 74e8d37..94b53c1 100644 --- a/go.mod +++ b/go.mod @@ -18,8 +18,8 @@ require ( github.com/vektah/gqlparser/v2 v2.5.33 github.com/wundergraph/graphql-go-tools/v2 v2.4.0 gitlab.com/unboundsoftware/eventsourced/amqp v1.9.1 - gitlab.com/unboundsoftware/eventsourced/eventsourced v1.21.0 - gitlab.com/unboundsoftware/eventsourced/pg v1.20.0 + gitlab.com/unboundsoftware/eventsourced/eventsourced v1.23.0 + gitlab.com/unboundsoftware/eventsourced/pg/v2 v2.0.2 go.opentelemetry.io/contrib/bridges/otelslog v0.18.0 go.opentelemetry.io/otel v1.43.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.43.0 diff --git a/go.sum b/go.sum index 4ff505a..4d36833 100644 --- a/go.sum +++ b/go.sum @@ -202,10 +202,10 @@ github.com/wundergraph/graphql-go-tools/v2 v2.4.0 h1:Vdv6GmApSE5I0YxDDOOxev26tef github.com/wundergraph/graphql-go-tools/v2 v2.4.0/go.mod h1:xH7XBGtKJkNTi6w6TnCDLRa7Jo2gyBBRUipIYwC5vLI= gitlab.com/unboundsoftware/eventsourced/amqp v1.9.1 h1:X6269JoAzHIKCVmtgMHZH3m7xOpACSp37ca3eODe9iU= gitlab.com/unboundsoftware/eventsourced/amqp v1.9.1/go.mod h1:EAs0d6Eh0aDiQkUJlSWErHqgHFQdxx0e8I7aG/2FarY= -gitlab.com/unboundsoftware/eventsourced/eventsourced v1.21.0 h1:iJjDO1ivOwLFx4ttcGvTCTBl2Of2lNUFC3ZOxbu46gI= -gitlab.com/unboundsoftware/eventsourced/eventsourced v1.21.0/go.mod h1:LrA7I7etRmhIC1PjO8c26BHm+gWsy2rC3eSMe5+XUWE= -gitlab.com/unboundsoftware/eventsourced/pg v1.20.0 h1:RckhEDuWeqac7V7sQKQgkB+3G2ap1PGJmfsCKPDuwyU= -gitlab.com/unboundsoftware/eventsourced/pg v1.20.0/go.mod h1:XnRbdiIFxRAA1ZoQypSAViBA9yn4jVLlJDVGRrPpusg= +gitlab.com/unboundsoftware/eventsourced/eventsourced v1.23.0 h1:qcteJH9D7kHaOgLQ0fzlW9dv42hSa0Vluqt7p4kooWA= +gitlab.com/unboundsoftware/eventsourced/eventsourced v1.23.0/go.mod h1:LrA7I7etRmhIC1PjO8c26BHm+gWsy2rC3eSMe5+XUWE= +gitlab.com/unboundsoftware/eventsourced/pg/v2 v2.0.2 h1:6pWgKGnxBq7bVFbeo6wPWBNW5OXU7acgexywC3N9dCM= +gitlab.com/unboundsoftware/eventsourced/pg/v2 v2.0.2/go.mod h1:S0oBU9kHxuAn5G/3DxvlMbf5BSfPPjhiXuwU+yVrTBg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/bridges/otelslog v0.18.0 h1:hhPGP3zvvy1xWT9RTy970wlniSxFttBIsAK1gvMguJM= -- 2.52.0 From 381816a66e1f59f196cee5a8f14c4249dc144789 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Mon, 25 May 2026 22:34:57 +0200 Subject: [PATCH 2/2] fix: log startup errors to stderr and exit non-zero When start() returns an error, main() logged it via the slog logger and returned normally (exit 0), so a crash-looping pod showed as "Completed" with no error in the logs: start() defers the OTel SDK shutdown, tearing down the log exporter before main() logs, so with LOG_FORMAT=otel the record never reaches Alloy. Also write the error to stderr (always captured by `kubectl logs`) and os.Exit(1) so the container is correctly reported as failed. --- cmd/service/service.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/service/service.go b/cmd/service/service.go index 0cf29bb..8457a5a 100644 --- a/cmd/service/service.go +++ b/cmd/service/service.go @@ -66,6 +66,13 @@ func main() { cli, ); err != nil { logger.With("error", err).Error("process error") + // start() defers the OTel SDK shutdown, so by the time we get here the + // log exporter may already be torn down and the line above never + // reaches Alloy. Write to stderr too so startup failures are always + // visible in `kubectl logs`, and exit non-zero so the container is + // reported as failed (CrashLoopBackOff) instead of "Completed". + fmt.Fprintf(os.Stderr, "fatal: process error: %v\n", err) + os.Exit(1) } } -- 2.52.0