15531: Fed migrate script passes test cases
[arvados.git] / tools / arvbox / lib / arvbox / docker / common.sh
index 466ef1fceede5fd7c956a9ee46c558614712633a..9d29eb9f143e8be2d9b88857e093524c73ee3c99 100644 (file)
@@ -8,6 +8,8 @@ export GEM_HOME=/var/lib/gems
 export GEM_PATH=/var/lib/gems
 export npm_config_cache=/var/lib/npm
 export npm_config_cache_min=Infinity
+export R_LIBS=/var/lib/Rlibs
+export HOME=$(getent passwd arvbox | cut -d: -f6)
 
 if test -s /var/run/localip_override ; then
     localip=$(cat /var/run/localip_override)
@@ -16,20 +18,33 @@ else
     localip=$(ip addr show $defaultdev | grep 'inet ' | sed 's/ *inet \(.*\)\/.*/\1/')
 fi
 
+root_cert=/var/lib/arvados/root-cert.pem
+root_cert_key=/var/lib/arvados/root-cert.key
+server_cert=/var/lib/arvados/server-cert-${localip}.pem
+server_cert_key=/var/lib/arvados/server-cert-${localip}.key
+
 declare -A services
 services=(
-  [workbench]=80
-  [api]=8000
+  [workbench]=443
+  [workbench2]=3000
+  [workbench2-ssl]=3001
+  [api]=8004
+  [controller]=8003
+  [controller-ssl]=8000
   [sso]=8900
   [composer]=4200
+  [arv-git-httpd-ssl]=9000
   [arv-git-httpd]=9001
-  [keep-web]=9002
+  [keep-web]=9003
+  [keep-web-ssl]=9002
   [keepproxy]=25100
+  [keepproxy-ssl]=25101
   [keepstore0]=25107
   [keepstore1]=25108
   [ssh]=22
   [doc]=8001
-  [websockets]=8002
+  [websockets]=8005
+  [websockets-ssl]=8002
 )
 
 if test "$(id arvbox -u 2>/dev/null)" = 0 ; then
@@ -46,7 +61,7 @@ run_bundler() {
     else
         frozen=""
     fi
-    if ! test -x bundle ; then
+    if ! test -x /var/lib/gems/bin/bundler ; then
         bundlergem=$(ls -r $GEM_HOME/cache/bundler-*.gem 2>/dev/null | head -n1 || true)
         if test -n "$bundlergem" ; then
             flock /var/lib/gems/gems.lock gem install --local --no-document $bundlergem
@@ -54,11 +69,12 @@ run_bundler() {
             flock /var/lib/gems/gems.lock gem install --no-document bundler
         fi
     fi
-    if ! flock /var/lib/gems/gems.lock bundle install --path $GEM_HOME --local --no-deployment $frozen "$@" ; then
-        flock /var/lib/gems/gems.lock bundle install --path $GEM_HOME --no-deployment $frozen "$@"
+    if ! flock /var/lib/gems/gems.lock bundler install --path $GEM_HOME --local --no-deployment $frozen "$@" ; then
+        flock /var/lib/gems/gems.lock bundler install --path $GEM_HOME --no-deployment $frozen "$@"
     fi
 }
 
+PYCMD=""
 pip_install() {
     pushd /var/lib/pip
     for p in $(ls http*.tar.gz) $(ls http*.tar.bz2) $(ls http*.whl) $(ls http*.zip) ; do
@@ -68,7 +84,13 @@ pip_install() {
     done
     popd
 
-    if ! pip install --no-index --find-links /var/lib/pip $1 ; then
-        pip install $1
+    if [ "$PYCMD" = "python3" ]; then
+       if ! pip3 install --no-index --find-links /var/lib/pip $1 ; then
+            pip3 install $1
+       fi
+    else
+       if ! pip install --no-index --find-links /var/lib/pip $1 ; then
+            pip install $1
+       fi
     fi
 }