Merge branch '15486-crunchstat-summary-v1.4-support'
authorTom Morris <tfmorris@veritasgenetics.com>
Tue, 13 Aug 2019 21:30:59 +0000 (17:30 -0400)
committerTom Morris <tfmorris@veritasgenetics.com>
Tue, 13 Aug 2019 21:30:59 +0000 (17:30 -0400)
Fixes #15486

Arvados-DCO-1.1-Signed-off-by: Tom Morris <tfmorris@veritasgenetics.com>

21 files changed:
apps/workbench/fpm-info.sh
build/package-build-dockerfiles/centos7/Dockerfile
build/package-build-dockerfiles/debian9/Dockerfile
build/package-build-dockerfiles/ubuntu1604/Dockerfile
build/package-build-dockerfiles/ubuntu1804/Dockerfile
build/run-build-packages-one-target.sh
build/run-build-packages.sh
build/run-build-test-packages-one-target.sh
build/run-library.sh
doc/install/install-keep-web.html.textile.liquid
lib/config/config.default.yml
lib/config/generated_config.go
sdk/go/arvados/config.go
services/api/fpm-info.sh
services/api/script/crunch-dispatch.rb [deleted file]
services/keep-web/handler.go
services/keep-web/handler_test.go
tools/arvbox/lib/arvbox/docker/cluster-config.sh
tools/arvbox/lib/arvbox/docker/common.sh
tools/arvbox/lib/arvbox/docker/service/keepproxy/run-service
tools/arvbox/lib/arvbox/docker/service/nginx/run

index 48913a14d7fd1929b1ada72fb94cba1ad78be7bf..22ec1ba14c6dad9a83cc3594aa0353f835331e91 100644 (file)
@@ -4,9 +4,9 @@
 
 case "$TARGET" in
     centos*)
-        fpm_depends+=(git arvados-server)
+        fpm_depends+=(git)
         ;;
     debian* | ubuntu*)
-        fpm_depends+=(git g++ arvados-server)
+        fpm_depends+=(git g++)
         ;;
 esac
index 610dac90fe89443ffe9a18f53d59b686429c7e3b..3d3ea6f0f82798953c2d3eac7a646fa1240735a9 100644 (file)
@@ -37,10 +37,6 @@ RUN rpm -ivh epel-release-latest-7.noarch.rpm
 
 RUN git clone --depth 1 git://git.curoverse.com/arvados.git /tmp/arvados && cd /tmp/arvados/services/api && /usr/local/rvm/bin/rvm-exec default bundle && cd /tmp/arvados/apps/workbench && /usr/local/rvm/bin/rvm-exec default bundle
 
-# Workbench depends on arvados-server for config manipulation
-ENV GOPATH /tmp
-RUN mkdir -p $GOPATH/src/git.curoverse.com && ln -sT /tmp/arvados $GOPATH/src/git.curoverse.com/arvados.git && cd $GOPATH/src/git.curoverse.com/arvados.git/cmd/arvados-server && go get -v github.com/kardianos/govendor && $GOPATH/bin/govendor sync && go get && go build && cp arvados-server /usr/local/bin/ && rm -rf /tmp/arvados
-
 # The version of setuptools that comes with CentOS is way too old
 RUN pip install --upgrade setuptools
 
index f8104472b6dd20e81988c3505646af5ae0f629df..c403d79bcc859a2925ce50752124d9aa1fad4068 100644 (file)
@@ -34,9 +34,5 @@ RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
 
 RUN git clone --depth 1 git://git.curoverse.com/arvados.git /tmp/arvados && cd /tmp/arvados/services/api && /usr/local/rvm/bin/rvm-exec default bundle && cd /tmp/arvados/apps/workbench && /usr/local/rvm/bin/rvm-exec default bundle
 
-# Workbench depends on arvados-server for config manipulation
-ENV GOPATH /tmp
-RUN mkdir -p $GOPATH/src/git.curoverse.com && ln -sT /tmp/arvados $GOPATH/src/git.curoverse.com/arvados.git && cd $GOPATH/src/git.curoverse.com/arvados.git/cmd/arvados-server && go get -v github.com/kardianos/govendor && $GOPATH/bin/govendor sync && go get && go build && cp arvados-server /usr/local/bin/ && rm -rf /tmp/arvados
-
 ENV WORKSPACE /arvados
 CMD ["/usr/local/rvm/bin/rvm-exec", "default", "bash", "/jenkins/run-build-packages.sh", "--target", "debian9"]
index 63c119c8405f1dc38020db111656af3d12576310..90f340e66cb65155be2737b3a0dd9c6de174d30c 100644 (file)
@@ -33,9 +33,5 @@ RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
 
 RUN git clone --depth 1 git://git.curoverse.com/arvados.git /tmp/arvados && cd /tmp/arvados/services/api && /usr/local/rvm/bin/rvm-exec default bundle && cd /tmp/arvados/apps/workbench && /usr/local/rvm/bin/rvm-exec default bundle
 
-# Workbench depends on arvados-server for config manipulation
-ENV GOPATH /tmp
-RUN mkdir -p $GOPATH/src/git.curoverse.com && ln -sT /tmp/arvados $GOPATH/src/git.curoverse.com/arvados.git && cd $GOPATH/src/git.curoverse.com/arvados.git/cmd/arvados-server && go get -v github.com/kardianos/govendor && $GOPATH/bin/govendor sync && go get && go build && cp arvados-server /usr/local/bin/ && rm -rf /tmp/arvados
-
 ENV WORKSPACE /arvados
 CMD ["/usr/local/rvm/bin/rvm-exec", "default", "bash", "/jenkins/run-build-packages.sh", "--target", "ubuntu1604"]
