Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
b216db2e
Commit
b216db2e
authored
Oct 26, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename to gitlab-workhorse
parent
01f29889
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
23 deletions
+30
-23
.gitignore
.gitignore
+1
-1
CHANGELOG
CHANGELOG
+8
-1
Makefile
Makefile
+5
-5
README.md
README.md
+12
-12
githandler.go
githandler.go
+2
-2
main.go
main.go
+2
-2
No files found.
.gitignore
View file @
b216db2e
gitlab-git-http-server
test/data
test/data
test/scratch
test/scratch
gitlab-workhorse
CHANGELOG
View file @
b216db2e
# 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
...
...
Makefile
View file @
b216db2e
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
README.md
View file @
b216db2e
# 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
...
...
githandler.go
View file @
b216db2e
...
@@ -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.
...
...
main.go
View file @
b216db2e
/*
/*
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment