After the cnpg wait (#86) the first boot at ha is down from two-three restarts per replica to exactly one, on one replica, on a brand-new database: both replicas reach a virgin Postgres together and race to create Ecto's schema_migrations table. The advisory lock serializes migrations only once that table exists, so the loser exits on the unique-constraint error and its retry wins. Benign, and precisely documented in Make it durable — but a clean boot would be better than a well-documented dirty one.
The clean fix is structural: migrations run once, in a Job (or a single elected pod), and the app pods wait for them instead of each running their own. fountain migrates at boot unconditionally, so this needs an upstream switch to skip migrations at app boot — file that against fountain when this is picked up. Until then this issue records why RESTARTS 1 can appear once and never again.
After the cnpg wait (#86) the first boot at ha is down from two-three restarts per replica to exactly one, on one replica, on a brand-new database: both replicas reach a virgin Postgres together and race to create Ecto's schema_migrations table. The advisory lock serializes migrations only once that table exists, so the loser exits on the unique-constraint error and its retry wins. Benign, and precisely documented in Make it durable — but a clean boot would be better than a well-documented dirty one.
The clean fix is structural: migrations run once, in a Job (or a single elected pod), and the app pods wait for them instead of each running their own. fountain migrates at boot unconditionally, so this needs an upstream switch to skip migrations at app boot — file that against fountain when this is picked up. Until then this issue records why RESTARTS 1 can appear once and never again.