feat(server): MIGRATE_ON_START; image CMD instead of ENTRYPOINT
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:
1 parent
fafec29cc4
commit
0cb0883846
4 files changed
+48
-1
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user