Running Migrations Once During a Multi-Host Kamal Deploy | t27duck
29-May-2026 205
At my day job, we deploy our Rails app in production to three separate web hosts using Kamal. Each container runs bin/docker-entrypoint on startup, which runs bin/rails db:prepare. That worked fine when there was only one host (like staging), but ran into issues with many hosts. All containers start at roughly the same moment, all three try to apply pending migrations, and all three race for the same migration advisory lock.
.
Running Migrations Once During a Multi-Host Kamal Deploy | t27duck #ruby #rubydeveloper #rubyonrails #Running #Migrations #During #Multi-Host #Kamal #Deploy #t27duck #deploy https://www.rubyonrails.ba/link/running-migrations-once-during-a-multi-host-kamal-deploy-t27duck