index 5e4d067671777843373536fe7b2ad42b98cf00e0..1adff74000ea208fe8ac6b66915b1f30f0f117e2 100644 (file)
@@ -33,9 +33,5 @@ RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
 
 RUN git clone --depth 1 git://git.curoverse.com/arvados.git /tmp/arvados && cd /tmp/arvados/services/api && /usr/local/rvm/bin/rvm-exec default bundle && cd /tmp/arvados/apps/workbench && /usr/local/rvm/bin/rvm-exec default bundle
 
-# Workbench depends on arvados-server for config manipulation
-ENV GOPATH /tmp
-RUN mkdir -p $GOPATH/src/git.curoverse.com && ln -sT /tmp/arvados $GOPATH/src/git.curoverse.com/arvados.git && cd $GOPATH/src/git.curoverse.com/arvados.git/cmd/arvados-server && go get -v github.com/kardianos/govendor && $GOPATH/bin/govendor sync && go get && go build && cp arvados-server /usr/local/bin/ && rm -rf /tmp/arvados
-
 ENV WORKSPACE /arvados
 CMD ["/usr/local/rvm/bin/rvm-exec", "default", "bash", "/jenkins/run-build-packages.sh", "--target", "ubuntu1804"]
index 5c7dc342ee9c40b546ad38e377555193d6192975..378c9bbfa39dc9dfedc134636ce5806bf6d6cf65 100755 (executable)
@@ -261,7 +261,6 @@ else
     set +e
     mv -f ${WORKSPACE}/packages/${TARGET}/* ${WORKSPACE}/packages/${TARGET}/processed/ 2>/dev/null
     set -e
-set -x
     # Build packages.
     if docker run \
         --rm \
index ed027f23400b0597c7cfb99d2956434a93f2bfdc..bebcae0653ef0c54ea37cd5b50c06f03c8590520 100755 (executable)
@@ -356,13 +356,16 @@ mkdir cwltest/bin && touch cwltest/bin/cwltest
 fpm_build_virtualenv "cwltest" "cwltest"
 rm -rf "$WORKSPACE/cwltest"
 
+calculate_go_package_version arvados_server_version cmd/arvados-server
+arvados_server_iteration=$(default_iteration "arvados-server" "$arvados_server_version" "go")
+
 # Build the API server package
 test_rails_package_presence arvados-api-server "$WORKSPACE/services/api"
 if [[ "$?" == "0" ]]; then
   handle_rails_package arvados-api-server "$WORKSPACE/services/api" \
       "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
       --description="Arvados API server - Arvados is a free and open source platform for big data science." \
-      --license="GNU Affero General Public License, version 3.0"
+      --license="GNU Affero General Public License, version 3.0" --depends "arvados-server = ${arvados_server_version}-${arvados_server_iteration}"
 fi
 
 # Build the workbench server package
@@ -370,6 +373,22 @@ test_rails_package_presence arvados-workbench "$WORKSPACE/apps/workbench"
 if [[ "$?" == "0" ]] ; then
   (
       set -e
+
+      # The workbench package has a build-time dependency on the arvados-server
+      # package for config manipulation, so install it first.
+      cd $WORKSPACE/cmd/arvados-server
+      get_complete_package_name arvados_server_pkgname arvados-server ${arvados_server_version} go
+
+      arvados_server_pkg_path="$WORKSPACE/packages/$TARGET/${arvados_server_pkgname}"
+      if [[ ! -e ${arvados_server_pkg_path} ]]; then
+        arvados_server_pkg_path="$WORKSPACE/packages/$TARGET/processed/${arvados_server_pkgname}"
+      fi
+      if [[ "$FORMAT" == "deb" ]]; then
+        dpkg -i ${arvados_server_pkg_path}
+      else
+        rpm -i ${arvados_server_pkg_path}
+      fi
+
       cd "$WORKSPACE/apps/workbench"
 
       # We need to bundle to be ready even when we build a package without vendor directory
@@ -388,8 +407,8 @@ if [[ "$?" == "0" ]] ; then
       mv /tmp/x /etc/arvados/config.yml
       perl -p -i -e 'BEGIN{undef $/;} s/WebDAV(.*?):\n( *)ExternalURL: ""/WebDAV$1:\n$2ExternalURL: "example.com"/g' /etc/arvados/config.yml
 
-      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake npm:install >/dev/null
-      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
+      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake npm:install >"$STDOUT_IF_DEBUG"
+      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >"$STDOUT_IF_DEBUG"
 
       # Remove generated configuration files so they don't go in the package.
       rm -rf /etc/arvados/
@@ -402,7 +421,7 @@ if [[ "$?" == "0" ]] ; then
     handle_rails_package arvados-workbench "$WORKSPACE/apps/workbench" \
         "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
         --description="Arvados Workbench - Arvados is a free and open source platform for big data science." \
-        --license="GNU Affero General Public License, version 3.0"
+        --license="GNU Affero General Public License, version 3.0" --depends "arvados-server = ${arvados_server_version}-${arvados_server_iteration}"
   fi
 fi
 
index 962940b799bd1907cc0540dd60a0f96643ebeb18..d75e2785eca730d748f6e59446f6509a233fa1dd 100755 (executable)
@@ -14,6 +14,8 @@ Syntax:
 --upload
     If the build and test steps are successful, upload the packages
     to a remote apt repository (default: false)
+--debug
+    Output debug information (default: false)
 --rc
     Optional Parameter to build Release Candidate
 --build-version <version>
@@ -42,7 +44,7 @@ if ! [[ -d "$WORKSPACE" ]]; then
 fi
 
 PARSEDOPTS=$(getopt --name "$0" --longoptions \
-    help,upload,rc,target:,build-version: \
+    help,debug,upload,rc,target:,build-version: \
     -- "" "$@")
 if [ $? -ne 0 ]; then
     exit 1
@@ -51,6 +53,7 @@ fi
 TARGET=debian9
 UPLOAD=0
 RC=0
+DEBUG=
 
 declare -a build_args=()
 
@@ -65,6 +68,9 @@ while [ $# -gt 0 ]; do
         --target)
             TARGET="$2"; shift
             ;;
+        --debug)
+            DEBUG=" --debug"
+            ;;
         --upload)
             UPLOAD=1
             ;;
@@ -99,7 +105,7 @@ COLUMNS=80
 title "Start build packages"
 timer_reset
 
-$WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"
+$WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"$DEBUG
 
 checkexit $? "build packages"
 title "End of build packages (`timer`)"
@@ -108,7 +114,7 @@ title "Start test packages"
 timer_reset
 
 if [ ${#failures[@]} -eq 0 ]; then
-  $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages
+  $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages$DEBUG
 else
   echo "Skipping package upload, there were errors building the packages"
 fi
index b4c2d1ddc8e840c3602b0ebc62c81c6f99dd83f8..cb5549df7183676217270adc03b98b1ddbb0cf25 100755 (executable)
@@ -103,6 +103,40 @@ handle_ruby_gem() {
     fi
 }
 
+calculate_go_package_version() {
+  # $__returnvar has the nameref attribute set, which means it is a reference
+  # to another variable that is passed in as the first argument to this function.
+  # see https://www.gnu.org/software/bash/manual/html_node/Shell-Parameters.html
+  local -n __returnvar="$1"; shift
+  local src_path="$1"; shift
+
+  mkdir -p "$GOPATH/src/git.curoverse.com"
+  ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
+  (cd "$GOPATH/src/git.curoverse.com/arvados.git" && "$GOPATH/bin/govendor" sync -v)
+
+  cd "$GOPATH/src/git.curoverse.com/arvados.git/$src_path"
+  local version="$(version_from_git)"
+  local timestamp="$(timestamp_from_git)"
+
+  # Update the version number and build a new package if the vendor
+  # bundle has changed, or the command imports anything from the
+  # Arvados SDK and the SDK has changed.
+  declare -a checkdirs=(vendor)
+  if grep -qr git.curoverse.com/arvados .; then
+      checkdirs+=(sdk/go lib)
+  fi
+  for dir in ${checkdirs[@]}; do
+      cd "$GOPATH/src/git.curoverse.com/arvados.git/$dir"
+      ts="$(timestamp_from_git)"
+      if [[ "$ts" -gt "$timestamp" ]]; then
+          version=$(version_from_git)
+          timestamp="$ts"
+      fi
+  done
+
+  __returnvar="$version"
+}
+
 # Usage: package_go_binary services/foo arvados-foo "Compute foo to arbitrary precision"
 package_go_binary() {
     local src_path="$1"; shift
@@ -110,46 +144,27 @@ package_go_binary() {
     local description="$1"; shift
     local license_file="${1:-agpl-3.0.txt}"; shift
 
-    if [[ -n "$ONLY_BUILD" ]] && [[ "$prog" != "$ONLY_BUILD" ]] ; then
+    if [[ -n "$ONLY_BUILD" ]] && [[ "$prog" != "$ONLY_BUILD" ]]; then
+      # arvados-workbench depends on arvados-server at build time, so even when
+      # only arvados-workbench is being built, we need to build arvados-server too
+      if [[ "$prog" != "arvados-server" ]] || [[ "$ONLY_BUILD" != "arvados-workbench" ]]; then
         return 0
+      fi
     fi
 
     debug_echo "package_go_binary $src_path as $prog"
 
     local basename="${src_path##*/}"
