[ARVADOS] created: 2.1.0-2206-g7e25436db
Git user
git at public.arvados.org
Thu Apr 7 15:36:10 UTC 2022
at 7e25436db3925201d8600a35211e5d4236360690 (commit)
commit 7e25436db3925201d8600a35211e5d4236360690
Author: Tom Clegg <tom at curii.com>
Date: Thu Apr 7 11:35:33 2022 -0400
18947: Close trackers before existing dispatch goroutine.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/sdk/go/dispatch/dispatch.go b/sdk/go/dispatch/dispatch.go
index a0a61f2b6..227445476 100644
--- a/sdk/go/dispatch/dispatch.go
+++ b/sdk/go/dispatch/dispatch.go
@@ -98,6 +98,11 @@ func (d *Dispatcher) Run(ctx context.Context) error {
case <-poll.C:
break
case <-ctx.Done():
+ d.mtx.Lock()
+ for _, tracker := range d.trackers {
+ tracker.close()
+ }
+ d.mtx.Unlock()
return ctx.Err()
}
commit 9b526226373cda1a5f094020ba0b7d3abbc0730b
Author: Tom Clegg <tom at curii.com>
Date: Thu Apr 7 11:35:27 2022 -0400
18947: Use git-ls-files instead of git-grep to find go dirs.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/build/run-tests.sh b/build/run-tests.sh
index 3592efbdc..c90dd30ae 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -979,7 +979,7 @@ pythonstuff=(
)
declare -a gostuff
-gostuff=($(cd "$WORKSPACE" && git grep -lw func | grep \\.go | sed -e 's/\/[^\/]*$//' | sort -u))
+gostuff=($(cd "$WORKSPACE" && git ls-files | grep '\.go$' | sed -e 's/\/[^\/]*$//' | sort -u))
install_apps/workbench() {
cd "$WORKSPACE/apps/workbench" \
commit e8729a38a98b47860aba0b10577385fb53ca43a5
Author: Tom Clegg <tom at curii.com>
Date: Tue Apr 5 18:50:13 2022 -0400
18947: Refactor arv-git-httpd as an arvados-server subcommand.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/build/run-build-packages.sh b/build/run-build-packages.sh
index 164755fda..debc521fa 100755
--- a/build/run-build-packages.sh
+++ b/build/run-build-packages.sh
@@ -241,7 +241,7 @@ package_go_binary cmd/arvados-server arvados-dispatch-cloud "$FORMAT" "$ARCH" \
"Arvados cluster cloud dispatch"
package_go_binary cmd/arvados-server arvados-dispatch-lsf "$FORMAT" "$ARCH" \
"Dispatch Arvados containers to an LSF cluster"
-package_go_binary services/arv-git-httpd arvados-git-httpd "$FORMAT" "$ARCH" \
+package_go_binary cmd/arvados-server arv-git-httpd "$FORMAT" "$ARCH" \
"Provide authenticated http access to Arvados-hosted git repositories"
package_go_binary services/crunch-dispatch-local crunch-dispatch-local "$FORMAT" "$ARCH" \
"Dispatch Crunch containers on the local system"
diff --git a/services/arv-git-httpd/arvados-git-httpd.service b/cmd/arvados-server/arv-git-httpd.service
similarity index 68%
rename from services/arv-git-httpd/arvados-git-httpd.service
rename to cmd/arvados-server/arv-git-httpd.service
index 6c2b3bc58..58482d735 100644
--- a/services/arv-git-httpd/arvados-git-httpd.service
+++ b/cmd/arvados-server/arv-git-httpd.service
@@ -3,16 +3,20 @@
# SPDX-License-Identifier: AGPL-3.0
[Unit]
-Description=Arvados git server
+Description=arvados git server
Documentation=https://doc.arvados.org/
After=network.target
+AssertPathExists=/etc/arvados/config.yml
# systemd>=230 (debian:9) obeys StartLimitIntervalSec in the [Unit] section
StartLimitIntervalSec=0
[Service]
Type=notify
-ExecStart=/usr/bin/arvados-git-httpd
+EnvironmentFile=-/etc/arvados/environment
+ExecStart=/usr/bin/arv-git-httpd
+# Set a reasonable default for the open file limit
+LimitNOFILE=65536
Restart=always
RestartSec=1
diff --git a/cmd/arvados-server/cmd.go b/cmd/arvados-server/cmd.go
index 13b06d679..d991eed5c 100644
--- a/cmd/arvados-server/cmd.go
+++ b/cmd/arvados-server/cmd.go
@@ -17,6 +17,7 @@ import (
"git.arvados.org/arvados.git/lib/install"
"git.arvados.org/arvados.git/lib/lsf"
"git.arvados.org/arvados.git/lib/recovercollection"
+ "git.arvados.org/arvados.git/services/githttpd"
"git.arvados.org/arvados.git/services/keepproxy"
"git.arvados.org/arvados.git/services/keepstore"
"git.arvados.org/arvados.git/services/ws"
@@ -37,6 +38,7 @@ var (
"crunch-run": crunchrun.Command,
"dispatch-cloud": dispatchcloud.Command,
"dispatch-lsf": lsf.DispatchCommand,
+ "git-httpd": githttpd.Command,
"install": install.Command,
"init": install.InitCommand,
"keepproxy": keepproxy.Command,
diff --git a/lib/cmd/cmd.go b/lib/cmd/cmd.go
index 63d7576b4..16ec59455 100644
--- a/lib/cmd/cmd.go
+++ b/lib/cmd/cmd.go
@@ -77,6 +77,10 @@ func (m Multi) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
// "controller" command exists, and binary is named "arvados-controller"
cmd, ok = m[strings.TrimPrefix(basename, "arvados-")]
}
+ if !ok {
+ // "git-httpd" command exists, and binary is named "arv-git-httpd"
+ cmd, ok = m[strings.TrimPrefix(basename, "arv-")]
+ }
if !ok {
// "dispatch-slurm" command exists, and binary is named "crunch-dispatch-slurm"
cmd, ok = m[strings.TrimPrefix(basename, "crunch-")]
diff --git a/lib/install/deps.go b/lib/install/deps.go
index 3070f8559..607d4a216 100644
--- a/lib/install/deps.go
+++ b/lib/install/deps.go
@@ -517,7 +517,6 @@ make -C ./builddir install
for _, srcdir := range []string{
"cmd/arvados-client",
"cmd/arvados-server",
- "services/arv-git-httpd",
"services/crunch-dispatch-local",
"services/crunch-dispatch-slurm",
"services/health",
diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go
index 6c9324e47..7ee30bc37 100644
--- a/sdk/go/arvados/config.go
+++ b/sdk/go/arvados/config.go
@@ -625,35 +625,37 @@ func (ss *StringSet) UnmarshalJSON(data []byte) error {
type ServiceName string
const (
- ServiceNameRailsAPI ServiceName = "arvados-api-server"
ServiceNameController ServiceName = "arvados-controller"
ServiceNameDispatchCloud ServiceName = "arvados-dispatch-cloud"
ServiceNameDispatchLSF ServiceName = "arvados-dispatch-lsf"
+ ServiceNameGitHTTP ServiceName = "arv-git-httpd"
ServiceNameHealth ServiceName = "arvados-health"
- ServiceNameWorkbench1 ServiceName = "arvados-workbench1"
- ServiceNameWorkbench2 ServiceName = "arvados-workbench2"
- ServiceNameWebsocket ServiceName = "arvados-ws"
ServiceNameKeepbalance ServiceName = "keep-balance"
- ServiceNameKeepweb ServiceName = "keep-web"
ServiceNameKeepproxy ServiceName = "keepproxy"
ServiceNameKeepstore ServiceName = "keepstore"
+ ServiceNameKeepweb ServiceName = "keep-web"
+ ServiceNameRailsAPI ServiceName = "arvados-api-server"
+ ServiceNameWebsocket ServiceName = "arvados-ws"
+ ServiceNameWorkbench1 ServiceName = "arvados-workbench1"
+ ServiceNameWorkbench2 ServiceName = "arvados-workbench2"
)
// Map returns all services as a map, suitable for iterating over all
// services or looking up a service by name.
func (svcs Services) Map() map[ServiceName]Service {
return map[ServiceName]Service{
- ServiceNameRailsAPI: svcs.RailsAPI,
ServiceNameController: svcs.Controller,
ServiceNameDispatchCloud: svcs.DispatchCloud,
ServiceNameDispatchLSF: svcs.DispatchLSF,
+ ServiceNameGitHTTP: svcs.GitHTTP,
ServiceNameHealth: svcs.Health,
- ServiceNameWorkbench1: svcs.Workbench1,
- ServiceNameWorkbench2: svcs.Workbench2,
- ServiceNameWebsocket: svcs.Websocket,
ServiceNameKeepbalance: svcs.Keepbalance,
- ServiceNameKeepweb: svcs.WebDAV,
ServiceNameKeepproxy: svcs.Keepproxy,
ServiceNameKeepstore: svcs.Keepstore,
+ ServiceNameKeepweb: svcs.WebDAV,
+ ServiceNameRailsAPI: svcs.RailsAPI,
+ ServiceNameWebsocket: svcs.Websocket,
+ ServiceNameWorkbench1: svcs.Workbench1,
+ ServiceNameWorkbench2: svcs.Workbench2,
}
}
diff --git a/services/arv-git-httpd/main.go b/services/arv-git-httpd/main.go
deleted file mode 100644
index b926ac273..000000000
--- a/services/arv-git-httpd/main.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-package main
-
-import (
- "flag"
- "fmt"
- "os"
-
- "git.arvados.org/arvados.git/lib/cmd"
- "git.arvados.org/arvados.git/lib/config"
- "github.com/coreos/go-systemd/daemon"
- "github.com/ghodss/yaml"
- log "github.com/sirupsen/logrus"
-)
-
-var version = "dev"
-
-func main() {
- logger := log.New()
- log.SetFormatter(&log.JSONFormatter{
- TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00",
- })
-
- flags := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
- loader := config.NewLoader(os.Stdin, logger)
- loader.SetupFlags(flags)
-
- dumpConfig := flags.Bool("dump-config", false, "write current configuration to stdout and exit (useful for migrating from command line flags to config file)")
- getVersion := flags.Bool("version", false, "print version information and exit.")
-
- args := loader.MungeLegacyConfigArgs(logger, os.Args[1:], "-legacy-git-httpd-config")
- if ok, code := cmd.ParseFlags(flags, os.Args[0], args, "", os.Stderr); !ok {
- os.Exit(code)
- } else if *getVersion {
- fmt.Printf("arv-git-httpd %s\n", version)
- return
- }
-
- cfg, err := loader.Load()
- if err != nil {
- log.Fatal(err)
- }
-
- cluster, err := cfg.GetCluster("")
- if err != nil {
- log.Fatal(err)
- }
-
- if *dumpConfig {
- out, err := yaml.Marshal(cfg)
- if err != nil {
- log.Fatal(err)
- }
- _, err = os.Stdout.Write(out)
- if err != nil {
- log.Fatal(err)
- }
- return
- }
-
- srv := &server{cluster: cluster}
- if err := srv.Start(); err != nil {
- log.Fatal(err)
- }
- if _, err := daemon.SdNotify(false, "READY=1"); err != nil {
- log.Printf("Error notifying init daemon: %v", err)
- }
- log.Printf("arv-git-httpd %s started", version)
- log.Println("Listening at", srv.Addr)
- log.Println("Repository root", cluster.Git.Repositories)
- if err := srv.Wait(); err != nil {
- log.Fatal(err)
- }
-}
diff --git a/services/arv-git-httpd/server.go b/services/arv-git-httpd/server.go
deleted file mode 100644
index 38a018ab3..000000000
--- a/services/arv-git-httpd/server.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-package main
-
-import (
- "net/http"
-
- "git.arvados.org/arvados.git/sdk/go/arvados"
- "git.arvados.org/arvados.git/sdk/go/health"
- "git.arvados.org/arvados.git/sdk/go/httpserver"
-)
-
-type server struct {
- httpserver.Server
- cluster *arvados.Cluster
-}
-
-func (srv *server) Start() error {
- mux := http.NewServeMux()
- mux.Handle("/", &authHandler{handler: newGitHandler(srv.cluster), cluster: srv.cluster})
- mux.Handle("/_health/", &health.Handler{
- Token: srv.cluster.ManagementToken,
- Prefix: "/_health/",
- })
-
- var listen arvados.URL
- for listen = range srv.cluster.Services.GitHTTP.InternalURLs {
- break
- }
-
- srv.Handler = mux
- srv.Addr = listen.Host
- return srv.Server.Start()
-}
diff --git a/services/arv-git-httpd/.gitignore b/services/githttpd/.gitignore
similarity index 100%
rename from services/arv-git-httpd/.gitignore
rename to services/githttpd/.gitignore
diff --git a/services/arv-git-httpd/auth_handler.go b/services/githttpd/auth_handler.go
similarity index 85%
rename from services/arv-git-httpd/auth_handler.go
rename to services/githttpd/auth_handler.go
index 13706ae3e..c6b23fd4c 100644
--- a/services/arv-git-httpd/auth_handler.go
+++ b/services/githttpd/auth_handler.go
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package githttpd
import (
"errors"
@@ -11,44 +11,33 @@ import (
"os"
"regexp"
"strings"
- "sync"
"time"
"git.arvados.org/arvados.git/sdk/go/arvados"
"git.arvados.org/arvados.git/sdk/go/arvadosclient"
"git.arvados.org/arvados.git/sdk/go/auth"
"git.arvados.org/arvados.git/sdk/go/httpserver"
+ "github.com/sirupsen/logrus"
)
type authHandler struct {
handler http.Handler
clientPool *arvadosclient.ClientPool
cluster *arvados.Cluster
- setupOnce sync.Once
}
-func (h *authHandler) setup() {
- client, err := arvados.NewClientFromConfig(h.cluster)
- if err != nil {
- log.Fatal(err)
- }
-
- ac, err := arvadosclient.New(client)
- if err != nil {
- log.Fatalf("Error setting up arvados client prototype %v", err)
- }
+func (h *authHandler) CheckHealth() error {
+ return nil
+}
- h.clientPool = &arvadosclient.ClientPool{Prototype: ac}
+func (h *authHandler) Done() <-chan struct{} {
+ return nil
}
func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
- h.setupOnce.Do(h.setup)
-
var statusCode int
var statusText string
var apiToken string
- var repoName string
- var validAPIToken bool
w := httpserver.WrapResponseWriter(wOrig)
@@ -84,19 +73,6 @@ func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
w.Write([]byte(statusText))
}
}
-
- // If the given password is a valid token, log the first 10 characters of the token.
- // Otherwise: log the string <invalid> if a password is given, else an empty string.
- passwordToLog := ""
- if !validAPIToken {
- if len(apiToken) > 0 {
- passwordToLog = "<invalid>"
- }
- } else {
- passwordToLog = apiToken[0:10]
- }
-
- httpserver.Log(r.RemoteAddr, passwordToLog, w.WroteStatus(), statusText, repoName, r.Method, r.URL.Path)
}()
creds := auth.CredentialsFromRequest(r)
@@ -115,8 +91,11 @@ func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
statusCode, statusText = http.StatusNotFound, "not found"
return
}
- repoName = pathParts[0]
+ repoName := pathParts[0]
repoName = strings.TrimRight(repoName, "/")
+ httpserver.SetResponseLogFields(r.Context(), logrus.Fields{
+ "repoName": repoName,
+ })
arv := h.clientPool.Get()
if arv == nil {
@@ -125,6 +104,21 @@ func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
}
defer h.clientPool.Put(arv)
+ // Log the UUID if the supplied token is a v2 token, otherwise
+ // just the last five characters.
+ httpserver.SetResponseLogFields(r.Context(), logrus.Fields{
+ "tokenUUID": func() string {
+ if strings.HasPrefix(apiToken, "v2/") && strings.IndexRune(apiToken[3:], '/') == 27 {
+ // UUID part of v2 token
+ return apiToken[3:30]
+ } else if len(apiToken) > 5 {
+ return "[...]" + apiToken[len(apiToken)-5:]
+ } else {
+ return apiToken
+ }
+ }(),
+ })
+
// Ask API server whether the repository is readable using
// this token (by trying to read it!)
arv.ApiToken = apiToken
@@ -133,7 +127,6 @@ func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
statusCode, statusText = http.StatusInternalServerError, err.Error()
return
}
- validAPIToken = true
if repoUUID == "" {
statusCode, statusText = http.StatusNotFound, "not found"
return
diff --git a/services/arv-git-httpd/auth_handler_test.go b/services/githttpd/auth_handler_test.go
similarity index 91%
rename from services/arv-git-httpd/auth_handler_test.go
rename to services/githttpd/auth_handler_test.go
index 688b256dc..2d1ec966a 100644
--- a/services/arv-git-httpd/auth_handler_test.go
+++ b/services/githttpd/auth_handler_test.go
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package githttpd
import (
"io"
@@ -15,6 +15,7 @@ import (
"git.arvados.org/arvados.git/lib/config"
"git.arvados.org/arvados.git/sdk/go/arvados"
+ "git.arvados.org/arvados.git/sdk/go/arvadosclient"
"git.arvados.org/arvados.git/sdk/go/arvadostest"
"git.arvados.org/arvados.git/sdk/go/ctxlog"
check "gopkg.in/check.v1"
@@ -43,10 +44,18 @@ func (s *AuthHandlerSuite) SetUpTest(c *check.C) {
}
func (s *AuthHandlerSuite) TestPermission(c *check.C) {
- h := &authHandler{handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- log.Printf("%v", r.URL)
- io.WriteString(w, r.URL.Path)
- }), cluster: s.cluster}
+ client, err := arvados.NewClientFromConfig(s.cluster)
+ c.Assert(err, check.IsNil)
+ ac, err := arvadosclient.New(client)
+ c.Assert(err, check.IsNil)
+ h := &authHandler{
+ cluster: s.cluster,
+ clientPool: &arvadosclient.ClientPool{Prototype: ac},
+ handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ log.Printf("%v", r.URL)
+ io.WriteString(w, r.URL.Path)
+ }),
+ }
baseURL, err := url.Parse("http://git.example/")
c.Assert(err, check.IsNil)
for _, trial := range []struct {
diff --git a/services/githttpd/cmd.go b/services/githttpd/cmd.go
new file mode 100644
index 000000000..e6ca3c074
--- /dev/null
+++ b/services/githttpd/cmd.go
@@ -0,0 +1,32 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package githttpd
+
+import (
+ "context"
+
+ "git.arvados.org/arvados.git/lib/service"
+ "git.arvados.org/arvados.git/sdk/go/arvados"
+ "git.arvados.org/arvados.git/sdk/go/arvadosclient"
+ "github.com/prometheus/client_golang/prometheus"
+)
+
+var Command = service.Command(arvados.ServiceNameGitHTTP, newHandler)
+
+func newHandler(ctx context.Context, cluster *arvados.Cluster, token string, reg *prometheus.Registry) service.Handler {
+ client, err := arvados.NewClientFromConfig(cluster)
+ if err != nil {
+ return service.ErrorHandler(ctx, cluster, err)
+ }
+ ac, err := arvadosclient.New(client)
+ if err != nil {
+ return service.ErrorHandler(ctx, cluster, err)
+ }
+ return &authHandler{
+ clientPool: &arvadosclient.ClientPool{Prototype: ac},
+ cluster: cluster,
+ handler: newGitHandler(ctx, cluster),
+ }
+}
diff --git a/services/arv-git-httpd/git_handler.go b/services/githttpd/git_handler.go
similarity index 82%
rename from services/arv-git-httpd/git_handler.go
rename to services/githttpd/git_handler.go
index bb1b1afc7..7c94294c0 100644
--- a/services/arv-git-httpd/git_handler.go
+++ b/services/githttpd/git_handler.go
@@ -2,16 +2,17 @@
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package githttpd
import (
- "log"
+ "context"
"net"
"net/http"
"net/http/cgi"
"os"
"git.arvados.org/arvados.git/sdk/go/arvados"
+ "git.arvados.org/arvados.git/sdk/go/ctxlog"
)
// gitHandler is an http.Handler that invokes git-http-backend (or
@@ -22,7 +23,7 @@ type gitHandler struct {
cgi.Handler
}
-func newGitHandler(cluster *arvados.Cluster) http.Handler {
+func newGitHandler(ctx context.Context, cluster *arvados.Cluster) http.Handler {
const glBypass = "GL_BYPASS_ACCESS_CHECKS"
const glHome = "GITOLITE_HTTP_HOME"
var env []string
@@ -34,7 +35,7 @@ func newGitHandler(cluster *arvados.Cluster) http.Handler {
path = path + ":" + cluster.Git.GitoliteHome + "/bin"
} else if home, bypass := os.Getenv(glHome), os.Getenv(glBypass); home != "" || bypass != "" {
env = append(env, glHome+"="+home, glBypass+"="+bypass)
- log.Printf("DEPRECATED: Passing through %s and %s environment variables. Use GitoliteHome configuration instead.", glHome, glBypass)
+ ctxlog.FromContext(ctx).Printf("DEPRECATED: Passing through %s and %s environment variables. Use GitoliteHome configuration instead.", glHome, glBypass)
}
var listen arvados.URL
@@ -59,7 +60,7 @@ func newGitHandler(cluster *arvados.Cluster) http.Handler {
func (h *gitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
remoteHost, remotePort, err := net.SplitHostPort(r.RemoteAddr)
if err != nil {
- log.Printf("Internal error: SplitHostPort(r.RemoteAddr==%q): %s", r.RemoteAddr, err)
+ ctxlog.FromContext(r.Context()).Errorf("Internal error: SplitHostPort(r.RemoteAddr==%q): %s", r.RemoteAddr, err)
w.WriteHeader(http.StatusInternalServerError)
return
}
diff --git a/services/arv-git-httpd/git_handler_test.go b/services/githttpd/git_handler_test.go
similarity index 94%
rename from services/arv-git-httpd/git_handler_test.go
rename to services/githttpd/git_handler_test.go
index dafe5d31d..ef2ee28e7 100644
--- a/services/arv-git-httpd/git_handler_test.go
+++ b/services/githttpd/git_handler_test.go
@@ -2,9 +2,10 @@
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package githttpd
import (
+ "context"
"net/http"
"net/http/httptest"
"net/url"
@@ -42,7 +43,7 @@ func (s *GitHandlerSuite) TestEnvVars(c *check.C) {
URL: u,
RemoteAddr: "[::1]:12345",
}
- h := newGitHandler(s.cluster)
+ h := newGitHandler(context.Background(), s.cluster)
h.(*gitHandler).Path = "/bin/sh"
h.(*gitHandler).Args = []string{"-c", "printf 'Content-Type: text/plain\r\n\r\n'; env"}
@@ -67,7 +68,7 @@ func (s *GitHandlerSuite) TestCGIErrorOnSplitHostPortError(c *check.C) {
URL: u,
RemoteAddr: "test.bad.address.missing.port",
}
- h := newGitHandler(s.cluster)
+ h := newGitHandler(context.Background(), s.cluster)
h.ServeHTTP(resp, req)
c.Check(resp.Code, check.Equals, http.StatusInternalServerError)
c.Check(resp.Body.String(), check.Equals, "")
diff --git a/services/arv-git-httpd/gitolite_test.go b/services/githttpd/gitolite_test.go
similarity index 99%
rename from services/arv-git-httpd/gitolite_test.go
rename to services/githttpd/gitolite_test.go
index cfedd88f1..44179c28b 100644
--- a/services/arv-git-httpd/gitolite_test.go
+++ b/services/githttpd/gitolite_test.go
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package githttpd
import (
"io/ioutil"
diff --git a/services/arv-git-httpd/integration_test.go b/services/githttpd/integration_test.go
similarity index 94%
rename from services/arv-git-httpd/integration_test.go
rename to services/githttpd/integration_test.go
index 93a46e224..e6eae3ccd 100644
--- a/services/arv-git-httpd/integration_test.go
+++ b/services/githttpd/integration_test.go
@@ -2,9 +2,10 @@
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package githttpd
import (
+ "context"
"errors"
"io/ioutil"
"os"
@@ -16,6 +17,7 @@ import (
"git.arvados.org/arvados.git/sdk/go/arvados"
"git.arvados.org/arvados.git/sdk/go/arvadostest"
"git.arvados.org/arvados.git/sdk/go/ctxlog"
+ "git.arvados.org/arvados.git/sdk/go/httpserver"
check "gopkg.in/check.v1"
)
@@ -29,7 +31,7 @@ func Test(t *testing.T) {
type IntegrationSuite struct {
tmpRepoRoot string
tmpWorkdir string
- testServer *server
+ testServer *httpserver.Server
cluster *arvados.Cluster
}
@@ -70,7 +72,8 @@ func (s *IntegrationSuite) SetUpTest(c *check.C) {
s.cluster.ManagementToken = arvadostest.ManagementToken
}
- s.testServer = &server{cluster: s.cluster}
+ s.testServer = &httpserver.Server{}
+ s.testServer.Handler = httpserver.LogRequests(newHandler(context.Background(), s.cluster, "", nil))
err = s.testServer.Start()
c.Assert(err, check.Equals, nil)
diff --git a/services/arv-git-httpd/server_test.go b/services/githttpd/server_test.go
similarity index 87%
rename from services/arv-git-httpd/server_test.go
rename to services/githttpd/server_test.go
index a92aa1fb8..02c13a311 100644
--- a/services/arv-git-httpd/server_test.go
+++ b/services/githttpd/server_test.go
@@ -2,16 +2,12 @@
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package githttpd
import (
- "net/http"
- "net/http/httptest"
"os"
"os/exec"
- "git.arvados.org/arvados.git/sdk/go/arvadostest"
-
check "gopkg.in/check.v1"
)
@@ -108,16 +104,3 @@ func (s *GitSuite) makeArvadosRepo(c *check.C) {
c.Log(string(msg))
c.Assert(err, check.Equals, nil)
}
-
-func (s *GitSuite) TestHealthCheckPing(c *check.C) {
- req, err := http.NewRequest("GET",
- "http://"+s.testServer.Addr+"/_health/ping",
- nil)
- c.Assert(err, check.Equals, nil)
- req.Header.Set("Authorization", "Bearer "+arvadostest.ManagementToken)
-
- resp := httptest.NewRecorder()
- s.testServer.Handler.ServeHTTP(resp, req)
- c.Check(resp.Code, check.Equals, 200)
- c.Check(resp.Body.String(), check.Matches, `{"health":"OK"}\n`)
-}
diff --git a/tools/arvbox/lib/arvbox/docker/service/arv-git-httpd/run-service b/tools/arvbox/lib/arvbox/docker/service/arv-git-httpd/run-service
index b369ff622..18245b9e5 100755
--- a/tools/arvbox/lib/arvbox/docker/service/arv-git-httpd/run-service
+++ b/tools/arvbox/lib/arvbox/docker/service/arv-git-httpd/run-service
@@ -9,16 +9,14 @@ set -ex -o pipefail
. /usr/local/lib/arvbox/common.sh
. /usr/local/lib/arvbox/go-setup.sh
-flock /var/lib/gopath/gopath.lock go install "git.arvados.org/arvados.git/services/arv-git-httpd"
-install $GOPATH/bin/arv-git-httpd /usr/local/bin
+(cd /usr/local/bin && ln -sf arvados-server arv-git-httpd)
if test "$1" = "--only-deps" ; then
exit
fi
-export ARVADOS_API_HOST=$localip:${services[controller-ssl]}
-export ARVADOS_API_HOST_INSECURE=1
+/usr/local/lib/arvbox/runsu.sh flock $ARVADOS_CONTAINER_PATH/cluster_config.yml.lock /usr/local/lib/arvbox/cluster-config.sh
+
export PATH="$PATH:$ARVADOS_CONTAINER_PATH/git/bin"
cd ~git
-
exec /usr/local/bin/arv-git-httpd
commit 74e3d513b7111cf4ad9e75928342cfd0ccbb9353
Author: Tom Clegg <tom at curii.com>
Date: Wed Apr 6 12:03:38 2022 -0400
18947: Remove separate keepproxy binary from lib/install steps.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/lib/install/deps.go b/lib/install/deps.go
index 483ce9c93..3070f8559 100644
--- a/lib/install/deps.go
+++ b/lib/install/deps.go
@@ -523,7 +523,6 @@ make -C ./builddir install
"services/health",
"services/keep-balance",
"services/keep-web",
- "services/keepproxy",
"services/keepstore",
"services/ws",
} {
commit 2522f72d1004b35bc5e06394f4bdd1d90c45a22b
Author: Tom Clegg <tom at curii.com>
Date: Tue Apr 5 18:39:15 2022 -0400
18947: Add keepproxy systemd unit file.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/cmd/arvados-server/keepproxy.service b/cmd/arvados-server/keepproxy.service
new file mode 100644
index 000000000..b5f1d2673
--- /dev/null
+++ b/cmd/arvados-server/keepproxy.service
@@ -0,0 +1,27 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+[Unit]
+Description=arvados keepproxy
+Documentation=https://doc.arvados.org/
+After=network.target
+AssertPathExists=/etc/arvados/config.yml
+
+# systemd>=230 (debian:9) obeys StartLimitIntervalSec in the [Unit] section
+StartLimitIntervalSec=0
+
+[Service]
+Type=notify
+EnvironmentFile=-/etc/arvados/environment
+ExecStart=/usr/bin/keepproxy
+# Set a reasonable default for the open file limit
+LimitNOFILE=65536
+Restart=always
+RestartSec=1
+
+# systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
+StartLimitInterval=0
+
+[Install]
+WantedBy=multi-user.target
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list