Commit b216db2e authored by Jacob Vosmaer's avatar Jacob Vosmaer

Rename to gitlab-workhorse

parent 01f29889
gitlab-git-http-server
test/data test/data
test/scratch test/scratch
gitlab-workhorse
# Changelog for gitlab-git-http-server # Changelog for gitlab-workhorse
Formerly known as 'gitlab-git-http-server'.
0.4.0
Rename the project to gitlab-workhorse. The old name had become too
specific.
0.3.1 0.3.1
......
PREFIX=/usr/local PREFIX=/usr/local
VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S) VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S)
gitlab-git-http-server: main.go githandler.go gitlab-workhorse: main.go githandler.go
go build -ldflags "-X main.Version ${VERSION}" -o gitlab-git-http-server go build -ldflags "-X main.Version ${VERSION}" -o gitlab-workhorse
install: gitlab-git-http-server install: gitlab-workhorse
install gitlab-git-http-server ${PREFIX}/bin/ install gitlab-workhorse ${PREFIX}/bin/
.PHONY: test .PHONY: test
test: test/data/test.git test: test/data/test.git
...@@ -19,5 +19,5 @@ test/data: ...@@ -19,5 +19,5 @@ test/data:
.PHONY: clean .PHONY: clean
clean: clean:
rm -f gitlab-git-http-server rm -f gitlab-workhorse
rm -rf test/data test/scratch rm -rf test/data test/scratch
# gitlab-git-http-server # gitlab-workhorse
gitlab-git-http-server was designed to unload Git HTTP traffic from gitlab-workhorse was designed to unload Git HTTP traffic from
the GitLab Rails app (Unicorn) to a separate daemon. It also serves the GitLab Rails app (Unicorn) to a separate daemon. It also serves
'git archive' downloads for GitLab. All authentication and 'git archive' downloads for GitLab. All authentication and
authorization logic is still handled by the GitLab Rails app. authorization logic is still handled by the GitLab Rails app.
Architecture: Git client -> NGINX -> gitlab-git-http-server (makes Architecture: Git client -> NGINX -> gitlab-workhorse (makes
auth request to GitLab Rails app) -> git-upload-pack auth request to GitLab Rails app) -> git-upload-pack
## Usage ## Usage
``` ```
gitlab-git-http-server [OPTIONS] gitlab-workhorse [OPTIONS]
Options: Options:
-authBackend string -authBackend string
...@@ -30,15 +30,15 @@ Options: ...@@ -30,15 +30,15 @@ Options:
Print version and exit Print version and exit
``` ```
gitlab-git-http-server allows Git HTTP clients to push and pull to gitlab-workhorse allows Git HTTP clients to push and pull to
and from Git repositories. Each incoming request is first replayed and from Git repositories. Each incoming request is first replayed
(with an empty request body) to an external authentication/authorization (with an empty request body) to an external authentication/authorization
HTTP server: the 'auth backend'. The auth backend is expected to HTTP server: the 'auth backend'. The auth backend is expected to
be a GitLab Unicorn process. The 'auth response' is a JSON message be a GitLab Unicorn process. The 'auth response' is a JSON message
which tells gitlab-git-http-server the path of the Git repository which tells gitlab-workhorse the path of the Git repository
to read from/write to. to read from/write to.
gitlab-git-http-server can listen on either a TCP or a Unix domain socket. It gitlab-workhorse can listen on either a TCP or a Unix domain socket. It
can also open a second listening TCP listening socket with the Go can also open a second listening TCP listening socket with the Go
[net/http/pprof profiler server](http://golang.org/pkg/net/http/pprof/). [net/http/pprof profiler server](http://golang.org/pkg/net/http/pprof/).
...@@ -70,9 +70,9 @@ You can try out the Git server without authentication as follows: ...@@ -70,9 +70,9 @@ You can try out the Git server without authentication as follows:
# Start a fake auth backend that allows everything/everybody # Start a fake auth backend that allows everything/everybody
make test/data/test.git make test/data/test.git
go run support/fake-auth-backend.go ~+/test/data/test.git & go run support/fake-auth-backend.go ~+/test/data/test.git &
# Start gitlab-git-http-server # Start gitlab-workhorse
make make
./gitlab-git-http-server ./gitlab-workhorse
``` ```
Now you can try things like: Now you can try things like:
...@@ -85,14 +85,14 @@ curl -JO http://localhost:8181/test/repository/archive.zip ...@@ -85,14 +85,14 @@ curl -JO http://localhost:8181/test/repository/archive.zip
## Example request flow ## Example request flow
- start POST repo.git/git-receive-pack to NGINX - start POST repo.git/git-receive-pack to NGINX
- ..start POST repo.git/git-receive-pack to gitlab-git-http-server - ..start POST repo.git/git-receive-pack to gitlab-workhorse
- ....start POST repo.git/git-receive-pack to Unicorn for auth - ....start POST repo.git/git-receive-pack to Unicorn for auth
- ....end POST to Unicorn for auth - ....end POST to Unicorn for auth
- ....start git-receive-pack process from gitlab-git-http-server - ....start git-receive-pack process from gitlab-workhorse
- ......start POST /api/v3/internal/allowed to Unicorn from Git hook (check protected branches) - ......start POST /api/v3/internal/allowed to Unicorn from Git hook (check protected branches)
- ......end POST to Unicorn from Git hook - ......end POST to Unicorn from Git hook
- ....end git-receive-pack process - ....end git-receive-pack process
- ..end POST to gitlab-git-http-server - ..end POST to gitlab-workhorse
- end POST to NGINX - end POST to NGINX
## License ## License
......
...@@ -51,7 +51,7 @@ type gitRequest struct { ...@@ -51,7 +51,7 @@ type gitRequest struct {
// subdirectory // subdirectory
ArchivePrefix string ArchivePrefix string
// CommitId is used do prevent race conditions between the 'time of check' // CommitId is used do prevent race conditions between the 'time of check'
// in the GitLab Rails app and the 'time of use' in gitlab-git-http-server. // in the GitLab Rails app and the 'time of use' in gitlab-workhorse.
CommitId string CommitId string
} }
...@@ -165,7 +165,7 @@ func (h *gitHandler) doAuthRequest(r *http.Request) (result *http.Response, err ...@@ -165,7 +165,7 @@ func (h *gitHandler) doAuthRequest(r *http.Request) (result *http.Response, err
} }
// Also forward the Host header, which is excluded from the Header map by the http libary. // Also forward the Host header, which is excluded from the Header map by the http libary.
// This allows the Host header received by the backend to be consistent with other // This allows the Host header received by the backend to be consistent with other
// requests not going through gitlab-git-http-server. // requests not going through gitlab-workhorse.
authReq.Host = r.Host authReq.Host = r.Host
// Set a custom header for the request. This can be used in some // Set a custom header for the request. This can be used in some
// configurations (Passenger) to solve auth request routing problems. // configurations (Passenger) to solve auth request routing problems.
......
/* /*
gitlab-git-http-server handles 'smart' Git HTTP requests for GitLab gitlab-workhorse handles 'smart' Git HTTP requests for GitLab
This HTTP server can service 'git clone', 'git push' etc. commands This HTTP server can service 'git clone', 'git push' etc. commands
from Git clients that use the 'smart' Git HTTP protocol (git-upload-pack from Git clients that use the 'smart' Git HTTP protocol (git-upload-pack
...@@ -43,7 +43,7 @@ func main() { ...@@ -43,7 +43,7 @@ func main() {
} }
flag.Parse() flag.Parse()
version := fmt.Sprintf("gitlab-git-http-server %s", Version) version := fmt.Sprintf("gitlab-workhorse %s", Version)
if *printVersion { if *printVersion {
fmt.Println(version) fmt.Println(version)
os.Exit(0) os.Exit(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment