return 1
}
}
+ cmd = exec.Command("sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "exec", "passenger-config", "validate-install")
+ cmd.Dir = "/var/lib/arvados/railsapi"
+ cmd.Stdout = stdout
+ cmd.Stderr = stderr
+ err = cmd.Run()
+ 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 1
+ }
- // Install workbench2 app to /var/lib/arvados/workbench2/
+ // Install workbench2 app to
+ // /var/lib/arvados/workbench2/.
+ //
+ // We copy the source tree from the (possibly
+ // readonly) source tree into a temp dir because `yarn
+ // build` writes to {source-tree}/build/. When we
+ // upgrade to react-scripts >= 4.0.2 we may be able to
+ // build from the source dir and write directly to the
+ // final destination (using
+ // YARN_INSTALL_STATE_PATH=/dev/null
+ // BUILD_PATH=/var/lib/arvados/workbench2) instead of
+ // using two rsync steps here.
if err = inst.runBash(`
+ src="`+inst.SourcePath+`/services/workbench2"
tmp=/var/lib/arvados/tmp/workbench2
- rsync -a --delete-after `+inst.SourcePath+`/services/workbench2/ "$tmp/"
- env -C "$tmp" VERSION="`+inst.PackageVersion+`" BUILD_NUMBER=1 GIT_COMMIT=000000000 yarn build
- rsync -a --delete-after "$tmp/build/" /var/lib/arvados/workbench2/
+trap "rm -r ${tmp}" ERR EXIT
+ dst=/var/lib/arvados/workbench2
+ rsync -a --delete-after "$src/" "$tmp/"
+ env -C "$tmp" VERSION="`+inst.PackageVersion+`" BUILD_NUMBER=1 GIT_COMMIT="`+inst.Commit[:9]+`" yarn build
+ rsync -a --delete-after "$tmp/build/" "$dst/"
`, stdout, stderr); err != nil {
return 1
}