Merge branch '21055-sysctl-in-docker'
authorTom Clegg <tom@curii.com>
Tue, 17 Oct 2023 22:53:08 +0000 (18:53 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Tue, 28 Nov 2023 14:34:59 +0000 (09:34 -0500)
closes #21055

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/install/deps.go

index cbf050d7dce5e2e0777bf19d4e648358f9cc97ea..08daec6c2f2c008f08ab9bb889a85abb65936c2a 100644 (file)
@@ -232,7 +232,7 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read
        }
 
        if dev || test {
-               if havedockerversion, err := exec.Command("docker", "--version").CombinedOutput(); err == nil {
+               if havedockerversion, err2 := exec.Command("docker", "--version").CombinedOutput(); err2 == nil {
                        logger.Printf("%s installed, assuming that version is ok", bytes.TrimSuffix(havedockerversion, []byte("\n")))
                } else if osv.Debian {
                        var codename string
@@ -241,6 +241,8 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read
                                codename = "buster"
                        case 11:
                                codename = "bullseye"
+                       case 12:
+                               codename = "bookworm"
                        default:
                                err = fmt.Errorf("don't know how to install docker-ce for debian %d", osv.Major)
                                return 1
@@ -260,6 +262,21 @@ DEBIAN_FRONTEND=noninteractive apt-get --yes --no-install-recommends install doc
                        err = fmt.Errorf("don't know how to install docker for osversion %v", osv)
                        return 1
                }
+
+               err = inst.runBash(`
+key=fs.inotify.max_user_watches
+min=524288
+if [[ "$(sysctl --values "${key}")" -lt "${min}" ]]; then
+    sysctl "${key}=${min}"
+    # writing sysctl worked, so we should make it permanent
+    echo "${key}=${min}" | tee -a /etc/sysctl.conf
+    sysctl -p
+fi
+`, stdout, stderr)
+               if err != nil {
+                       err = fmt.Errorf("couldn't set fs.inotify.max_user_watches value. (Is this a docker container? Fix this on the docker host by adding fs.inotify.max_user_watches=524288 to /etc/sysctl.conf and running `sysctl -p`)")
+                       return 1
+               }
        }
 
        os.Mkdir("/var/lib/arvados", 0755)