From 359e4dd3bcbe6c58e2a7be8fc1745b755aa9e911 Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 19 Mar 2016 16:31:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=85=B3=E4=BA=8EUnicorn?= =?UTF-8?q?=E7=9A=84=E7=BB=93=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gitlab7.CentOS.md | 10 +++++++--- Gitlab8.CentOS.md | 25 +++++++++++++++---------- README.md | 2 +- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Gitlab7.CentOS.md b/Gitlab7.CentOS.md index 39d6b1f..db5b3c3 100644 --- a/Gitlab7.CentOS.md +++ b/Gitlab7.CentOS.md @@ -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 -本例安装的 gitlab 版本并不包含 gitlab-workhorse,需要将与其相关的内容注释掉(本例使用了#noworkhorse#注释),否则 apache 无法启动。另外,保证log配置指向存在的路径。 +本例安装的 gitlab 版本并不包含 gitlab-workhorse,需要将与其相关的内容注释掉(本例使用了#noworkhorse#注释),否则 apache 无法启动。另外,修改所有YOUR_SERVER_FQDN,并保证log配置指向存在的路径。 本例修改后的内容如下: diff --git a/Gitlab8.CentOS.md b/Gitlab8.CentOS.md index 8c6f7ea..1a17eda 100644 --- a/Gitlab8.CentOS.md +++ b/Gitlab8.CentOS.md @@ -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 -本例安装的 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] diff --git a/README.md b/README.md index dd534be..2c75408 100644 --- a/README.md +++ b/README.md @@ -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 的主机上。