arvbox option to override API_HOST to test with other clusters
[arvados.git] / tools / arvbox / lib / arvbox / docker / service / workbench2 / run-service
index e3fbd22c4575c0e5b69ac8debceef81d8b2ee19b..5268c7e17e198866f29e1bf70afdca33131ea129 100755 (executable)
@@ -8,9 +8,13 @@ set -ex -o pipefail
 
 .  /usr/local/lib/arvbox/common.sh
 
-cd /usr/src/workbench2
+if test "$1" != "--only-deps" ; then
+  while [ ! -f $ARVADOS_CONTAINER_PATH/api.ready ]; do
+    sleep 1
+  done
+fi
 
-npm -d install --prefix /usr/local --global yarn@1.17.3
+cd /usr/src/workbench2
 
 yarn install
 
@@ -18,16 +22,20 @@ if test "$1" = "--only-deps" ; then
     exit
 fi
 
+API_HOST=${localip}:${services[controller-ssl]}
+
+if test -f /usr/src/workbench2/public/API_HOST ; then
+    API_HOST=$(cat /usr/src/workbench2/public/API_HOST)
+fi
+
 cat <<EOF > /usr/src/workbench2/public/config.json
 {
-  "API_HOST": "${localip}:${services[controller-ssl]}",
-  "VOCABULARY_URL": "/vocabulary-example.json",
-  "FILE_VIEWERS_CONFIG_URL": "/file-viewers-example.json"
+  "API_HOST": "$API_HOST"
 }
 EOF
 
 export ARVADOS_API_HOST=$localip:${services[controller-ssl]}
-export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
+export ARVADOS_API_TOKEN=$(cat $ARVADOS_CONTAINER_PATH/superuser_token)
 
 url_prefix="https://$localip:${services[workbench2-ssl]}/"
 
@@ -47,9 +55,12 @@ else
     arv api_client create --api-client "$apiclient"
 fi
 
-export HTTPS=false
 # Can't use "yarn start", need to run the dev server script
 # directly so that the TERM signal from "sv restart" gets to the
 # right process.
 export VERSION=$(./version-at-commit.sh)
-exec node node_modules/react-scripts-ts/scripts/start.js
+export BROWSER=none
+export CI=true
+export HTTPS=false
+node --version
+exec node node_modules/react-scripts/scripts/start.js