import (
"context"
"fmt"
- "io"
"io/ioutil"
"os"
"os/exec"
"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 {
{"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)
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
}
}
}
}
- 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)
}