更新关于Unicorn的结论

This commit is contained in:
2016-03-19 16:31:31 +08:00
parent 61fe66c6cb
commit 359e4dd3bc
3 changed files with 23 additions and 14 deletions

View File

@ -280,16 +280,20 @@ Make sure GitLab can write to the public/uploads/ directory
$ chmod -R u+rwX public/uploads
Copy the example Unicorn config
复制Unicorn的示例配置文件
复制并修改Unicorn的示例配置文件
$ cp config/unicorn.rb.example config/unicorn.rb
$ vim config/unicorn.rb
Enable cluster mode if you expect to have a high load instance
Ex. change amount of workers to 3 for 2GB RAM server
启用集群模式如果你期望拥有一个高负载实例
修改worker的数量到3用于2GB内存的服务器
$ vim config/unicorn.rb
worker的数量不能小于2否则 push 时候出现如下错误:
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
默认监听本地127.0.0.1仅供内部访问一般情况下需要使用nginx做端口转发使gitlab与其他站点共存。若要使unicorn直接提供外网访问更改为
@ -514,7 +518,7 @@ Read http://wiki.centos.org/HowTos/Network/SecuringSSH
<https://gitlab.com/gitlab-org/gitlab-recipes/tree/8-2-stable/web-server/apache>
本例安装的 gitlab 版本并不包含 gitlab-workhorse需要将与其相关的内容注释掉本例使用了#noworkhorse#注释),否则 apache 无法启动。另外保证log配置指向存在的路径。
本例安装的 gitlab 版本并不包含 gitlab-workhorse需要将与其相关的内容注释掉本例使用了#noworkhorse#注释),否则 apache 无法启动。另外,修改所有YOUR_SERVER_FQDN保证log配置指向存在的路径。
本例修改后的内容如下:

View File

@ -84,7 +84,7 @@ centos 6
### 配置
sock 文件权限改为777是因为redis是手工安装并不是以redis用户启动的而是root。
以端口的方式应该也可行,参考“安装 gitlab 7”并将后续所有redis相关配置改为tcp方式。
以端口的方式应该也可行(未测试),参考“在 CentOS 上安装 Gitlab 7”关于 redis 安装的部分并将后续所有redis相关配置改为tcp方式。
# mv 6379.conf 6379.conf.orig
# cp 6379.conf.orig redis.conf
@ -366,6 +366,11 @@ Ex. change amount of workers to 3 for 2GB RAM server
unicorn 无法直接使用80端口原因不明。
worker的数量不能小于2否则 push 时候出现如下错误:
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
Copy the example Rack attack config
复制Rack attack的示例配置文件
@ -571,7 +576,7 @@ Read http://wiki.centos.org/HowTos/Network/SecuringSSH
<https://gitlab.com/gitlab-org/gitlab-recipes/tree/8-2-stable/web-server/apache>
本例安装的 gitlab 版本并不包含 gitlab-workhorse需要将与其相关的内容注释掉本例使用了#noworkhorse#注释),否则 apache 无法启动。另外,保证log配置指向存在的路径。
修改所有YOUR_SERVER_FQDN保证log配置指向存在的路径。
本例修改后的内容如下:
@ -601,7 +606,7 @@ Read http://wiki.centos.org/HowTos/Network/SecuringSSH
Allow from all
#Allow forwarding to gitlab-workhorse
#noworkhorse#ProxyPassReverse http://127.0.0.1:8181
ProxyPassReverse http://127.0.0.1:8181
#Allow forwarding to GitLab Rails app (Unicorn)
ProxyPassReverse http://127.0.0.1:8080
ProxyPassReverse http://YOUR_SERVER_FQDN/
@ -613,13 +618,13 @@ Read http://wiki.centos.org/HowTos/Network/SecuringSSH
RewriteEngine on
#Forward these requests to gitlab-workhorse
#noworkhorse#RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/gitlab-lfs/objects.* [OR]
#noworkhorse#RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/builds/download.* [OR]
#noworkhorse#RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/repository/archive.* [OR]
#noworkhorse#RewriteCond %{REQUEST_URI} ^/api/v3/projects/.*/repository/archive.* [OR]
#noworkhorse#RewriteCond %{REQUEST_URI} ^/ci/api/v1/builds/[0-9]+/artifacts.* [OR]
#noworkhorse#RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$
#noworkhorse#RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/gitlab-lfs/objects.* [OR]
RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/builds/download.* [OR]
RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/repository/archive.* [OR]
RewriteCond %{REQUEST_URI} ^/api/v3/projects/.*/repository/archive.* [OR]
RewriteCond %{REQUEST_URI} ^/ci/api/v1/builds/[0-9]+/artifacts.* [OR]
RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$
RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
#Forward any other requests to GitLab Rails app (Unicorn)
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]

View File

@ -6,4 +6,4 @@
# 为什么还要安装 Gitlab 7
Gitlab 7 版本内存占用低,实测 Unicorn 配置的 worker 数量为1时可以运行在 512M 内存 + 64M SWAP 的主机上。
Gitlab 7 版本内存占用低,实测 GitLab 7.14.3 + GitLab Shell 2.6.11 可以运行在 512M 内存 + 64M SWAP 的主机上。