X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4ec55841b965ae33aad66479bf4d4ad41e6a0b62..f10e92fe095a7b292dde71da0f1d8465312236d7:/lib/boot/workbench2.go diff --git a/lib/boot/workbench2.go b/lib/boot/workbench2.go index 149487cdb6..8c8c607f45 100644 --- a/lib/boot/workbench2.go +++ b/lib/boot/workbench2.go @@ -38,21 +38,30 @@ func (runner runWorkbench2) Run(ctx context.Context, fail func(error), super *Su user: "www-data", }, "arvados-server", "workbench2", super.cluster.Services.Controller.ExternalURL.Host, net.JoinHostPort(host, port), ".") } else { - stdinr, stdinw := io.Pipe() - defer stdinw.Close() - go func() { - <-ctx.Done() - stdinw.Close() - }() - if err = os.Mkdir(super.SourcePath+"/services/workbench2/public/_health", 0777); err != nil && !errors.Is(err, fs.ErrExist) { + // super.SourcePath might be readonly, so for + // dev/test mode we make a copy in a writable + // dir. + livedir := super.wwwtempdir + "/workbench2" + if err := super.RunProgram(ctx, super.SourcePath+"/services/workbench2", runOptions{}, "rsync", "-a", "--delete-after", super.SourcePath+"/services/workbench2/", livedir); err != nil { + fail(err) + return + } + if err = os.Mkdir(livedir+"/public/_health", 0777); err != nil && !errors.Is(err, fs.ErrExist) { fail(err) return } - if err = ioutil.WriteFile(super.SourcePath+"/services/workbench2/public/_health/ping", []byte(`{"health":"OK"}`), 0666); err != nil { + if err = ioutil.WriteFile(livedir+"/public/_health/ping", []byte(`{"health":"OK"}`), 0666); err != nil { fail(err) return } - err = super.RunProgram(ctx, super.SourcePath+"/services/workbench2", runOptions{ + + stdinr, stdinw := io.Pipe() + defer stdinw.Close() + go func() { + <-ctx.Done() + stdinw.Close() + }() + err = super.RunProgram(ctx, livedir, runOptions{ env: []string{ "CI=true", "HTTPS=false",