21230: Activate virtualenv in arvbox doc service
[arvados.git] / tools / arvbox / lib / arvbox / docker / service / doc / run-service
index acbe21c27cfe3b27be595bb3716e34d1eae84135..0a04918012aa65952bd97d221755c37b86c624ed 100755 (executable)
@@ -1,41 +1,32 @@
 #!/bin/bash
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
 
 exec 2>&1
 set -ex -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
+if test "$1" != "--only-deps" ; then
+  while [ ! -f $ARVADOS_CONTAINER_PATH/api.ready ]; do
+    sleep 1
+  done
+fi
+
 cd /usr/src/arvados/doc
 run_bundler --without=development
 
+# Generating the Python and R docs is expensive, so for development if the file
+# "no-sdk" exists then skip installing R stuff.
+if [[ ! -f no-sdk ]] ; then
+    env -C ../sdk/R R --quiet --vanilla --file=install_deps.R
+fi
+
 if test "$1" = "--only-deps" ; then
     exit
 fi
 
-set -u
-
-cat <<EOF >/var/lib/arvados/doc-nginx.conf
-worker_processes auto;
-pid /var/lib/arvados/doc-nginx.pid;
-daemon off;
-
-events {
-       worker_connections 64;
-}
-
-http {
-     include /etc/nginx/mime.types;
-     default_type application/octet-stream;
-     server {
-            listen ${services[doc]} default_server;
-            listen [::]:${services[doc]} default_server;
-            root /usr/src/arvados/doc/.site;
-            index index.html;
-            server_name _;
-     }
-}
-EOF
-
-bundle exec rake generate baseurl=http://$localip:${services[doc]} arvados_api_host=$localip:${services[api]} arvados_workbench_host=http://$localip
-
-exec nginx -c /var/lib/arvados/doc-nginx.conf
+# Active the arvbox virtualenv so we can import pdoc for PySDK doc generation.
+. /opt/arvados-py/bin/activate
+flock $GEMLOCK bundle exec rake generate baseurl=http://$localip:${services[doc]} arvados_api_host=$localip:${services[controller-ssl]} arvados_workbench_host=http://$localip