X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/10f4f6d203e7d7cacfe2d6620fa4515c2354c556..49db4a42db194423978996acb9325aeb3eaaf403:/lib/boot/nginx.go diff --git a/lib/boot/nginx.go b/lib/boot/nginx.go index 11d823fc02..5c1954c838 100644 --- a/lib/boot/nginx.go +++ b/lib/boot/nginx.go @@ -7,7 +7,6 @@ package boot import ( "context" "fmt" - "io" "io/ioutil" "os" "os/exec" @@ -17,13 +16,20 @@ import ( "git.arvados.org/arvados.git/sdk/go/arvados" ) -func runNginx(ctx context.Context, boot *bootCommand, stdout, stderr io.Writer) error { +type runNginx struct{} + +func (runNginx) String() string { + return "nginx" +} + +func (runNginx) Run(ctx context.Context, fail func(error), boot *Booter) error { vars := map[string]string{ - "SSLCERT": filepath.Join(boot.sourcePath, "services", "api", "tmp", "self-signed.pem"), // TODO: root ca - "SSLKEY": filepath.Join(boot.sourcePath, "services", "api", "tmp", "self-signed.key"), // TODO: root ca - "ACCESSLOG": filepath.Join(boot.tempdir, "nginx_access.log"), - "ERRORLOG": filepath.Join(boot.tempdir, "nginx_error.log"), - "TMPDIR": boot.tempdir, + "LISTENHOST": boot.ListenHost, + "SSLCERT": filepath.Join(boot.SourcePath, "services", "api", "tmp", "self-signed.pem"), // TODO: root ca + "SSLKEY": filepath.Join(boot.SourcePath, "services", "api", "tmp", "self-signed.key"), // TODO: root ca + "ACCESSLOG": filepath.Join(boot.tempdir, "nginx_access.log"), + "ERRORLOG": filepath.Join(boot.tempdir, "nginx_error.log"), + "TMPDIR": boot.tempdir, } var err error for _, cmpt := range []struct { @@ -35,6 +41,7 @@ func runNginx(ctx context.Context, boot *bootCommand, stdout, stderr io.Writer) {"KEEPWEBDL", boot.cluster.Services.WebDAVDownload}, {"KEEPPROXY", boot.cluster.Services.Keepproxy}, {"GIT", boot.cluster.Services.GitHTTP}, + {"WORKBENCH1", boot.cluster.Services.Workbench1}, {"WS", boot.cluster.Services.Websocket}, } { vars[cmpt.varname+"PORT"], err = internalPort(cmpt.svc) @@ -46,7 +53,7 @@ func runNginx(ctx context.Context, boot *bootCommand, stdout, stderr io.Writer) return fmt.Errorf("%s external port: %s (%v)", cmpt.varname, err, cmpt.svc) } } - tmpl, err := ioutil.ReadFile(filepath.Join(boot.sourcePath, "sdk", "python", "tests", "nginx.conf")) + tmpl, err := ioutil.ReadFile(filepath.Join(boot.SourcePath, "sdk", "python", "tests", "nginx.conf")) if err != nil { return err } @@ -70,8 +77,11 @@ func runNginx(ctx context.Context, boot *bootCommand, stdout, stderr io.Writer) } } } - return boot.RunProgram(ctx, ".", nil, nil, nginx, - "-g", "error_log stderr info;", - "-g", "pid "+filepath.Join(boot.tempdir, "nginx.pid")+";", - "-c", conffile) + go func() { + fail(boot.RunProgram(ctx, ".", nil, nil, nginx, + "-g", "error_log stderr info;", + "-g", "pid "+filepath.Join(boot.tempdir, "nginx.pid")+";", + "-c", conffile)) + }() + return waitForConnect(ctx, boot.cluster.Services.Controller.ExternalURL.Host) }