[ARVADOS] updated: 20a717071130eee4afb4704617c51ff165d735d9

Git user git at public.curoverse.com
Thu Oct 13 13:37:31 EDT 2016


Summary of changes:

  discards  872b95a8158fd05a73325c15f81918a3b798535f (commit)
  discards  4c77384f1e639ee44c6c4011d8b07c711716d4d6 (commit)
       via  20a717071130eee4afb4704617c51ff165d735d9 (commit)
       via  51eaad58e0a135bdf88d4bdcd819d219d75de0df (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 (872b95a8158fd05a73325c15f81918a3b798535f)
            \
             N -- N -- N (20a717071130eee4afb4704617c51ff165d735d9)

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 20a717071130eee4afb4704617c51ff165d735d9
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Oct 13 12:31:02 2016 -0400

    10234: 10263: Update arvados-git-httpd docs to use systemd + config file.

diff --git a/doc/install/install-arv-git-httpd.html.textile.liquid b/doc/install/install-arv-git-httpd.html.textile.liquid
index 3ec2382..b28674d 100644
--- a/doc/install/install-arv-git-httpd.html.textile.liquid
+++ b/doc/install/install-arv-git-httpd.html.textile.liquid
@@ -232,6 +232,7 @@ On Red Hat-based systems:
 
 <notextile>
 <pre><code>~$ <span class="userinput">sudo yum install git arvados-git-httpd</span>
+~$ <span class="userinput">sudo systemctl enable arvados-git-httpd</span>
 </code></pre>
 </notextile>
 
@@ -254,43 +255,29 @@ fatal: No REQUEST_METHOD from server
 
 h3. Enable arvados-git-httpd
 
-Install runit to supervise the arvados-git-httpd daemon.  {% include 'install_runit' %}
+{% include 'notebox_begin' %}
+
+The arvados-git-httpd package includes configuration files for systemd.  If you're using a different init system, you'll need to configure a service to start and stop an @arvados-git-httpd@ process as desired.
+
+{% include 'notebox_end' %}
 
-Configure runit to run arvados-git-httpd, making sure to update the API host to match your site:
+Create the configuration file @/etc/arvados/git-httpd/git-httpd.yml at . Run @arvados-git-httpd -h@ to learn more about configuration entries.
 
 <notextile>
-<pre><code>~$ <span class="userinput">sudo mkdir -p /etc/sv</span>
-~$ <span class="userinput">cd /etc/sv</span>
-/etc/sv$ <span class="userinput">sudo mkdir arvados-git-httpd; cd arvados-git-httpd</span>
-/etc/sv/arvados-git-httpd$ <span class="userinput">sudo mkdir log</span>
-/etc/sv/arvados-git-httpd$ <span class="userinput">sudo sh -c 'cat >log/run' <<'EOF'
-#!/bin/sh
-mkdir -p main
-chown git:git main
-exec chpst -u git:git svlogd -tt main
-EOF</span>
-/etc/sv/arvados-git-httpd$ <span class="userinput">sudo sh -c 'cat >run' <<'EOF'
-#!/bin/sh
-export ARVADOS_API_HOST=<b>uuid_prefix.your.domain</b>
-export GITOLITE_HTTP_HOME=/var/lib/arvados/git
-export GL_BYPASS_ACCESS_CHECKS=1
-export PATH="$PATH:/var/lib/arvados/git/bin"
-exec chpst -u git:git arvados-git-httpd -address=:9001 -git-command=/var/lib/arvados/git/gitolite/src/gitolite-shell -repo-root=<b>/var/lib/arvados/git</b>/repositories 2>&1
-EOF</span>
-/etc/sv/arvados-git-httpd$ <span class="userinput">sudo chmod +x run log/run</span>
-/etc/sv/arvados-git-httpd$ <span class="userinput">sudo ln -s "$(pwd)" /etc/service/</span>
+<pre><code>Client:
+  APIHost: <b>uuid_prefix.your.domain</b>
+  Insecure: false
+GitCommand: /var/lib/arvados/git/gitolite/src/gitolite-shell
+GitoliteHome: /var/lib/arvados/git
+Listen: :9001
+RepoRoot: /var/lib/arvados/git/repositories
 </code></pre>
 </notextile>
 
-If you are using a different daemon supervisor, or if you want to test the daemon in a terminal window, an equivalent shell command to run arvados-git-httpd is:
+Restart the systemd service to ensure the new configuration is used.
 
 <notextile>
-<pre><code>sudo -u git \
-  ARVADOS_API_HOST=<span class="userinput">uuid_prefix.your.domain</span> \
-  GITOLITE_HTTP_HOME=/var/lib/arvados/git \
-  GL_BYPASS_ACCESS_CHECKS=1 \
-  PATH="$PATH:/var/lib/arvados/git/bin" \
-  arvados-git-httpd -address=:9001 -git-command=/var/lib/arvados/git/gitolite/src/gitolite-shell -repo-root=/var/lib/arvados/git/repositories 2>&1
+<pre><code>~$ <span class="userinput">sudo systemctl restart arvados-git-httpd</span>
 </code></pre>
 </notextile>
 

commit 51eaad58e0a135bdf88d4bdcd819d219d75de0df
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Oct 13 11:02:18 2016 -0400

    10234: 10263: Use a GitoliteHome configuration entry instead of passing through gitolite env vars from the caller.

diff --git a/services/arv-git-httpd/git_handler.go b/services/arv-git-httpd/git_handler.go
index f0b98fa..f8e38e9 100644
--- a/services/arv-git-httpd/git_handler.go
+++ b/services/arv-git-httpd/git_handler.go
@@ -5,6 +5,7 @@ import (
 	"net"
 	"net/http"
 	"net/http/cgi"
+	"os"
 )
 
 // gitHandler is an http.Handler that invokes git-http-backend (or
@@ -16,21 +17,24 @@ type gitHandler struct {
 }
 
 func newGitHandler() http.Handler {
+	var env []string
+	path := os.Getenv("PATH")
+	if theConfig.GitoliteHome != "" {
+		env = append(env,
+			"GITOLITE_HTTP_HOME="+theConfig.GitoliteHome,
+			"GL_BYPASS_ACCESS_CHECKS=1")
+		path = path + ":" + theConfig.GitoliteHome + "/bin"
+	}
+	env = append(env,
+		"GIT_PROJECT_ROOT="+theConfig.RepoRoot,
+		"GIT_HTTP_EXPORT_ALL=",
+		"SERVER_ADDR="+theConfig.Listen,
+		"PATH="+path)
 	return &gitHandler{
 		Handler: cgi.Handler{
 			Path: theConfig.GitCommand,
 			Dir:  theConfig.RepoRoot,
-			Env: []string{
-				"GIT_PROJECT_ROOT=" + theConfig.RepoRoot,
-				"GIT_HTTP_EXPORT_ALL=",
-				"SERVER_ADDR=" + theConfig.Listen,
-			},
-			InheritEnv: []string{
-				"PATH",
-				// Needed if GitCommand is gitolite-shell:
-				"GITOLITE_HTTP_HOME",
-				"GL_BYPASS_ACCESS_CHECKS",
-			},
+			Env:  env,
 			Args: []string{"http-backend"},
 		},
 	}
diff --git a/services/arv-git-httpd/git_handler_test.go b/services/arv-git-httpd/git_handler_test.go
index 964810d..6b08eee 100644
--- a/services/arv-git-httpd/git_handler_test.go
+++ b/services/arv-git-httpd/git_handler_test.go
@@ -4,7 +4,6 @@ import (
 	"net/http"
 	"net/http/httptest"
 	"net/url"
-	"os"
 	"regexp"
 
 	check "gopkg.in/check.v1"
@@ -17,6 +16,7 @@ type GitHandlerSuite struct{}
 func (s *GitHandlerSuite) TestEnvVars(c *check.C) {
 	theConfig = defaultConfig()
 	theConfig.RepoRoot = "/"
+	theConfig.GitoliteHome = "/test/ghh"
 
 	u, err := url.Parse("git.zzzzz.arvadosapi.com/test")
 	c.Check(err, check.Equals, nil)
@@ -29,15 +29,14 @@ func (s *GitHandlerSuite) TestEnvVars(c *check.C) {
 	h := newGitHandler()
 	h.(*gitHandler).Path = "/bin/sh"
 	h.(*gitHandler).Args = []string{"-c", "printf 'Content-Type: text/plain\r\n\r\n'; env"}
-	os.Setenv("GITOLITE_HTTP_HOME", "/test/ghh")
-	os.Setenv("GL_BYPASS_ACCESS_CHECKS", "yesplease")
 
 	h.ServeHTTP(resp, req)
 
 	c.Check(resp.Code, check.Equals, http.StatusOK)
 	body := resp.Body.String()
+	c.Check(body, check.Matches, `(?ms).*^PATH=.*:/test/ghh/bin$.*`)
 	c.Check(body, check.Matches, `(?ms).*^GITOLITE_HTTP_HOME=/test/ghh$.*`)
-	c.Check(body, check.Matches, `(?ms).*^GL_BYPASS_ACCESS_CHECKS=yesplease$.*`)
+	c.Check(body, check.Matches, `(?ms).*^GL_BYPASS_ACCESS_CHECKS=1$.*`)
 	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.Listen)+`$.*`)
diff --git a/services/arv-git-httpd/gitolite_test.go b/services/arv-git-httpd/gitolite_test.go
index 74c2b8c..38ff230 100644
--- a/services/arv-git-httpd/gitolite_test.go
+++ b/services/arv-git-httpd/gitolite_test.go
@@ -48,9 +48,10 @@ func (s *GitoliteSuite) SetUpTest(c *check.C) {
 			APIHost:  arvadostest.APIHost(),
 			Insecure: true,
 		},
-		Listen:     ":0",
-		GitCommand: "/usr/share/gitolite3/gitolite-shell",
-		RepoRoot:   s.tmpRepoRoot,
+		Listen:       ":0",
+		GitCommand:   "/usr/share/gitolite3/gitolite-shell",
+		GitoliteHome: s.gitoliteHome,
+		RepoRoot:     s.tmpRepoRoot,
 	}
 	s.IntegrationSuite.SetUpTest(c)
 
@@ -58,9 +59,6 @@ func (s *GitoliteSuite) SetUpTest(c *check.C) {
 	// (*IntegrationTest)SetUpTest() -- see 2.2.4 at
 	// http://gitolite.com/gitolite/gitolite.html
 	runGitolite("gitolite", "setup")
-
-	os.Setenv("GITOLITE_HTTP_HOME", s.gitoliteHome)
-	os.Setenv("GL_BYPASS_ACCESS_CHECKS", "1")
 }
 
 func (s *GitoliteSuite) TearDownTest(c *check.C) {
diff --git a/services/arv-git-httpd/integration_test.go b/services/arv-git-httpd/integration_test.go
index 5e55eca..1d25259 100644
--- a/services/arv-git-httpd/integration_test.go
+++ b/services/arv-git-httpd/integration_test.go
@@ -112,6 +112,8 @@ func (s *IntegrationSuite) TearDownTest(c *check.C) {
 	s.tmpWorkdir = ""
 
 	s.Config = nil
+
+	theConfig = defaultConfig()
 }
 
 func (s *IntegrationSuite) RunGit(c *check.C, token, gitCmd, repo string, args ...string) error {
diff --git a/services/arv-git-httpd/main.go b/services/arv-git-httpd/main.go
index dacfec5..3bd7b3a 100644
--- a/services/arv-git-httpd/main.go
+++ b/services/arv-git-httpd/main.go
@@ -14,10 +14,11 @@ import (
 
 // Server configuration
 type Config struct {
-	Client     arvados.Client
-	Listen     string
-	GitCommand string
-	RepoRoot   string
+	Client       arvados.Client
+	Listen       string
+	GitCommand   string
+	RepoRoot     string
+	GitoliteHome string
 }
 
 var theConfig = defaultConfig()
@@ -39,6 +40,8 @@ func main() {
 		"Path to git or gitolite-shell executable. Each authenticated request will execute this program with a single argument, \"http-backend\"."+deprecated)
 	flag.StringVar(&theConfig.RepoRoot, "repo-root", theConfig.RepoRoot,
 		"Path to git repositories."+deprecated)
+	flag.StringVar(&theConfig.GitoliteHome, "gitolite-home", theConfig.GitoliteHome,
+		"Value for GITOLITE_HTTP_HOME environment variable. If not empty, GL_BYPASS_ACCESS_CHECKS=1 will also be set."+deprecated)
 
 	cfgPath := flag.String("config", defaultCfgPath, "Configuration file `path`.")
 	flag.Usage = usage
diff --git a/services/arv-git-httpd/usage.go b/services/arv-git-httpd/usage.go
index e355936..4eba36a 100644
--- a/services/arv-git-httpd/usage.go
+++ b/services/arv-git-httpd/usage.go
@@ -51,6 +51,14 @@ GitCommand:
     request will execute this program with the single argument
     "http-backend".
 
+GitoliteHome:
+
+    Path to Gitolite's home directory. If a non-empty path is given,
+    the CGI environment will be set up to support the use of
+    gitolite-shell as a GitCommand: for example, if GitoliteHome is
+    "/gh", then the CGI environment will have GITOLITE_HTTP_HOME=/gh,
+    PATH=$PATH:/gh/bin, and GL_BYPASS_ACCESS_CHECKS=1.
+
 Listen:
 
     Local port to listen on. Can be "address:port" or ":port", where
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 518fe33..b6caa14 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
@@ -20,12 +20,11 @@ fi
 
 export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
-export GITOLITE_HTTP_HOME=/var/lib/arvados/git
-export GL_BYPASS_ACCESS_CHECKS=1
 export PATH="$PATH:/var/lib/arvados/git/bin"
 cd ~git
 
 exec /usr/local/bin/arv-git-httpd \
-     -address=:${services[arv-git-httpd]} \
-     -git-command=/usr/share/gitolite3/gitolite-shell \
-     -repo-root=/var/lib/arvados/git/repositories
+    -address=:${services[arv-git-httpd]} \
+    -git-command=/usr/share/gitolite3/gitolite-shell \
+    -gitolite-home=/var/lib/arvados/git \
+    -repo-root=/var/lib/arvados/git/repositories

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list