-
-    mkdir -p "$GOPATH/src/git.curoverse.com"
-    ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
-    (cd "$GOPATH/src/git.curoverse.com/arvados.git" && "$GOPATH/bin/govendor" sync -v)
-
-    cd "$GOPATH/src/git.curoverse.com/arvados.git/$src_path"
-    local version="$(version_from_git)"
-    local timestamp="$(timestamp_from_git)"
-
-    # Update the version number and build a new package if the vendor
-    # bundle has changed, or the command imports anything from the
-    # Arvados SDK and the SDK has changed.
-    declare -a checkdirs=(vendor)
-    if grep -qr git.curoverse.com/arvados .; then
-        checkdirs+=(sdk/go lib)
-    fi
-    for dir in ${checkdirs[@]}; do
-        cd "$GOPATH/src/git.curoverse.com/arvados.git/$dir"
-        ts="$(timestamp_from_git)"
-        if [[ "$ts" -gt "$timestamp" ]]; then
-            version=$(version_from_git)
-            timestamp="$ts"
-        fi
-    done
+    calculate_go_package_version go_package_version $src_path
 
     cd $WORKSPACE/packages/$TARGET
-    test_package_presence $prog $version go
+    test_package_presence $prog $go_package_version go
 
     if [[ "$?" != "0" ]]; then
       return 1
     fi
 
