18184: Install singularity 3.7.4 for dev/test.
[arvados.git] / lib / install / deps.go
index 504cdff8f2e4ab24f834761cb7b9558643f6914b..6dd28d6cec4bf8fa2b3674fd3f512ca4f734346e 100644 (file)
@@ -178,9 +178,15 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read
                        "r-cran-roxygen2",
                        "r-cran-xml",
                        "sudo",
+                       "uuid-dev",
                        "wget",
                        "xvfb",
                )
+               if dev || test {
+                       pkgs = append(pkgs,
+                               "squashfs-tools", // for singularity
+                       )
+               }
                switch {
                case osv.Debian && osv.Major >= 10:
                        pkgs = append(pkgs, "libcurl4")
@@ -218,21 +224,20 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read
                        return 1
                }
        }
-       rubyversion := "2.5.7"
+       rubyversion := "2.7.2"
+       rubymajorversion := rubyversion[:strings.LastIndex(rubyversion, ".")]
        if haverubyversion, err := exec.Command("/var/lib/arvados/bin/ruby", "-v").CombinedOutput(); err == nil && bytes.HasPrefix(haverubyversion, []byte("ruby "+rubyversion)) {
                logger.Print("ruby " + rubyversion + " already installed")
        } else {
                err = inst.runBash(`
 tmp="$(mktemp -d)"
 trap 'rm -r "${tmp}"' ERR EXIT
-wget --progress=dot:giga -O- https://cache.ruby-lang.org/pub/ruby/2.5/ruby-`+rubyversion+`.tar.gz | tar -C "${tmp}" -xzf -
+wget --progress=dot:giga -O- https://cache.ruby-lang.org/pub/ruby/`+rubymajorversion+`/ruby-`+rubyversion+`.tar.gz | tar -C "${tmp}" -xzf -
 cd "${tmp}/ruby-`+rubyversion+`"
 ./configure --disable-install-static-library --enable-shared --disable-install-doc --prefix /var/lib/arvados
 make -j8
 make install
-/var/lib/arvados/bin/gem install bundler --no-ri --no-rdoc
-# "gem update --system" can be removed when we use ruby ≥2.6.3: https://bundler.io/blog/2019/05/14/solutions-for-cant-find-gem-bundler-with-executable-bundle.html
-/var/lib/arvados/bin/gem update --system --no-ri --no-rdoc
+/var/lib/arvados/bin/gem install bundler --no-document
 `, stdout, stderr)
                if err != nil {
                        return 1
@@ -240,12 +245,13 @@ make install
        }
 
        if !prod {
-               goversion := "1.14"
+               goversion := "1.16.3"
                if havegoversion, err := exec.Command("/usr/local/bin/go", "version").CombinedOutput(); err == nil && bytes.HasPrefix(havegoversion, []byte("go version go"+goversion+" ")) {
                        logger.Print("go " + goversion + " already installed")
                } else {
                        err = inst.runBash(`
 cd /tmp
+rm -rf /var/lib/arvados/go/
 wget --progress=dot:giga -O- https://storage.googleapis.com/golang/go`+goversion+`.linux-amd64.tar.gz | tar -C /var/lib/arvados -xzf -
 ln -sf /var/lib/arvados/go/bin/* /usr/local/bin/
 `, stdout, stderr)
@@ -284,7 +290,7 @@ ln -sf /var/lib/arvados/bin/geckodriver /usr/local/bin/
                        }
                }
 
-               nodejsversion := "v8.15.1"
+               nodejsversion := "v12.22.2"
                if havenodejsversion, err := exec.Command("/usr/local/bin/node", "--version").CombinedOutput(); err == nil && string(havenodejsversion) == nodejsversion+"\n" {
                        logger.Print("nodejs " + nodejsversion + " already installed")
                } else {
@@ -316,6 +322,27 @@ rm ${zip}
                        }
                }
 
+               singularityversion := "3.7.4"
+               if havesingularityversion, err := exec.Command("/var/lib/arvados/bin/singularity", "--version").CombinedOutput(); err == nil && strings.Contains(string(havesingularityversion), singularityversion) {
+                       logger.Print("singularity " + singularityversion + " already installed")
+               } else if dev || test {
+                       err = inst.runBash(`
+S=`+singularityversion+`
+tmp=/var/lib/arvados/tmp/singularity
+trap "rm -r ${tmp}" ERR EXIT
+cd /var/lib/arvados/tmp
+git clone https://github.com/sylabs/singularity
+cd singularity
+git checkout v${S}
+./mconfig --prefix=/var/lib/arvados
+make -C ./builddir
+make -C ./builddir install
+`, stdout, stderr)
+                       if err != nil {
+                               return 1
+                       }
+               }
+
                // The entry in /etc/locale.gen is "en_US.UTF-8"; once
                // it's installed, locale -a reports it as
                // "en_US.utf8".
@@ -450,6 +477,7 @@ rm ${zip}
                                "--exclude", "/log",
                                "--exclude", "/tmp",
                                "--exclude", "/vendor",
+                               "--exclude", "/config/environments",
                                "./", "/var/lib/arvados/"+dstdir+"/")
                        cmd.Dir = filepath.Join(inst.SourcePath, srcdir)
                        cmd.Stdout = stdout
@@ -462,7 +490,7 @@ rm ${zip}
                                {"mkdir", "-p", "log", "tmp", ".bundle", "/var/www/.gem", "/var/www/.bundle", "/var/www/.passenger"},
                                {"touch", "log/production.log"},
                                {"chown", "-R", "--from=root", "www-data:www-data", "/var/www/.gem", "/var/www/.bundle", "/var/www/.passenger", "log", "tmp", ".bundle", "Gemfile.lock", "config.ru", "config/environment.rb"},
-                               {"sudo", "-u", "www-data", "/var/lib/arvados/bin/gem", "install", "--user", "--conservative", "--no-document", "bundler:1.16.6", "bundler:1.17.3", "bundler:2.0.2"},
+                               {"sudo", "-u", "www-data", "/var/lib/arvados/bin/gem", "install", "--user", "--conservative", "--no-document", "bundler:2.2.19"},
                                {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "install", "--deployment", "--jobs", "8", "--path", "/var/www/.gem"},
                                {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "exec", "passenger-config", "build-native-support"},
                                {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "exec", "passenger-config", "install-standalone-runtime"},