X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/843b4f60e315564e0e19b98dd81431efeda3eaae..af8d161b1c3466d2d6fdfb3b1ce94ca73d8fea86:/lib/boot/passenger.go diff --git a/lib/boot/passenger.go b/lib/boot/passenger.go index 410befab90..5367337e81 100644 --- a/lib/boot/passenger.go +++ b/lib/boot/passenger.go @@ -10,6 +10,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "strings" "sync" @@ -28,8 +29,8 @@ var railsEnv = []string{ // Install a Rails application's dependencies, including phusion // passenger. type installPassenger struct { - src string - varlibdir string + src string // path to app in source tree + varlibdir string // path to app (relative to /var/lib/arvados) in OS package: "railsapi" or "workbench1" depends []supervisedTask } @@ -52,6 +53,11 @@ func (runner installPassenger) Run(ctx context.Context, fail func(error), super appdir := runner.src if super.ClusterType == "test" { + // In the multi-cluster test setup, if we run multiple + // Rails instances directly from the source tree, they + // step on one another's files in {source}/tmp, log, + // etc. So instead we copy the source directory into a + // temp dir and run the Rails app from there. appdir = filepath.Join(super.tempdir, runner.varlibdir) err = super.RunProgram(ctx, super.tempdir, runOptions{}, "mkdir", "-p", appdir) if err != nil { @@ -87,7 +93,11 @@ func (runner installPassenger) Run(ctx context.Context, fail func(error), super break } } - err = super.RunProgram(ctx, appdir, runOptions{}, "bundle", "install", "--jobs", "4", "--path", filepath.Join(os.Getenv("HOME"), ".gem")) + err = super.RunProgram(ctx, appdir, runOptions{}, "bundle", "config", "--set", "local", "path", filepath.Join(os.Getenv("HOME"), ".gem")) + if err != nil { + return err + } + err = super.RunProgram(ctx, appdir, runOptions{}, "bundle", "install", "--jobs", fmt.Sprintf("%d", runtime.NumCPU())) if err != nil { return err } @@ -112,7 +122,7 @@ func (runner installPassenger) Run(ctx context.Context, fail func(error), super type runPassenger struct { src string // path to app in source tree - varlibdir string // path to app (relative to /var/lib/arvados) in OS package + varlibdir string // path to app (relative to /var/lib/arvados) in OS package: "railsapi" or "workbench1" svc arvados.Service depends []supervisedTask }