-    go get -ldflags "-X main.version=${version}" "git.curoverse.com/arvados.git/$src_path"
+    go get -ldflags "-X main.version=${go_package_version}" "git.curoverse.com/arvados.git/$src_path"
 
     local -a switches=()
     systemd_unit="$WORKSPACE/${src_path}/${prog}.service"
@@ -161,7 +176,7 @@ package_go_binary() {
     fi
     switches+=("$WORKSPACE/${license_file}=/usr/share/doc/$prog/${license_file}")
 
-    fpm_build "$GOPATH/bin/${basename}=/usr/bin/${prog}" "${prog}" dir "${version}" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=${description}" "${switches[@]}"
+    fpm_build "$GOPATH/bin/${basename}=/usr/bin/${prog}" "${prog}" dir "${go_package_version}" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=${description}" "${switches[@]}"
 }
 
 default_iteration() {
@@ -213,47 +228,71 @@ test_rails_package_presence() {
   test_package_presence $pkgname $version rails "$RAILS_PACKAGE_ITERATION"
 }
 
-test_package_presence() {
-    local pkgname="$1"; shift
-    local version="$1"; shift
-    local pkgtype="$1"; shift
-    local iteration="$1"; shift
-    local arch="$1"; shift
+get_complete_package_name() {
+  # if the errexit flag is set, unset it until this function returns
+  # otherwise, the shift calls below will abort the program if optional arguments are not supplied
+  if [ -o errexit ]; then
+    set +e
+    trap 'set -e' RETURN
+  fi
+  # $__returnvar has the nameref attribute set, which means it is a reference
+  # to another variable that is passed in as the first argument to this function.
+  # see https://www.gnu.org/software/bash/manual/html_node/Shell-Parameters.html
+  local -n __returnvar="$1"; shift
+  local pkgname="$1"; shift
+  local version="$1"; shift
+  local pkgtype="$1"; shift
+  local iteration="$1"; shift
+  local arch="$1"; shift
+  if [[ "$iteration" == "" ]]; then
+      iteration="$(default_iteration "$pkgname" "$version" "$pkgtype")"
+  fi
 
-    if [[ -n "$ONLY_BUILD" ]] && [[ "$pkgname" != "$ONLY_BUILD" ]] ; then
-        return 1
-    fi
+  if [[ "$arch" == "" ]]; then
+    rpm_architecture="x86_64"
+    deb_architecture="amd64"
 
-    if [[ "$iteration" == "" ]]; then
-        iteration="$(default_iteration "$pkgname" "$version" "$pkgtype")"
+    if [[ "$pkgtype" =~ ^(src)$ ]]; then
+      rpm_architecture="noarch"
+      deb_architecture="all"
     fi
 
-    if [[ "$arch" == "" ]]; then
+    # These python packages have binary components
+    if [[ "$pkgname" =~ (ruamel|ciso|pycrypto|pyyaml) ]]; then
       rpm_architecture="x86_64"
       deb_architecture="amd64"
+    fi
+  else
+    rpm_architecture=$arch
+    deb_architecture=$arch
+  fi
 
-      if [[ "$pkgtype" =~ ^(src)$ ]]; then
-        rpm_architecture="noarch"
-        deb_architecture="all"
-      fi
+  local complete_pkgname="${pkgname}_$version${iteration:+-$iteration}_$deb_architecture.deb"
+  if [[ "$FORMAT" == "rpm" ]]; then
+      # rpm packages get iteration 1 if we don't supply one
+      iteration=${iteration:-1}
+      complete_pkgname="$pkgname-$version-${iteration}.$rpm_architecture.rpm"
+  fi
+  __returnvar=${complete_pkgname}
+}
 
-      # These python packages have binary components
-      if [[ "$pkgname" =~ (ruamel|ciso|pycrypto|pyyaml) ]]; then
-        rpm_architecture="x86_64"
-        deb_architecture="amd64"
+# Test if the package already exists, if not return 0, if it does return 1
+test_package_presence() {
+    local pkgname="$1"; shift
+    local version="$1"; shift
+    local pkgtype="$1"; shift
+    local iteration="$1"; shift
+    local arch="$1"; shift
+    if [[ -n "$ONLY_BUILD" ]] && [[ "$pkgname" != "$ONLY_BUILD" ]] ; then
+      # arvados-workbench depends on arvados-server at build time, so even when
+      # only arvados-workbench is being built, we need to build arvados-server too
+      if [[ "$pkgname" != "arvados-server" ]] || [[ "$ONLY_BUILD" != "arvados-workbench" ]]; then
+        return 1
       fi
-    else
-      rpm_architecture=$arch
-      deb_architecture=$arch
     fi
 
-    if [[ "$FORMAT" == "deb" ]]; then
-        local complete_pkgname="${pkgname}_$version${iteration:+-$iteration}_$deb_architecture.deb"
-    else
-        # rpm packages get iteration 1 if we don't supply one
-        iteration=${iteration:-1}
-        local complete_pkgname="$pkgname-$version-${iteration}.$rpm_architecture.rpm"
-    fi
+    local full_pkgname
+    get_complete_package_name full_pkgname $pkgname $version $pkgtype $iteration $arch
 
     # See if we can skip building the package, only if it already exists in the
     # processed/ directory. If so, move it back to the packages directory to make
@@ -274,32 +313,32 @@ test_package_presence() {
       fi
 
       repo_pkg_list=$(curl -s -o - http://apt.arvados.org/pool/${D}/main/${repo_subdir}/)
-      echo ${repo_pkg_list} |grep -q ${complete_pkgname}
+      echo ${repo_pkg_list} |grep -q ${full_pkgname}
       if [ $? -eq 0 ] ; then
-        echo "Package $complete_pkgname exists, not rebuilding!"
-        curl -s -o ./${complete_pkgname} http://apt.arvados.org/pool/${D}/main/${repo_subdir}/${complete_pkgname}
+        echo "Package $full_pkgname exists upstream, not rebuilding, downloading instead!"
+        curl -s -o "$WORKSPACE/packages/$TARGET/${full_pkgname}" http://apt.arvados.org/pool/${D}/main/${repo_subdir}/${full_pkgname}
         return 1
-      elif test -f "$WORKSPACE/packages/$TARGET/processed/${complete_pkgname}" ; then
-        echo "Package $complete_pkgname exists, not rebuilding!"
+      elif test -f "$WORKSPACE/packages/$TARGET/processed/${full_pkgname}" ; then
+        echo "Package $full_pkgname exists, not rebuilding!"
         return 1
       else
-        echo "Package $complete_pkgname not found, building"
+        echo "Package $full_pkgname not found, building"
         return 0
       fi
     else
       centos_repo="http://rpm.arvados.org/CentOS/7/dev/x86_64/"
 
       repo_pkg_list=$(curl -s -o - ${centos_repo})
-      echo ${repo_pkg_list} |grep -q ${complete_pkgname}
+      echo ${repo_pkg_list} |grep -q ${full_pkgname}
       if [ $? -eq 0 ]; then
-        echo "Package $complete_pkgname exists, not rebuilding!"
-        curl -s -o ./${complete_pkgname} ${centos_repo}${complete_pkgname}
+        echo "Package $full_pkgname exists upstream, not rebuilding, downloading instead!"
+        curl -s -o "$WORKSPACE/packages/$TARGET/${full_pkgname}" ${centos_repo}${full_pkgname}
         return 1
-      elif test -f "$WORKSPACE/packages/$TARGET/processed/${complete_pkgname}" ; then
-        echo "Package $complete_pkgname exists, not rebuilding!"
+      elif test -f "$WORKSPACE/packages/$TARGET/processed/${full_pkgname}" ; then
+        echo "Package $full_pkgname exists, not rebuilding!"
         return 1
       else
-        echo "Package $complete_pkgname not found, building"
+        echo "Package $full_pkgname not found, building"
         return 0
       fi
     fi
@@ -681,7 +720,11 @@ fpm_build () {
   shift
 
   if [[ -n "$ONLY_BUILD" ]] && [[ "$PACKAGE_NAME" != "$ONLY_BUILD" ]] && [[ "$PACKAGE" != "$ONLY_BUILD" ]] ; then
+    # arvados-workbench depends on arvados-server at build time, so even when
+    # only arvados-workbench is being built, we need to build arvados-server too
+    if [[ "$PACKAGE_NAME" != "arvados-server" ]] || [[ "$ONLY_BUILD" != "arvados-workbench" ]]; then
       return 0
+    fi
   fi
 
   local default_iteration_value="$(default_iteration "$PACKAGE" "$VERSION" "$PACKAGE_TYPE")"
index f4da678f809f939e14f1e0d206f36262786ab5ee..902ced0372a972449db08452b59c888a47f1d237 100644 (file)
@@ -49,66 +49,12 @@ Usage of keep-web:
        Site configuration file (default may be overridden by setting an ARVADOS_CONFIG environment variable) (default "/etc/arvados/config.yml")
   -dump-config
        write current configuration to stdout and exit
-  -legacy-crunch-dispatch-slurm-config file
-       Legacy crunch-dispatch-slurm configuration file (default "/etc/arvados/crunch-dispatch-slurm/crunch-dispatch-slurm.yml")
-  -legacy-keepstore-config file
-       Legacy keepstore configuration file (default "/etc/arvados/keepstore/keepstore.yml")
-  -legacy-keepweb-config file
-       Legacy keep-web configuration file (default "/etc/arvados/keep-web/keep-web.yml")
-  -legacy-ws-config file
-       Legacy arvados-ws configuration file (default "/etc/arvados/ws/ws.yml")
-  -skip-legacy
-       Don't load legacy config files
+[...]
   -version
        print version information and exit.
 </code></pre>
 </notextile>
 
-{% assign railscmd = "bundle exec ./script/get_anonymous_user_token.rb --get" %}
-{% assign railsout = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" %}
-If you intend to use Keep-web to serve public data to anonymous clients, configure it with an anonymous token. You can use the same one you used when you set up your Keepproxy server, or use the following command on the <strong>API server</strong> to create another. {% include 'install_rails_command' %}
-
-Install runit to supervise the Keep-web daemon.  {% include 'install_runit' %}
-
-Set the cluster config file like the following:
-
-<notextile>
-<pre><code>Clusters:
-  <span class="userinput">uuid_prefix</span>:
-    SystemRootToken: "{{railsout}}"
-    Services:
-      Controller:
-        ExternalURL: "https://<span class="userinput">uuid_prefix</span>.your.domain"
-        Insecure: false
-      WebDAV:
-        InternalURLs:
-          "http://keep_web_hostname_goes_here:9002/": {}
-      WebDAVDownload:
-        InternalURLs:
-          "http://keep_web_hostname_goes_here:9002/": {}
-        ExternalURL: "https://download.<span class="userinput">uuid_prefix</span>.your.domain/"
-    Users:
-      AnonymousUserToken: "xxxxxxxxxxxxxxxxxxxx"
-    Collections:
-      TrustAllContent: false
-</code></pre>
-</notextile>
-
-The basic command to start Keep-web in the service run script is:
-
-<notextile>
-<pre><code>exec sudo -u nobody keep-web
-</code></pre>
-</notextile>
-
-{% include 'notebox_begin' %}
-Please take into consideration that the config file should be world-readable.
-{% include 'notebox_end' %}
-
-Set @Users.AnonymousUserToken: ""@ (empty string) if you do not want to serve public data.
-
-Set @TLS.Insecure: true@ if your API server's TLS certificate is not signed by a recognized CA.
-
 h3. Set up a reverse proxy with TLS support
 
 The Keep-web service will be accessible from anywhere on the internet, so we recommend using TLS for transport encryption.
@@ -166,26 +112,59 @@ If neither of the above wildcard options is feasible, you have two choices:
 # Serve web content at @collections.uuid_prefix.your.domain@, but only for unauthenticated requests (public data and collection sharing links). Authenticated requests will always result in file downloads, using the @download@ name. For example, the Workbench "preview" button and the "view entire log file" link will invoke file downloads instead of displaying content in the browser window.
 # In the special case where you know you are immune to XSS exploits, you can enable the "trust all content" mode in Keep-web and Workbench (setting @Collections.TrustAllContent: true@ on the config file). With this enabled, inline web content can be served from a single @collections@ host name; no wildcard DNS or certificate is needed. Do not do this without understanding the security implications described in the "Keep-web documentation":http://godoc.org/github.com/curoverse/arvados/services/keep-web.
 
-h3. Tell Workbench about the Keep-web service
+h2. Configure Keep-web
+
+{% assign railscmd = "bundle exec ./script/get_anonymous_user_token.rb --get" %}
+{% assign railsout = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" %}
+If you intend to use Keep-web to serve public data to anonymous clients, configure it with an anonymous token. You can use the same one you used when you set up your Keepproxy server, or use the following command on the <strong>API server</strong> to create another. {% include 'install_rails_command' %}
+
+Set the cluster config file like the following:
+
+<notextile>
+<pre><code>Clusters:
+  <span class="userinput">uuid_prefix</span>:
+    Services:
+      Controller:
+        ExternalURL: "https://<span class="userinput">uuid_prefix</span>.your.domain"
+      WebDAV:
+        InternalURLs:
+          "http://keep_web_hostname_goes_here:9002/": {}
+        ExternalURL: "https://collections.<span class="userinput">uuid_prefix</span>.your.domain"
+      WebDAVDownload:
+        InternalURLs:
+          "http://keep_web_hostname_goes_here:9002/": {}
+        ExternalURL: "https://download.<span class="userinput">uuid_prefix</span>.your.domain"
+    Users:
+      AnonymousUserToken: "{{railsout}}"
+    Collections:
+      TrustAllContent: false
+    TLS:
+      Insecure: false
+</code></pre>
+</notextile>
+
+Set @Users.AnonymousUserToken: ""@ (empty string) if you do not want to serve public data.
+
+Set @TLS.Insecure: true@ if your API server's TLS certificate is not signed by a recognized CA.
 
 Workbench has features like "download file from collection" and "show image" which work better if the content is served by Keep-web rather than Workbench itself. We recommend using the two different hostnames ("download" and "collections" above) for file downloads and inline content respectively.
 
-Add the following entry to your cluster configuration file (@/etc/arvados/config.yml@). This URL will be used for file downloads.
+The following entry on your cluster configuration file (@/etc/arvados/config.yml@) details the URL that will be used for file downloads.
 
 <notextile>
 <pre><code>Clusters:
-  zzzzz:
+  <span class="userinput">uuid_prefix</span>:
     Services:
       WebDAVDownload:
-        ExternalURL: "https://download.<span class="userinput">uuid_prefix</span>.your.domain/"
+        ExternalURL: "https://download.<span class="userinput">uuid_prefix</span>.your.domain"
 </code></pre>
 </notextile>
 
-Additionally, add *one* of the following entries to your Workbench cluster configuration file, depending on your DNS setup. This URL will be used to serve user content that can be displayed in the browser, like image previews and static HTML pages.
+Additionally, one of the following entries on your cluster configuration file (depending on your DNS setup) tells Workbench which URL will be used to serve user content that can be displayed in the browser, like image previews and static HTML pages.
 
 <notextile>
 <pre><code>Clusters:
-  zzzzz:
+  <span class="userinput">uuid_prefix</span>:
     Services:
       WebDAV:
         ExternalURL: "https://*--collections.<span class="userinput">uuid_prefix</span>.your.domain"
@@ -193,3 +172,37 @@ Additionally, add *one* of the following entries to your Workbench cluster confi
         ExternalURL: "https://collections.<span class="userinput">uuid_prefix</span>.your.domain"
 </code></pre>
 </notextile>
+
+h2. Run Keep-web
+
+h3. Start the service (option 1: systemd)
+
+If your system does not use systemd, skip this section and follow the "runit instructions":#runit instead.
+
+If your system uses systemd, the keep-web service should already be set up. Start it and check its status:
+
+<notextile>
+<pre><code>~$ <span class="userinput">sudo systemctl restart keep-web</span>
+~$ <span class="userinput">sudo systemctl status keep-web</span>
+&#x25cf; keep-web.service - Arvados Keep web gateway
+   Loaded: loaded (/lib/systemd/system/keep-web.service; enabled)
+   Active: active (running) since Sat 2019-08-10 10:33:21 UTC; 3 days ago
+     Docs: https://doc.arvados.org/
+ Main PID: 4242 (keep-web)
+   CGroup: /system.slice/keep-web.service
+           └─4242 /usr/bin/keep-web
+[...]
+</code></pre>
+</notextile>
+
+h3(#runit). Start the service (option 2: runit)
+
+Install runit to supervise the Keep-web daemon.  {% include 'install_runit' %}
+
+The basic command to start Keep-web in the service run script is:
+
+<notextile>
+<pre><code>exec keep-web
+</code></pre>
+</notextile>
+
index 2c0b53016aee6e767462b77221967bc0eeb79ae1..dfdd0310448826174b83c1e005d2d22dcce9e062 100644 (file)
@@ -395,6 +395,7 @@ Clusters:
       # Cache parameters for WebDAV content serving:
       # * TTL: Maximum time to cache manifests and permission checks.
       # * UUIDTTL: Maximum time to cache collection state.
+      # * MaxBlockEntries: Maximum number of block cache entries.
       # * MaxCollectionEntries: Maximum number of collection cache entries.
       # * MaxCollectionBytes: Approximate memory limit for collection cache.
       # * MaxPermissionEntries: Maximum number of permission cache entries.
@@ -402,6 +403,7 @@ Clusters:
       WebDAVCache:
         TTL: 300s
         UUIDTTL: 5s
+        MaxBlockEntries:      4
         MaxCollectionEntries: 1000
         MaxCollectionBytes:   100000000
         MaxPermissionEntries: 1000
index 5341a256c14da886b3f0a0293ba6d1f380e0f9fc..6cb8bf81aee3607d6bce79986e466d0b86eb807e 100644 (file)
@@ -401,6 +401,7 @@ Clusters:
       # Cache parameters for WebDAV content serving:
       # * TTL: Maximum time to cache manifests and permission checks.
       # * UUIDTTL: Maximum time to cache collection state.
+      # * MaxBlockEntries: Maximum number of block cache entries.
       # * MaxCollectionEntries: Maximum number of collection cache entries.
       # * MaxCollectionBytes: Approximate memory limit for collection cache.
       # * MaxPermissionEntries: Maximum number of permission cache entries.
@@ -408,6 +409,7 @@ Clusters:
       WebDAVCache:
         TTL: 300s
         UUIDTTL: 5s
+        MaxBlockEntries:      4
         MaxCollectionEntries: 1000
         MaxCollectionBytes:   100000000
         MaxPermissionEntries: 1000
index db4e6dcd89a3e858f67eb7e4ded3531a19f2d3b4..02043fb6d192e63a0e438b9f12981efbd259df70 100644 (file)
@@ -60,6 +60,7 @@ func (sc *Config) GetCluster(clusterID string) (*Cluster, error) {
 type WebDAVCacheConfig struct {
        TTL                  Duration
        UUIDTTL              Duration
+       MaxBlockEntries      int
        MaxCollectionEntries int
        MaxCollectionBytes   int64
        MaxPermissionEntries int
index 47e1e4bb178f2d0bd3f6d99dec1c23458bcd2ff0..1d5891ed62832e4fc761e7005122f5d2b0785fcd 100644 (file)
@@ -6,9 +6,9 @@ fpm_depends+=('git >= 1.7.10')
 
 case "$TARGET" in
     centos*)
-        fpm_depends+=(libcurl-devel postgresql-devel arvados-server)
+        fpm_depends+=(libcurl-devel postgresql-devel)
         ;;
     debian* | ubuntu*)
-        fpm_depends+=(libcurl-ssl-dev libpq-dev g++ arvados-server)
+        fpm_depends+=(libcurl-ssl-dev libpq-dev g++)
         ;;
 esac
diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb
deleted file mode 100755 (executable)
index 0803248..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env ruby
-# Copyright (C) The Arvados Authors. All rights reserved.
-#
-# SPDX-License-Identifier: AGPL-3.0
-
-puts "**************************************
-The jobs API (crunch v1) is no longer supported.  This is a stub
-script that exists only to assist in a smooth upgrade.  You should
-remove crunch-dispatch.rb from your init configuration.  This script
-will now sleep forever.
-**************************************
-"
-
-while true do
-  sleep 10
-end
index 863b91a7e1beecae13635cb0e89c830bb264faac..f9e0c1a505376b76e9242ac721a09d7a37fc17ba 100644 (file)
@@ -79,6 +79,7 @@ func (h *handler) setup() {
        h.clientPool = arvadosclient.MakeClientPool()
 
        keepclient.RefreshServiceDiscoveryOnSIGHUP()
+       keepclient.DefaultBlockCache.MaxBlocks = h.Config.cluster.Collections.WebDAVCache.MaxBlockEntries
 
        h.healthHandler = &health.Handler{
                Token:  h.Config.cluster.ManagementToken,
index 1d264fc052772809534b0a2db174ca3e91fc3604..1090151e1ae3fd872da91e6badc3ff277008eba8 100644 (file)
@@ -21,6 +21,7 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/arvadostest"
        "git.curoverse.com/arvados.git/sdk/go/auth"
+       "git.curoverse.com/arvados.git/sdk/go/keepclient"
        check "gopkg.in/check.v1"
 )
 
@@ -38,6 +39,24 @@ func (s *UnitSuite) SetUpTest(c *check.C) {
        s.Config = cfg
 }
 
+func (s *UnitSuite) TestKeepClientBlockCache(c *check.C) {
+       cfg := newConfig(s.Config)
+       cfg.cluster.Collections.WebDAVCache.MaxBlockEntries = 42
+       h := handler{Config: cfg}
+       c.Check(keepclient.DefaultBlockCache.MaxBlocks, check.Not(check.Equals), cfg.cluster.Collections.WebDAVCache.MaxBlockEntries)
+       u := mustParseURL("http://keep-web.example/c=" + arvadostest.FooCollection + "/t=" + arvadostest.ActiveToken + "/foo")
+       req := &http.Request{
+               Method:     "GET",
+               Host:       u.Host,
+               URL:        u,
+               RequestURI: u.RequestURI(),
+       }
+       resp := httptest.NewRecorder()
+       h.ServeHTTP(resp, req)
+       c.Check(resp.Code, check.Equals, http.StatusOK)
+       c.Check(keepclient.DefaultBlockCache.MaxBlocks, check.Equals, cfg.cluster.Collections.WebDAVCache.MaxBlockEntries)
+}
+
 func (s *UnitSuite) TestCORSPreflight(c *check.C) {
        h := handler{Config: newConfig(s.Config)}
        u := mustParseURL("http://keep-web.example/c=" + arvadostest.FooCollection + "/foo")
index 4456a69cf5741feb341c1d1f8f24321e4c7725cb..58bedd2841b41e0a5cf2a6e1a0cc0a8158ab69f0 100755 (executable)
@@ -81,6 +81,8 @@ Clusters:
         ExternalURL: "https://$localip:${services[sso]}"
       Websocket:
         ExternalURL: "wss://$localip:${services[websockets-ssl]}/websocket"
+        InternalURLs:
+          "http://localhost:${services[websockets]}": {}
       GitSSH:
         ExternalURL: "ssh://git@$localip:"
       GitHTTP:
@@ -93,12 +95,21 @@ Clusters:
         InternalURLs:
           "http://localhost:${services[keep-web]}/": {}
         ExternalURL: "https://$localip:${services[keep-web-ssl]}/"
+        InternalURLs:
+          "http://localhost:${services[keep-web]}/": {}
       Composer:
         ExternalURL: "http://$localip:${services[composer]}"
       Controller:
         ExternalURL: "https://$localip:${services[controller-ssl]}"
         InternalURLs:
           "http://localhost:${services[controller]}": {}
+      RailsAPI:
+        InternalURLs:
+          "http://localhost:${services[api]}/": {}
+      Keepproxy:
+        ExternalURL: "https://$localip:${services[keepproxy-ssl]}"
+        InternalURLs:
+          "http://localhost:${services[keepproxy]}": {}
     PostgreSQL:
       ConnectionPool: 32 # max concurrent connections per arvados server daemon
       Connection:
index 8e4e74ca0f6ca2dec0c4782d56f6d49b56a1d18a..21872749575cbcb2a4fb03ee7c97e0114046f56d 100644 (file)
@@ -37,6 +37,7 @@ services=(
   [keep-web]=9003
   [keep-web-ssl]=9002
   [keepproxy]=25100
+  [keepproxy-ssl]=25101
   [keepstore0]=25107
   [keepstore1]=25108
   [ssh]=22
index bf802d45f3d8bdb9f13868bb39f66136ab34f42c..78b5bcf8e8d430d302b4922c10b241c9469512f9 100755 (executable)
@@ -25,8 +25,8 @@ set +e
 read -rd $'\000' keepservice <<EOF
 {
  "service_host":"$localip",
- "service_port":${services[keepproxy]},
- "service_ssl_flag":false,
+ "service_port":${services[keepproxy-ssl]},
+ "service_ssl_flag":true,
  "service_type":"proxy"
 }
 EOF
index 18c56ce9dd3708e4e7230757f8a8a571ce64bcc1..04a1b539526f31547011d02d4db18ae508434883 100755 (executable)
@@ -114,6 +114,7 @@ server {
     server_name keep-web;
     ssl_certificate "${server_cert}";
     ssl_certificate_key "${server_cert_key}";
+    client_max_body_size 0;
     location  / {
       proxy_pass http://keep-web;
       proxy_set_header Host \$http_host;
@@ -123,6 +124,25 @@ server {
     }
   }
 
+
+  upstream keepproxy {
+    server localhost:${services[keepproxy]};
+  }
+  server {
+    listen *:${services[keepproxy-ssl]} ssl default_server;
+    server_name keepproxy;
+    ssl_certificate "${server_cert}";
+    ssl_certificate_key "${server_cert_key}";
+    client_max_body_size 128M;
+    location  / {
+      proxy_pass http://keepproxy;
+      proxy_set_header Host \$http_host;
+      proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
+      proxy_set_header X-Forwarded-Proto https;
+      proxy_redirect off;
+    }
+  }
+
 }
 
 EOF