Closed dirkzado closed 1 month ago
I would suggest not running migrations on web process start. What you want to do is use a deployment task, which you can configure either in your Procfile
or an app.json
file in the root of your repo. If you place it in your Procfile
, you don't need to scale that release
process up, Dokku will just pull the command automatically.
Hope that helps.
Thank you for your quick answer! I already use Procfile with "release" in it. But somehow I miss something. I will investigate ;)
Description of problem
It seems when you have scaled apps like
dokku ps:scale app_name web=2 worker=4
then you have 2 web instances running (on a server). If you now deploy a new version of the app and you have database migrations it seems that the migrations run twice and throw this error:ActiveRecord::ConcurrentMigrationError: (ActiveRecord::ConcurrentMigrationError)
! Cannot run migrations because another migration process is currently running.
If I only have 1 web instance everything is fine (because the migration only runs once).Am I using something wrong or could it be a bug?
Or should I use something like
dokku ps:scale app_name web=2 worker=4 release=1
?Steps to reproduce
run a deploy with database migrations and have at least two web instances running
dokku report $APP_NAME
Additional information
No response
Output of failing commands after running: dokku trace:off
No response
Output of failing commands after running: dokku trace:on
No response