Merge branch '17610-remote-token-scopes'
[arvados.git] / lib / boot / service.go
index 018e9f8bb06fe096a8c680fe7f68b36d809b16c6..090e852446f7c3270f50c94a7ac88870d162a38e 100644 (file)
@@ -30,18 +30,23 @@ 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, runner.depends...)
        for u := range runner.svc.InternalURLs {
                u := u
+               if islocal, err := addrIsLocal(u.Host); err != nil {
+                       return err
+               } else if !islocal {
+                       continue
+               }
                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()}}, binfile, runner.name, "-config", super.configfile))
                }()
        }
        return nil
@@ -72,7 +77,7 @@ 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
        }
@@ -80,10 +85,15 @@ func (runner runGoProgram) Run(ctx context.Context, fail func(error), super *Sup
        super.wait(ctx, runner.depends...)
        for u := range runner.svc.InternalURLs {
                u := u
+               if islocal, err := addrIsLocal(u.Host); err != nil {
+                       return err
+               } else if !islocal {
+                       continue
+               }
                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