配置phabricator隨時(shí)查看源代碼

1 搭建lnmp或lamp環(huán)境

2 下載phabricator并讓其運(yùn)行

mkdir?/var/www/phacility

git clone https://github.com/phacility/libphutil.git

cd ..

git clone https://github.com/phacility/arcanist.git

cd ..

git clone https://github.com/phacility/phabricator.git

配置nginx

server {

? ? ? ? listen 80;

? ? ? ? server_name review.yyj-edu.com;

? ? ? ? root /var/www/phacility/phabricator/webroot;

? ? ? ? location / {

? ? ? ? ? ? ? ? index? index.php index.html;

? ? ? ? ? ? ? ? #proxy_pass http://localhost:3000;

? ? ? ? ? ? ? ? #proxy_redirect off;

? ? ? ? ? ? ? ? rewrite ^/(.*)$ /index.php?__path__=/$1 last;

? ? ? ? }

? ? ? ? location /index.php {

? ? ? ? fastcgi_pass? unix:/run/php7.sock;

? ? ? ? fastcgi_index? index.php;

? ? ? ? fastcgi_param? SCRIPT_FILENAME? $document_root$fastcgi_script_name;

? ? ? ? include? ? ? ? fastcgi_params;

? ? ? ? }

}

3 創(chuàng)建www、git、damon用戶并配置sudo權(quán)限

因?yàn)榘惭b了nginx已經(jīng)有了www用戶,所以無(wú)需創(chuàng)建

添加damon用戶:

groupadd -g 71 -r review

useradd -u 71 -g review -M -r review

添加git用戶:

groupadd -g 70 git

useradd -u 70 -g git -m git

執(zhí)行visudo

添加:

#review ALL=(ALL) ALL

www ALL=(review) SETENV: NOPASSWD: /usr/bin/git

git ALL=(review) SETENV: NOPASSWD: /usr/bin/git, /usr/bin/git-receive-pack, /usr/bin/git-upload-pack

若存在Defaults requiretty注釋掉

4 克隆遠(yuǎn)程倉(cāng)庫(kù)

配置mysql數(shù)據(jù)庫(kù):

cd?/var/www/phacility/phabricator

./bin/config set mysql.host localhost

./bin/config set mysql.user youyijia

./bin/config set mysql.pass 1234

#配置base-uri

./bin/config set phabricator.base-uri http://review.yyj-edu.com/

因?yàn)榭寺∫蕾嘾amon進(jìn)程,所以要啟動(dòng)

#配置倉(cāng)庫(kù)存放路徑

./bin/config set repository.default-local-path /opt/res

#配置以review用戶運(yùn)行進(jìn)程

./bin/config set phd.user review

重載nginx: nginx -s reload

新增倉(cāng)庫(kù):

打開(kāi)review.yyj-edu.com/diffusion,并點(diǎn)擊Create Repository



選擇?Create Git Repository


點(diǎn)擊創(chuàng)建


再點(diǎn)擊URIs添加倉(cāng)庫(kù)地址


再激活倉(cāng)庫(kù):


確定激活


導(dǎo)入中

等到狀態(tài)為Fully Imported時(shí)就可以查看代碼了。


code

如果想托管代碼到phabricator上也是可以的。

配置ssh倉(cāng)庫(kù)托管

下面以ssh方式為例:

為了不與默認(rèn)ssh混淆,我們使用2222端口

./bin/config set diffusion.ssh-port 2222

確保openssh>6.2

切換git賬戶登錄服務(wù)器,生成公鑰

ssh-keygen -t rsa -b 2048 -C git




將生成的公鑰粘貼上去

WWW=/var/www/phacility

cp $WWW/phabricator/resources/sshd/phabricator-ssh-hook.sh /usr/libexec
cp $WWW/phabricator/resources/sshd/sshd_config.phabricator.example /etc/ssh/sshd_config.phabricator

chmod 700 /usr/libexec/phabricator-ssh-hook.sh #確保700權(quán)限

編輯/usr/libexec/phabricator-ssh-hook.sh:

VCSUSER="git"

ROOT="/var/www/phacility/phabricator"

編輯/etc/ssh/sshd_config.phabricator

AuthorizedKeysCommand /usr/libexec/phabricator-ssh-hook.sh

AuthorizedKeysCommandUser root

AllowUsers git

運(yùn)行sshd: sshd -f /etc/ssh/sshd_config.phabricator

然后我們創(chuàng)建一個(gè)test的倉(cāng)庫(kù)如下圖:


test rep

在URIs頁(yè)面可以看到已經(jīng)有一個(gè)URI

ssh://git@review.yyj-edu.com:2222/diffusion/2/test.git

現(xiàn)在我可以克隆下來(lái),添加項(xiàng)目。

git clone ssh://git@review.yyj-edu.com:2222/diffusion/2/test.git

Cloning into 'test'...

warning: You appear to have cloned an empty repository.

提示空倉(cāng)庫(kù),現(xiàn)添加mdb.js

git add mdb.js

$ git commit -m 'add file'

[master (root-commit) c6177ff] add file

1 file changed, 19507 insertions(+)

create mode 100644 mdb.js

$ git push

Enumerating objects: 3, done.

Counting objects: 100% (3/3), done.

Delta compression using up to 4 threads

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 186.13 KiB | 4.14 MiB/s, done.

Total 3 (delta 0), reused 0 (delta 0)

To ssh://review.yyj-edu.com:2222/diffusion/2/test.git

* [new branch]? ? ? master -> master

可以看到推送給phabricator成功

支持瀏覽大文件

bin/config set storage.mysql-engine.max-size 8388608

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容