GitLab 服务构成

 

 

GitLab 由主要由以下服务构成,他们共同承担了 Gitlab 的运作需要
Nginx:静态 web 服务器。
gitlab-shell:用于处理 Git 命令和修改 authorized keys 列表。
gitlab-workhorse: 轻量级的反向代理服务器。
logrotate:日志文件管理工具。
postgresql:数据库。
redis:缓存数据库。
sidekiq:用于在后台执行队列任务(异步执行) 。
unicorn:An HTTP server for Rack applications,GitLab Rails 应用是托管在这个服务器上面的

我们可以使用 gitlab-ctl status 命令来查看各服务的状态

[root@ci-node1 src]# gitlab-ctl status
run: gitaly: (pid 33501) 773s; run: log: (pid 33021) 932s
run: gitlab-monitor: (pid 33513) 773s; run: log: (pid 33119) 915s
run: gitlab-workhorse: (pid 33523) 772s; run: log: (pid 32976) 947s
run: logrotate: (pid 33532) 772s; run: log: (pid 33003) 939s
run: nginx: (pid 33538) 771s; run: log: (pid 32987) 945s
run: node-exporter: (pid 33543) 771s; run: log: (pid 33069) 921s
run: postgres-exporter: (pid 33548) 771s; run: log: (pid 33169) 897s
run: postgresql: (pid 33592) 770s; run: log: (pid 32753) 990s
run: prometheus: (pid 33601) 770s; run: log: (pid 33151) 903s
run: redis: (pid 33608) 769s; run: log: (pid 32693) 996s
run: redis-exporter: (pid 33614) 769s; run: log: (pid 33136) 909s
run: sidekiq: (pid 33621) 766s; run: log: (pid 32958) 953s
run: unicorn: (pid 33660) 753s; run: log: (pid 32919) 959s

 

 

GitLab 工作流程

 

 

 http是从nginx方向过来 反向代理

 

GitLab Shell

GitLab Shell 有两个作用:为 GitLab 处理 Git 命令、修改 authorized keys 列表

当通过 SSH 访问 GitLab Server 时,GitLab Shell 会:
限制执行预定义好的 Git 命令(git push, git pull, git annex)
调用 GitLab Rails API 检查权限
执行 pre-receive 钩子(在 GitLab 企业版中叫做 Git 钩子)
执行你请求的动作 处理 GitLab 的 post-receive 动作
处理自定义的 post-receive 动作
当通过 http(s)访问 GitLab Server 时,工作流程取决于你是从 Git 仓库拉取(pull)代
码还是向 git 仓库推送(push)代码。
如果你是从 Git 仓库拉取(pull)代码,GitLab Rails 应用会全权负责处理用户鉴权和
执行 Git 命令的工作;
如果你是向 Git 仓库推送(push)代码,GitLab Rails 应用既不会进行用户鉴权也不会
执行 Git 命令,它会把以下工作交由 GitLab Shell 进行处理:
调用 GitLab Rails API 检查权限
执行 pre-receive 钩子(在 GitLab 企业版中叫做 Git 钩子)
执行你请求的动作
处理 GitLab 的 post-receive 动作
处理自定义的 post-receive 动作

 

GitLab Workhorse

GitLab Workhorse 是一个敏捷的反向代理。它会处理一些大的 HTTP 请求,比如文件上传、文件下载、Git push/pull 和 Git 包下载。其它请求会反向代理到 GitLab Rails 应用,
即反向代理给后端的 unicorn。

posted @ 2020-03-29 17:09  minger_lcm  阅读(920)  评论(0编辑  收藏  举报