From: Tom Clegg Date: Mon, 28 Dec 2020 20:33:33 +0000 (-0500) Subject: 17175: Wait for seedDatabase before starting railsapi. X-Git-Tag: 2.2.0~163^2~4 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/e4a6240bf2ca163c36a4357ef0f80958c40bd39a 17175: Wait for seedDatabase before starting railsapi. If the rake task and the app start concurrently, they both try to set up the database seeds. The exclusive-locking mechanism in services/api/app/lib/current_api_client.rb doesn't cover this case because the rake task and app don't use the same cache. If the app commits the database seeds between the rake task's "check existing" and "commit" steps, commit fails and the rake task aborts. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/lib/boot/supervisor.go b/lib/boot/supervisor.go index a85a699c3c..0e96beabd5 100644 --- a/lib/boot/supervisor.go +++ b/lib/boot/supervisor.go @@ -216,16 +216,16 @@ func (super *Supervisor) run(cfg *arvados.Config) error { createCertificates{}, runPostgreSQL{}, runNginx{}, - runServiceCommand{name: "controller", svc: super.cluster.Services.Controller, depends: []supervisedTask{runPostgreSQL{}}}, + runServiceCommand{name: "controller", svc: super.cluster.Services.Controller, depends: []supervisedTask{seedDatabase{}}}, runGoProgram{src: "services/arv-git-httpd", svc: super.cluster.Services.GitHTTP}, runGoProgram{src: "services/health", svc: super.cluster.Services.Health}, runGoProgram{src: "services/keepproxy", svc: super.cluster.Services.Keepproxy, depends: []supervisedTask{runPassenger{src: "services/api"}}}, runGoProgram{src: "services/keepstore", svc: super.cluster.Services.Keepstore}, runGoProgram{src: "services/keep-web", svc: super.cluster.Services.WebDAV}, - runServiceCommand{name: "ws", svc: super.cluster.Services.Websocket, depends: []supervisedTask{runPostgreSQL{}}}, + runServiceCommand{name: "ws", svc: super.cluster.Services.Websocket, depends: []supervisedTask{seedDatabase{}}}, installPassenger{src: "services/api"}, - runPassenger{src: "services/api", svc: super.cluster.Services.RailsAPI, depends: []supervisedTask{createCertificates{}, runPostgreSQL{}, installPassenger{src: "services/api"}}}, - installPassenger{src: "apps/workbench", depends: []supervisedTask{installPassenger{src: "services/api"}}}, // dependency ensures workbench doesn't delay api startup + runPassenger{src: "services/api", svc: super.cluster.Services.RailsAPI, depends: []supervisedTask{createCertificates{}, seedDatabase{}, installPassenger{src: "services/api"}}}, + installPassenger{src: "apps/workbench", depends: []supervisedTask{seedDatabase{}}}, // dependency ensures workbench doesn't delay api install/startup runPassenger{src: "apps/workbench", svc: super.cluster.Services.Workbench1, depends: []supervisedTask{installPassenger{src: "apps/workbench"}}}, seedDatabase{}, }