Merge branch '21678-installer-diagnostics-internal'. Closes #21678
[arvados.git] / lib / boot / service.go
index 5afacfe7161c28604e8d56de4a5f83a7c80f320f..506407f4e8537a451ab47029ff5c7eeba55465dd 100644 (file)
@@ -30,11 +30,12 @@ func (runner runServiceCommand) String() string {
 }
 
 func (runner runServiceCommand) Run(ctx context.Context, fail func(error), super *Supervisor) error {
-       binfile := filepath.Join(super.tempdir, "bin", "arvados-server")
-       err := super.RunProgram(ctx, super.tempdir, nil, nil, binfile, "-version")
+       binfile := filepath.Join(super.bindir, "arvados-server")
+       err := super.RunProgram(ctx, super.bindir, runOptions{}, binfile, "-version")
        if err != nil {
                return err
        }
+       super.wait(ctx, createCertificates{})
        super.wait(ctx, runner.depends...)
        for u := range runner.svc.InternalURLs {
                u := u
@@ -46,7 +47,15 @@ func (runner runServiceCommand) Run(ctx context.Context, fail func(error), super
                super.waitShutdown.Add(1)
                go func() {
                        defer super.waitShutdown.Done()
-                       fail(super.RunProgram(ctx, super.tempdir, nil, []string{"ARVADOS_SERVICE_INTERNAL_URL=" + u.String()}, binfile, runner.name, "-config", super.configfile))
+                       fail(super.RunProgram(ctx, super.tempdir, runOptions{
+                               env: []string{
+                                       "ARVADOS_SERVICE_INTERNAL_URL=" + u.String(),
+                                       // Child process should not
+                                       // try to tell systemd that we
+                                       // are ready.
+                                       "NOTIFY_SOCKET=",
+                               },
+                       }, binfile, runner.name, "-config", super.configfile))
                }()
        }
        return nil
@@ -77,11 +86,12 @@ func (runner runGoProgram) Run(ctx context.Context, fail func(error), super *Sup
                return ctx.Err()
        }
 
-       err = super.RunProgram(ctx, super.tempdir, nil, nil, binfile, "-version")
+       err = super.RunProgram(ctx, super.tempdir, runOptions{}, binfile, "-version")
        if err != nil {
                return err
        }
 
+       super.wait(ctx, createCertificates{})
        super.wait(ctx, runner.depends...)
        for u := range runner.svc.InternalURLs {
                u := u
@@ -93,7 +103,7 @@ func (runner runGoProgram) Run(ctx context.Context, fail func(error), super *Sup
                super.waitShutdown.Add(1)
                go func() {
                        defer super.waitShutdown.Done()
-                       fail(super.RunProgram(ctx, super.tempdir, nil, []string{"ARVADOS_SERVICE_INTERNAL_URL=" + u.String()}, binfile))
+                       fail(super.RunProgram(ctx, super.tempdir, runOptions{env: []string{"ARVADOS_SERVICE_INTERNAL_URL=" + u.String()}}, binfile))
                }()
        }
        return nil