X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0a29de2f77bcce28b89561897d1b746a8c9151ac..4a9acc11eaba55a152851256d19c8fdad3b9f863:/lib/install/deps.go diff --git a/lib/install/deps.go b/lib/install/deps.go index 178d447c3f..a5c428d0a0 100644 --- a/lib/install/deps.go +++ b/lib/install/deps.go @@ -34,13 +34,13 @@ const goversion = "1.17.7" const ( rubyversion = "2.7.5" bundlerversion = "2.2.19" - singularityversion = "3.7.4" + singularityversion = "3.9.9" pjsversion = "1.9.8" geckoversion = "0.24.0" gradleversion = "5.3.1" nodejsversion = "v12.22.11" devtestDatabasePassword = "insecure_arvados_test" - workbench2version = "5e020488f67b5bc919796e0dc8b0b9f3b3ff23b0" + workbench2version = "2454ac35292a79594c32a80430740317ed5005cf" ) //go:embed arvados.service @@ -138,7 +138,6 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read pkgs = append(pkgs, "dpkg-dev", "eatmydata", // install it for later steps, even if we're not using it now - "rsync", ) } @@ -185,6 +184,7 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read "r-cran-markdown", "r-cran-roxygen2", "r-cran-xml", + "rsync", "sudo", "uuid-dev", "wget", @@ -199,10 +199,13 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read } if dev || test { pkgs = append(pkgs, "squashfs-tools") // for singularity + pkgs = append(pkgs, "gnupg") // for docker install recipe } switch { - case osv.Debian && osv.Major >= 10: + case osv.Debian && osv.Major >= 11: pkgs = append(pkgs, "libcurl4", "perl-modules-5.32") + case osv.Debian && osv.Major >= 10: + pkgs = append(pkgs, "libcurl4", "perl-modules") default: pkgs = append(pkgs, "libcurl3", "perl-modules") } @@ -221,6 +224,37 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read } } + if dev || test { + if havedockerversion, err := exec.Command("docker", "--version").CombinedOutput(); err == nil { + logger.Printf("%s installed, assuming that version is ok", bytes.TrimSuffix(havedockerversion, []byte("\n"))) + } else if osv.Debian { + var codename string + switch osv.Major { + case 10: + codename = "buster" + case 11: + codename = "bullseye" + default: + err = fmt.Errorf("don't know how to install docker-ce for debian %d", osv.Major) + return 1 + } + err = inst.runBash(` +rm -f /usr/share/keyrings/docker-archive-keyring.gpg +curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg +echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian/ `+codename+` stable' | \ + tee /etc/apt/sources.list.d/docker.list +apt-get update +DEBIAN_FRONTEND=noninteractive apt-get --yes --no-install-recommends install docker-ce +`, stdout, stderr) + if err != nil { + return 1 + } + } else { + err = fmt.Errorf("don't know how to install docker for osversion %v", osv) + return 1 + } + } + os.Mkdir("/var/lib/arvados", 0755) os.Mkdir("/var/lib/arvados/tmp", 0700) if prod || pkg { @@ -336,6 +370,14 @@ make -C ./builddir install } } + err = inst.runBash(` +install /usr/bin/nsenter /var/lib/arvados/bin/nsenter +setcap "cap_sys_admin+pei cap_sys_chroot+pei" /var/lib/arvados/bin/nsenter +`, 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". @@ -521,15 +563,6 @@ yarn install for _, srcdir := range []string{ "cmd/arvados-client", "cmd/arvados-server", - "services/arv-git-httpd", - "services/crunch-dispatch-local", - "services/crunch-dispatch-slurm", - "services/health", - "services/keep-balance", - "services/keep-web", - "services/keepproxy", - "services/keepstore", - "services/ws", } { fmt.Fprintf(stderr, "building %s...\n", srcdir) cmd := exec.Command("go", "install", "-ldflags", "-X git.arvados.org/arvados.git/lib/cmd.version="+inst.PackageVersion+" -X main.version="+inst.PackageVersion+" -s -w") @@ -544,19 +577,6 @@ yarn install } } - // Symlink user-facing Go programs /usr/bin/x -> - // /var/lib/arvados/bin/x - for _, prog := range []string{"arvados-client", "arvados-server"} { - err = os.Remove("/usr/bin/" + prog) - if err != nil && !errors.Is(err, os.ErrNotExist) { - return 1 - } - err = os.Symlink("/var/lib/arvados/bin/"+prog, "/usr/bin/"+prog) - if err != nil { - return 1 - } - } - // Copy assets from source tree to /var/lib/arvados/share cmd := exec.Command("install", "-v", "-t", "/var/lib/arvados/share", filepath.Join(inst.SourcePath, "sdk/python/tests/nginx.conf")) cmd.Stdout = stdout @@ -566,6 +586,33 @@ yarn install return 1 } + // Install python SDK and arv-mount in + // /var/lib/arvados/lib/python. + // + // setup.py writes a file in the source directory in + // order to include the version number in the package + // itself. We don't want to write to the source tree + // (in "arvados-package" context it's mounted + // readonly) so we run setup.py in a temporary copy of + // the source dir. + if err = inst.runBash(` +v=/var/lib/arvados/lib/python +tmp=/var/lib/arvados/tmp/python +python3 -m venv "$v" +. "$v/bin/activate" +pip3 install --no-cache-dir 'setuptools>=18.5' 'pip>=7' +export ARVADOS_BUILDING_VERSION="`+inst.PackageVersion+`" +for src in "`+inst.SourcePath+`/sdk/python" "`+inst.SourcePath+`/services/fuse"; do + rsync -a --delete-after "$src/" "$tmp/" + cd "$tmp" + python3 setup.py install + cd .. + rm -rf "$tmp" +done +`, stdout, stderr); err != nil { + return 1 + } + // Install Rails apps to /var/lib/arvados/{railsapi,workbench1}/ for dstdir, srcdir := range map[string]string{ "railsapi": "services/api", @@ -594,12 +641,15 @@ yarn install {"touch", "log/production.log"}, {"chown", "-R", "--from=root", "www-data:www-data", "/var/www/.bundle", "/var/www/.gem", "/var/www/.npm", "/var/www/.passenger", "log", "tmp", "vendor", ".bundle", "Gemfile.lock", "config.ru", "config/environment.rb"}, {"sudo", "-u", "www-data", "/var/lib/arvados/bin/gem", "install", "--user", "--conservative", "--no-document", "bundler:" + bundlerversion}, - {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "install", "--deployment", "--jobs", "8", "--path", "/var/www/.gem", "--without", "development test diagnostics performance"}, + {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "config", "set", "--local", "deployment", "true"}, + {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "config", "set", "--local", "path", "/var/www/.gem"}, + {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "config", "set", "--local", "without", "development test diagnostics performance"}, + {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "install", "--jobs", "8"}, {"chown", "www-data:www-data", ".", "public/assets"}, // {"sudo", "-u", "www-data", "/var/lib/arvados/bin/bundle", "config", "set", "--local", "system", "true"}, - {"sudo", "-u", "www-data", "ARVADOS_CONFIG=none", "RAILS_GROUPS=assets", "RAILS_ENV=production", "/var/lib/arvados/bin/bundle", "exec", "rake", "npm:install"}, - {"sudo", "-u", "www-data", "ARVADOS_CONFIG=none", "RAILS_GROUPS=assets", "RAILS_ENV=production", "/var/lib/arvados/bin/bundle", "exec", "rake", "assets:precompile"}, + {"sudo", "-u", "www-data", "ARVADOS_CONFIG=none", "RAILS_GROUPS=assets", "RAILS_ENV=production", "PATH=/var/lib/arvados/bin:" + os.Getenv("PATH"), "/var/lib/arvados/bin/bundle", "exec", "rake", "npm:install"}, + {"sudo", "-u", "www-data", "ARVADOS_CONFIG=none", "RAILS_GROUPS=assets", "RAILS_ENV=production", "PATH=/var/lib/arvados/bin:" + os.Getenv("PATH"), "/var/lib/arvados/bin/bundle", "exec", "rake", "assets:precompile"}, {"chown", "root:root", "."}, {"chown", "-R", "root:root", "public/assets", "vendor"}, @@ -642,21 +692,71 @@ rsync -a --delete-after build/ /var/lib/arvados/workbench2/ return 1 } + // Install arvados-cli gem (binaries go in + // /var/lib/arvados/bin) + if err = inst.runBash(` +/var/lib/arvados/bin/gem install --conservative --no-document arvados-cli +`, stdout, stderr); err != nil { + return 1 + } + err = os.WriteFile("/lib/systemd/system/arvados.service", arvadosServiceFile, 0777) if err != nil { return 1 } - // This is equivalent to "systemd enable", but does - // not depend on the systemctl program being - // available. - symlink := "/etc/systemd/system/multi-user.target.wants/arvados.service" - err = os.Remove(symlink) - if err != nil && !errors.Is(err, os.ErrNotExist) { - return 1 + if prod { + // (fpm will do this for us in the pkg case) + // This is equivalent to "systemd enable", but + // does not depend on the systemctl program + // being available: + symlink := "/etc/systemd/system/multi-user.target.wants/arvados.service" + err = os.Remove(symlink) + if err != nil && !errors.Is(err, os.ErrNotExist) { + return 1 + } + err = os.Symlink("/lib/systemd/system/arvados.service", symlink) + if err != nil { + return 1 + } } - err = os.Symlink("/lib/systemd/system/arvados.service", symlink) - if err != nil { - return 1 + + // Add symlinks in /usr/bin for user-facing programs + for _, srcdst := range [][]string{ + // go + {"bin/arvados-client"}, + {"bin/arvados-client", "arv"}, + {"bin/arvados-server"}, + // sdk/cli + {"bin/arv", "arv-ruby"}, + {"bin/arv-tag"}, + // sdk/python + {"lib/python/bin/arv-copy"}, + {"lib/python/bin/arv-federation-migrate"}, + {"lib/python/bin/arv-get"}, + {"lib/python/bin/arv-keepdocker"}, + {"lib/python/bin/arv-ls"}, + {"lib/python/bin/arv-migrate-docker19"}, + {"lib/python/bin/arv-normalize"}, + {"lib/python/bin/arv-put"}, + {"lib/python/bin/arv-ws"}, + // services/fuse + {"lib/python/bin/arv-mount"}, + } { + src := "/var/lib/arvados/" + srcdst[0] + if _, err = os.Stat(src); err != nil { + return 1 + } + dst := srcdst[len(srcdst)-1] + _, dst = filepath.Split(dst) + dst = "/usr/bin/" + dst + err = os.Remove(dst) + if err != nil && !errors.Is(err, os.ErrNotExist) { + return 1 + } + err = os.Symlink(src, dst) + if err != nil { + return 1 + } } }