feat(server): MIGRATE_ON_START; image CMD instead of ENTRYPOINT
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Successful in 22m5s
ci / image (pull_request) Skipped

orca's `cmd` sets the container CMD, so with an ENTRYPOINT the stage
service ran `/tenant-registry /bin/sh -c …` (no migrations) and the
erpmock service ran the registry. The image now has CMD only and the
server applies embedded migrations itself when MIGRATE_ON_START=true.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
This commit is contained in:
Sharang ParnerkarandClaude Fable 5.1 committed 2026-09-12 10:09:59 +02:00
1 parent fafec29cc4
commit 0cb0883846
4 files changed
+48 -1

No files matched your search

+7
View File
@@ -18,6 +18,7 @@ import (
"git.breakpilot.com/platform/tenant-registry/internal/product"
"git.breakpilot.com/platform/tenant-registry/internal/server"
"git.breakpilot.com/platform/tenant-registry/internal/store"
"git.breakpilot.com/platform/tenant-registry/migrations"
)
func main() {
@@ -38,6 +39,12 @@ func main() {
slog.Warn("DATABASE_URL not set — running with in-memory store (dev only)")
s = store.NewMemory()
} else {
if os.Getenv("MIGRATE_ON_START") == "true" {
if err := migrations.Up(bootCtx, cfg.DatabaseURL); err != nil {
slog.Error("MIGRATE_ON_START failed", "err", err)
os.Exit(1)
}
}
pg, err := store.NewPostgres(bootCtx, cfg.DatabaseURL)
if err != nil {
slog.Error("postgres connect failed", "err", err)