Merge branch '17225-ruby-sdk' refs #17225
[arvados.git] / lib / boot / passenger.go
index 7ebb36e474a537be8648669d681b8574174c322f..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 {
@@ -67,7 +72,11 @@ func (runner installPassenger) Run(ctx context.Context, fail func(error), super
                return err
        }
        err = super.RunProgram(ctx, runner.src, nil, nil, "bundle", "exec", "passenger-config", "validate-install")
-       if err != nil {
+       if err != nil && !strings.Contains(err.Error(), "exit status 2") {
+               // Exit code 2 indicates there were warnings (like
+               // "other passenger installations have been detected",
+               // which we can't expect to avoid) but no errors.
+               // Other non-zero exit codes (1, 9) indicate errors.
                return err
        }
        return nil
@@ -107,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, nil, "bundle", "exec",
+               err = super.RunProgram(ctx, runner.src, nil, railsEnv, "bundle", "exec",
                        "passenger", "start",
                        "-p", port,
                        "--log-file", "/dev/stderr",