15954: Skip database.yml when running under arvados-server boot.
authorTom Clegg <tom@tomclegg.ca>
Fri, 28 Feb 2020 05:51:44 +0000 (00:51 -0500)
committerTom Clegg <tom@tomclegg.ca>
Fri, 28 Feb 2020 05:51:44 +0000 (00:51 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

lib/boot/passenger.go
lib/boot/seed.go
services/api/config/arvados_config.rb

index 33afb721dbcd17039ed11558b07749c5329ba870..6a2c4b61f5a93584fa3a4ba023e2b25b1a5a545c 100644 (file)
@@ -20,6 +20,11 @@ import (
 // concurrent installs.
 var passengerInstallMutex sync.Mutex
 
+var railsEnv = []string{
+       "ARVADOS_RAILS_LOG_TO_STDOUT=1",
+       "ARVADOS_CONFIG_NOLEGACY=1", // don't load database.yml from source tree
+}
+
 // Install a Rails application's dependencies, including phusion
 // passenger.
 type installPassenger struct {
@@ -111,7 +116,7 @@ func (runner runPassenger) Run(ctx context.Context, fail func(error), super *Sup
        super.waitShutdown.Add(1)
        go func() {
                defer super.waitShutdown.Done()
-               err = super.RunProgram(ctx, runner.src, nil, []string{"ARVADOS_RAILS_LOG_TO_STDOUT=1"}, "bundle", "exec",
+               err = super.RunProgram(ctx, runner.src, nil, railsEnv, "bundle", "exec",
                        "passenger", "start",
                        "-p", port,
                        "--log-file", "/dev/stderr",
index ce5d296bdd19a97042a8f43912e881c8172f460e..d1cf2a870975b662d8318d9ef6a25f08ce204c93 100644 (file)
@@ -20,7 +20,7 @@ func (seedDatabase) Run(ctx context.Context, fail func(error), super *Supervisor
        if err != nil {
                return err
        }
-       err = super.RunProgram(ctx, "services/api", nil, []string{"ARVADOS_RAILS_LOG_TO_STDOUT=1"}, "bundle", "exec", "rake", "db:setup")
+       err = super.RunProgram(ctx, "services/api", nil, railsEnv, "bundle", "exec", "rake", "db:setup")
        if err != nil {
                return err
        }
index 07d8834b9d64b2af5562a798622776dd097c80cd..8d2544dde1e81945e65a580886333098a3ccf6e8 100644 (file)
@@ -203,7 +203,7 @@ end
 
 db_config = {}
 path = "#{::Rails.root.to_s}/config/database.yml"
-if File.exist? path
+if !ENV['ARVADOS_CONFIG_NOLEGACY'] && File.exist?(path)
   db_config = ConfigLoader.load(path, erb: true)
 end