Commit 817ec45
committed
refactor: Move demo user seeding to post-provisioning hook
SeedDemoUsers ran at startup (wire_services.go:102) before tenant
schemas were provisioned. On deploys that drop and recreate schemas,
the provisioning worker takes 30-60s after boot to apply migrations,
so the startup seeder consistently failed with "relation identity
does not exist" and the demo user was never created.
Move demo user seeding to a post-provisioning hook registered as
"demo-operator" in the provisioning worker's hook chain. This
guarantees the identity schema exists before the seeder runs - the
hook fires after all service migrations complete for each tenant.
The hook reads DEMO_OPERATOR_EMAIL, DEMO_OPERATOR_PASSWORD, and
DEMO_OPERATOR_TENANT at registration time and builds a tenant lookup
set. For each provisioned tenant, it checks membership in the set
and seeds the demo user only for matching tenants. If the env vars
are not set, the hook is a silent no-op (safe for production).
SeedDemoUsers remains exported for tests and manual invocation but
is no longer called from the startup path.1 parent 28e0e04 commit 817ec45
2 files changed
Lines changed: 43 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
195 | 194 | | |
196 | 195 | | |
197 | 196 | | |
| 197 | + | |
| 198 | + | |
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
| |||
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
0 commit comments