Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
容器镜像库
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
b216db2e
提交
b216db2e
编辑于
9 years ago
作者:
Jacob Vosmaer
浏览文件
操作
下载
补丁
差异文件
Rename to gitlab-workhorse
上级
01f29889
No related branches found
分支 包含提交
No related tags found
标签 包含提交
无相关合并请求
变更
6
隐藏空白变更内容
行内
左右并排
显示
6 个更改的文件
.gitignore
+1
-1
1 个添加, 1 个删除
.gitignore
CHANGELOG
+8
-1
8 个添加, 1 个删除
CHANGELOG
Makefile
+5
-5
5 个添加, 5 个删除
Makefile
README.md
+12
-12
12 个添加, 12 个删除
README.md
githandler.go
+2
-2
2 个添加, 2 个删除
githandler.go
main.go
+2
-2
2 个添加, 2 个删除
main.go
有
30 个添加
和
23 个删除
.gitignore
+
1
−
1
浏览文件 @
b216db2e
gitlab-git-http-server
test/data
test/scratch
gitlab-workhorse
此差异已折叠。
点击以展开。
CHANGELOG
+
8
−
1
浏览文件 @
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
...
...
此差异已折叠。
点击以展开。
Makefile
+
5
−
5
浏览文件 @
b216db2e
PREFIX
=
/usr/local
VERSION
=
$(
shell git describe
)
-
$(
shell
date
-u
+%Y%m%d.%H%M%S
)
gitlab-
git-http-server
:
main.go githandler.go
go build
-ldflags
"-X main.Version
${
VERSION
}
"
-o
gitlab-
git-http-server
gitlab-
workhorse
:
main.go githandler.go
go build
-ldflags
"-X main.Version
${
VERSION
}
"
-o
gitlab-
workhorse
install
:
gitlab-
git-http-server
install
gitlab-
git-http-server
${
PREFIX
}
/bin/
install
:
gitlab-
workhorse
install
gitlab-
workhorse
${
PREFIX
}
/bin/
.PHONY
:
test
test
:
test/data/test.git
...
...
@@ -19,5 +19,5 @@ test/data:
.PHONY
:
clean
clean
:
rm
-f
gitlab-
git-http-server
rm
-f
gitlab-
workhorse
rm
-rf
test
/data
test
/scratch
此差异已折叠。
点击以展开。
README.md
+
12
−
12
浏览文件 @
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
'git archive' downloads for GitLab. All authentication and
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
## Usage
```
gitlab-
git-http-server
[OPTIONS]
gitlab-
workhorse
[OPTIONS]
Options:
-authBackend string
...
...
@@ -30,15 +30,15 @@ Options:
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
(with an empty request body) to an external authentication/authorization
HTTP server: the 'auth backend'. The auth backend is expected to
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.
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
[
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:
# Start a fake auth backend that allows everything/everybody
make test/data/test.git
go run support/fake-auth-backend.go ~+/test/data/test.git &
# Start gitlab-
git-http-server
# Start gitlab-
workhorse
make
./gitlab-
git-http-server
./gitlab-
workhorse
```
Now you can try things like:
...
...
@@ -85,14 +85,14 @@ curl -JO http://localhost:8181/test/repository/archive.zip
## Example request flow
-
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
-
....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)
-
......end POST to Unicorn from Git hook
-
....end git-receive-pack process
-
..end POST to gitlab-
git-http-server
-
..end POST to gitlab-
workhorse
-
end POST to NGINX
## License
...
...
此差异已折叠。
点击以展开。
githandler.go
+
2
−
2
浏览文件 @
b216db2e
...
...
@@ -51,7 +51,7 @@ type gitRequest struct {
// subdirectory
ArchivePrefix
string
// 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
}
...
...
@@ -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.
// 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
// Set a custom header for the request. This can be used in some
// configurations (Passenger) to solve auth request routing problems.
...
...
此差异已折叠。
点击以展开。
main.go
+
2
−
2
浏览文件 @
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
from Git clients that use the 'smart' Git HTTP protocol (git-upload-pack
...
...
@@ -43,7 +43,7 @@ func main() {
}
flag
.
Parse
()
version
:=
fmt
.
Sprintf
(
"gitlab-
git-http-server
%s"
,
Version
)
version
:=
fmt
.
Sprintf
(
"gitlab-
workhorse
%s"
,
Version
)
if
*
printVersion
{
fmt
.
Println
(
version
)
os
.
Exit
(
0
)
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录