[ARVADOS] updated: 7ae8a85e20ae45d3a3a4721e86bed5249902400c

Git user git at public.curoverse.com
Tue Sep 20 22:40:22 EDT 2016


Summary of changes:
 build/run-build-packages.sh       |  2 +-
 sdk/cwl/arvados_cwl/pathmapper.py |  2 ++
 sdk/cwl/arvados_cwl/runner.py     | 37 ++++++++++++++++++++++++++++++++-----
 sdk/cwl/setup.py                  |  2 +-
 4 files changed, 36 insertions(+), 7 deletions(-)

  discards  2dec430e80dee042f985e151e3e5870dd1dae82b (commit)
  discards  766ee8c620a6c1d8b79d9ca1e5443feb4c16c4d0 (commit)
  discards  f999e514b1857e70237926ffb40a1a748ed80094 (commit)
  discards  d2f271055e24811d003f576577ae0027ca3ff9ff (commit)
  discards  c7729f29fe043e4f962cee5d81d34d8fa0882d4b (commit)
  discards  38d82289609f6e96a51b815101dfb125caf77edf (commit)
  discards  1d5e807e2170bc5a6fbc12c0a9febdb4db139806 (commit)
  discards  6d57db9c7e2d1cfe391834a7f63318e53d7d07d6 (commit)
  discards  208022fe681714471fb068a22b83576bf06980c4 (commit)
  discards  2ff1566d5cc6517dcd888f2175ddf6547891d207 (commit)
  discards  caba74a47f9819c6c214729f09aa9925926ca7c3 (commit)
       via  7ae8a85e20ae45d3a3a4721e86bed5249902400c (commit)
       via  de1b66094d5a477a444246ba03a5f51e0b7f6da0 (commit)
       via  3399e630e78d09fa553a7d0876e2cddb4e154472 (commit)
       via  30140496ddefee85305437ba4826c7e2fae0ecb2 (commit)
       via  2b9be1ee00a28fa03c19dbc53d3c4fed45e65a33 (commit)
       via  87fcb4c388573967b0dedf6a23557fcf9888d998 (commit)
       via  6802d84dd40245f2c605364dcd6d42849c409324 (commit)
       via  dcf24627def74e4357619b8128336c01783cafdf (commit)
       via  511e36db2a5ed0380752d15e9c60364483d0e9f0 (commit)
       via  b810854ddeccc8fff3ac718e8085a4cafb7f6b86 (commit)
       via  d63f3ade27bb506da049164789679f9fed171005 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (2dec430e80dee042f985e151e3e5870dd1dae82b)
            \
             N -- N -- N (7ae8a85e20ae45d3a3a4721e86bed5249902400c)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7ae8a85e20ae45d3a3a4721e86bed5249902400c
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 20 21:28:00 2016 -0400

    9950: Add systemd unit file arv-git-httpd.service.

diff --git a/services/arv-git-httpd/arv-git-httpd.service b/services/arv-git-httpd/arv-git-httpd.service
new file mode 100644
index 0000000..1182a0e
--- /dev/null
+++ b/services/arv-git-httpd/arv-git-httpd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Arvados git server
+Documentation=https://doc.arvados.org/
+After=network.target
+
+[Service]
+Type=notify
+ExecStart=/usr/bin/arv-git-httpd
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/services/arv-git-httpd/main.go b/services/arv-git-httpd/main.go
index 3dc8c6f..72d84fe 100644
--- a/services/arv-git-httpd/main.go
+++ b/services/arv-git-httpd/main.go
@@ -7,6 +7,7 @@ import (
 
 	"git.curoverse.com/arvados.git/sdk/go/arvados"
 	"git.curoverse.com/arvados.git/sdk/go/config"
+	"github.com/coreos/go-systemd/daemon"
 )
 
 // Server configuration
