1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
17 "git.arvados.org/arvados.git/sdk/go/arvados"
20 type runWorkbench2 struct {
24 func (runner runWorkbench2) String() string {
25 return "runWorkbench2"
28 func (runner runWorkbench2) Run(ctx context.Context, fail func(error), super *Supervisor) error {
29 host, port, err := internalPort(runner.svc)
31 return fmt.Errorf("bug: no internalPort for %q: %v (%#v)", runner, err, runner.svc)
33 super.waitShutdown.Add(1)
35 defer super.waitShutdown.Done()
36 if super.ClusterType == "production" {
37 err = super.RunProgram(ctx, "/var/lib/arvados/workbench2", runOptions{
39 }, "arvados-server", "workbench2", super.cluster.Services.Controller.ExternalURL.Host, net.JoinHostPort(host, port), ".")
40 } else if super.Workbench2Source == "" {
41 super.logger.Info("skipping Workbench2: Workbench2Source==\"\" and not in production mode")
44 stdinr, stdinw := io.Pipe()
50 if err = os.Mkdir(super.Workbench2Source+"/public/_health", 0777); err != nil && !errors.Is(err, fs.ErrExist) {
54 if err = ioutil.WriteFile(super.Workbench2Source+"/public/_health/ping", []byte(`{"health":"OK"}`), 0666); err != nil {
58 err = super.RunProgram(ctx, super.Workbench2Source, runOptions{
63 "REACT_APP_ARVADOS_API_HOST=" + super.cluster.Services.Controller.ExternalURL.Host,
65 // If we don't connect stdin, "yarn start" just exits.
68 fail(errors.New("`yarn start` exited"))