@@ -69,6 +70,9 @@ func main() {
 	if err := srv.Start(); err != nil {
 		log.Fatal(err)
 	}
+	if _, err := daemon.SdNotify("READY=1"); err != nil {
+		log.Printf("Error notifying init daemon: %v", err)
+	}
 	log.Println("Listening at", srv.Addr)
 	log.Println("Repository root", theConfig.Root)
 	if err := srv.Wait(); err != nil {

commit de1b66094d5a477a444246ba03a5f51e0b7f6da0
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 20 21:27:32 2016 -0400

    9950: Load config from /etc/arvados/arv-git-httpd/config.json.

diff --git a/services/arv-git-httpd/auth_handler.go b/services/arv-git-httpd/auth_handler.go
index fccb0c9..6ba0f38 100644
--- a/services/arv-git-httpd/auth_handler.go
+++ b/services/arv-git-httpd/auth_handler.go
@@ -5,6 +5,7 @@ import (
 	"net/http"
 	"os"
 	"strings"
+	"sync"
 	"time"
 
 	"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
@@ -12,13 +13,20 @@ import (
 	"git.curoverse.com/arvados.git/sdk/go/httpserver"
 )
 
-var clientPool = arvadosclient.MakeClientPool()
-
 type authHandler struct {
-	handler http.Handler
+	handler    http.Handler
+	clientPool *arvadosclient.ClientPool
+	setupOnce  sync.Once
+}
+
+func (h *authHandler) setup() {
+	os.Setenv("ARVADOS_API_HOST", theConfig.Client.APIHost)
+	h.clientPool = arvadosclient.MakeClientPool()
 }
 
 func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
+	h.setupOnce.Do(h.setup)
+
 	var statusCode int
 	var statusText string
 	var apiToken string
@@ -68,12 +76,12 @@ func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
 	repoName = pathParts[0]
 	repoName = strings.TrimRight(repoName, "/")
 
-	arv := clientPool.Get()
+	arv := h.clientPool.Get()
 	if arv == nil {
-		statusCode, statusText = http.StatusInternalServerError, "connection pool failed: "+clientPool.Err().Error()
+		statusCode, statusText = http.StatusInternalServerError, "connection pool failed: "+h.clientPool.Err().Error()
 		return
 	}
-	defer clientPool.Put(arv)
+	defer h.clientPool.Put(arv)
 
 	// Ask API server whether the repository is readable using
 	// this token (by trying to read it!)
diff --git a/services/arv-git-httpd/git_handler.go b/services/arv-git-httpd/git_handler.go
index 0312b29..f4baa72 100644
--- a/services/arv-git-httpd/git_handler.go
+++ b/services/arv-git-httpd/git_handler.go
@@ -23,7 +23,7 @@ func newGitHandler() http.Handler {
 			Env: []string{
 				"GIT_PROJECT_ROOT=" + theConfig.Root,
 				"GIT_HTTP_EXPORT_ALL=",
-				"SERVER_ADDR=" + theConfig.Addr,
+				"SERVER_ADDR=" + theConfig.Listen,
 			},
 			InheritEnv: []string{
 				"PATH",
diff --git a/services/arv-git-httpd/git_handler_test.go b/services/arv-git-httpd/git_handler_test.go
index 35c2f48..d87162d 100644
--- a/services/arv-git-httpd/git_handler_test.go
+++ b/services/arv-git-httpd/git_handler_test.go
@@ -37,7 +37,7 @@ func (s *GitHandlerSuite) TestEnvVars(c *check.C) {
 	c.Check(body, check.Matches, `(?ms).*^GL_BYPASS_ACCESS_CHECKS=yesplease$.*`)
 	c.Check(body, check.Matches, `(?ms).*^REMOTE_HOST=::1$.*`)
 	c.Check(body, check.Matches, `(?ms).*^REMOTE_PORT=12345$.*`)
-	c.Check(body, check.Matches, `(?ms).*^SERVER_ADDR=`+regexp.QuoteMeta(theConfig.Addr)+`$.*`)
+	c.Check(body, check.Matches, `(?ms).*^SERVER_ADDR=`+regexp.QuoteMeta(theConfig.Listen)+`$.*`)
 }
 
 func (s *GitHandlerSuite) TestCGIErrorOnSplitHostPortError(c *check.C) {
diff --git a/services/arv-git-httpd/gitolite_test.go b/services/arv-git-httpd/gitolite_test.go
index 20bdae7..96d9d24 100644
--- a/services/arv-git-httpd/gitolite_test.go
+++ b/services/arv-git-httpd/gitolite_test.go
@@ -6,6 +6,7 @@ import (
 	"os/exec"
 	"strings"
 
+	"git.curoverse.com/arvados.git/sdk/go/arvados"
 	check "gopkg.in/check.v1"
 )
 
@@ -41,8 +42,11 @@ func (s *GitoliteSuite) SetUpTest(c *check.C) {
 	runGitolite("gitolite", "setup", "--admin", "root")
 
 	s.tmpRepoRoot = s.gitoliteHome + "/repositories"
-	s.Config = &config{
-		Addr:       ":0",
+	s.Config = &Config{
+		Client: arvados.Client{
+			APIHost: os.Getenv("ARVADOS_API_HOST"),
+		},
+		Listen:     ":0",
 		GitCommand: "/usr/share/gitolite3/gitolite-shell",
 		Root:       s.tmpRepoRoot,
 	}
@@ -62,6 +66,10 @@ func (s *GitoliteSuite) TearDownTest(c *check.C) {
 	// upgrade to Go 1.4.
 	os.Setenv("GITOLITE_HTTP_HOME", "")
 	os.Setenv("GL_BYPASS_ACCESS_CHECKS", "")
+	if s.gitoliteHome != "" {
+		err := os.RemoveAll(s.gitoliteHome)
+		c.Check(err, check.Equals, nil)
+	}
 	s.IntegrationSuite.TearDownTest(c)
 }
 
diff --git a/services/arv-git-httpd/integration_test.go b/services/arv-git-httpd/integration_test.go
index 61d83ff..a548d6d 100644
--- a/services/arv-git-httpd/integration_test.go
+++ b/services/arv-git-httpd/integration_test.go
@@ -8,6 +8,7 @@ import (
 	"strings"
 	"testing"
 
+	"git.curoverse.com/arvados.git/sdk/go/arvados"
 	"git.curoverse.com/arvados.git/sdk/go/arvadostest"
 	check "gopkg.in/check.v1"
 )
@@ -23,7 +24,7 @@ type IntegrationSuite struct {
 	tmpRepoRoot string
 	tmpWorkdir  string
 	testServer  *server
-	Config      *config
+	Config      *Config
 }
 
 func (s *IntegrationSuite) SetUpSuite(c *check.C) {
@@ -67,8 +68,11 @@ func (s *IntegrationSuite) SetUpTest(c *check.C) {
 	c.Assert(err, check.Equals, nil)
 
 	if s.Config == nil {
-		s.Config = &config{
-			Addr:       ":0",
+		s.Config = &Config{
+			Client: arvados.Client{
+				APIHost: os.Getenv("ARVADOS_API_HOST"),
+			},
+			Listen:     ":0",
 			GitCommand: "/usr/bin/git",
 			Root:       s.tmpRepoRoot,
 		}
diff --git a/services/arv-git-httpd/main.go b/services/arv-git-httpd/main.go
index 98695c9..3dc8c6f 100644
--- a/services/arv-git-httpd/main.go
+++ b/services/arv-git-httpd/main.go
@@ -4,28 +4,56 @@ import (
 	"flag"
 	"log"
 	"os"
+
+	"git.curoverse.com/arvados.git/sdk/go/arvados"
+	"git.curoverse.com/arvados.git/sdk/go/config"
 )
 
-type config struct {
-	Addr       string
+// Server configuration
+type Config struct {
+	Client     arvados.Client
+	Listen     string
 	GitCommand string
 	Root       string
 }
 
-var theConfig *config
+var theConfig = defaultConfig()
 
-func init() {
-	theConfig = &config{}
-	flag.StringVar(&theConfig.Addr, "address", "0.0.0.0:80",
-		"Address to listen on, \"host:port\".")
-	flag.StringVar(&theConfig.GitCommand, "git-command", "/usr/bin/git",
-		"Path to git or gitolite-shell executable. Each authenticated request will execute this program with a single argument, \"http-backend\".")
+func defaultConfig() *Config {
 	cwd, err := os.Getwd()
 	if err != nil {
 		log.Fatalln("Getwd():", err)
 	}
-	flag.StringVar(&theConfig.Root, "repo-root", cwd,
-		"Path to git repositories.")
+	return &Config{
+		Listen:     ":80",
+		GitCommand: "/usr/bin/git",
+		Root:       cwd,
+	}
+}
+
+func init() {
+	deprecated := " (DEPRECATED -- use config file instead)"
+	flag.StringVar(&theConfig.Listen, "address", theConfig.Listen,
+		"Address to listen on, \"host:port\" or \":port\"."+deprecated)
+	flag.StringVar(&theConfig.GitCommand, "git-command", theConfig.GitCommand,
+		"Path to git or gitolite-shell executable. Each authenticated request will execute this program with a single argument, \"http-backend\"."+deprecated)
+	flag.StringVar(&theConfig.Root, "repo-root", theConfig.Root,
+		"Path to git repositories."+deprecated)
+
+	cfgPath := flag.String("config", "/etc/arvados/arv-git-httpd/config.json",
+		"Configuration file `path`.")
+	flag.Usage = usage
+	flag.Parse()
+
+	err := config.LoadFile(theConfig, *cfgPath)
+	if err != nil {
+		if h := os.Getenv("ARVADOS_API_HOST"); h != "" && os.IsNotExist(err) {
+			log.Print("DEPRECATED: No config file found, but ARVADOS_API_HOST environment variable is set. Please use a config file instead.")
+			theConfig.Client.APIHost = h
+		} else {
+			log.Fatal(err)
+		}
+	}
 
 	// MakeArvadosClient returns an error if token is unset (even
 	// though we don't need to do anything requiring
@@ -37,7 +65,6 @@ func init() {
 }
 
 func main() {
-	flag.Parse()
 	srv := &server{}
 	if err := srv.Start(); err != nil {
 		log.Fatal(err)
diff --git a/services/arv-git-httpd/server.go b/services/arv-git-httpd/server.go
index 40e77a8..e2311d2 100644
--- a/services/arv-git-httpd/server.go
+++ b/services/arv-git-httpd/server.go
@@ -12,8 +12,8 @@ type server struct {
 
 func (srv *server) Start() error {
 	mux := http.NewServeMux()
-	mux.Handle("/", &authHandler{newGitHandler()})
+	mux.Handle("/", &authHandler{handler: newGitHandler()})
 	srv.Handler = mux
-	srv.Addr = theConfig.Addr
+	srv.Addr = theConfig.Listen
 	return srv.Server.Start()
 }
diff --git a/services/arv-git-httpd/usage.go b/services/arv-git-httpd/usage.go
new file mode 100644
index 0000000..649fb10
--- /dev/null
+++ b/services/arv-git-httpd/usage.go
@@ -0,0 +1,62 @@
+package main
+
+import (
+	"encoding/json"
+	"flag"
+	"fmt"
+	"os"
+)
+
+func usage() {
+	c := defaultConfig()
+	c.Client.APIHost = "zzzzz.arvadosapi.com:443"
+	exampleConfigFile, err := json.MarshalIndent(c, "    ", "  ")
+	if err != nil {
+		panic(err)
+	}
+	fmt.Fprintf(os.Stderr, `
+
+arv-git-httpd provides authenticated access to Arvados-hosted git repositories.
+
+See http://doc.arvados.org/install/install-arv-git-httpd.html.
+
+Usage: arv-git-httpd [-config path/to/config.json]
+
+Options:
+`)
+	flag.PrintDefaults()
+	fmt.Fprintf(os.Stderr, `
+Example config file:
+    %s
+
+Client.APIHost:
+
+    Address (or address:port) of the Arvados API endpoint.
+
+Client.AuthToken:
+
+    Unused. Normally empty, or omitted entirely.
+
+Client.Insecure:
+
+    True if your Arvados API endpoint uses an unverifiable SSL/TLS
+    certificate.
+
+Listen:
+
+    Local port to listen on. Can be "address:port" or ":port", where
+    "address" is a host IP address or name and "port" is a port number
+    or name.
+
+GitCommand:
+
+    Path to git or gitolite-shell executable. Each authenticated
+    request will execute this program with the single argument
+    "http-backend".
+
+Root:
+
+    Path to git repositories. Defaults to current working directory.
+
+`, exampleConfigFile)
+}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list