搭建phabricator代码审核工具

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搭建phabricator代码审核工具相关的知识,希望对你有一定的参考价值。

phabricator
依赖环境 系统centos,mysqlphpnginx
1.下载安装脚本 https://secure.phabricator.com/source/phabricator/browse/master/scripts/install/install_rhel-derivs.sh
    直接运行sh install_rhel-derivs.sh安装或者修改脚本把安装apache改为安装nginx。
    下面我们采用默认安装,安装失败的地方通过手动方式安装。
    在阿里云centos 7以上mysql安装将会失败需要手动安装mariadb,yum -y install mariadb
    脚本安装依赖apache,手动安装nginx,yum -y install nginx
调用install脚本后会git clone下面三个工程
   libphutil,phabricator,arcanist
 
2.将上面三个目录拷贝到/usr/share/nginx/html/下面,注意不能将phabricator的webroot放在/root/**/下面否则nginx将无法访问到php脚本文件
   并修改nginx.conf的配置文件
   
# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
                      ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" "$http_x_forwarded_for"‘;

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html/phabricator/webroot;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
            index index.php;
            if ( !-f $request_filename ) {
                rewrite ^/(.*)$ /index.php?__path__=/$1 last;
                break;
            }
        }
        location /index.php {
            fastcgi_pass localhost:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

# Settings for a TLS enabled server.
#
#    server {
#        listen       443 ssl http2 default_server;
#        listen       [::]:443 ssl http2 default_server;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        ssl_certificate "/etc/pki/nginx/server.crt";
#        ssl_certificate_key "/etc/pki/nginx/private/server.key";
#        ssl_session_cache shared:SSL:1m;
#        ssl_session_timeout  10m;
#        ssl_ciphers HIGH:!aNULL:!MD5;
#        ssl_prefer_server_ciphers on;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
#        location / {
#        }
#
#        error_page 404 /404.html;
#            location = /40x.html {
#        }
#
#        error_page 500 502 503 504 /50x.html;
#            location = /50x.html {
#        }
#    }

}
3.安装php-fpm, yum install php-fpm。启动 service php-fpm start
4.进入phabricator/bin目录下执行./storage upgrade初始化phabricator数据库
5. 如果需要支持发送邮件需要在bin目录下启动phd
   ./mail send-test --to [email protected] --subject hi < body.txt
    测试发送邮件
安装完后:
   启动nginx 进入localhost
   配置管理员密码和用户名后进入管理主页
   config -->Mail 修改metamta.default-address 和 metamta.mail-adapter
   metamta.default-address 发送的邮箱地址如[email protected]
   metamta.mail-adapter 选择PhabricatorMailImplementationPHPMailerAdapter
   然后进入PHPMailer修改相应配置。

   或者直接进入/usr/share/nginx/html/phabricator/conf/local直接修改local.json   

{
  "phpmailer.smtp-host": "smtp.mxhichina.com",
  "phpmailer.smtp-port": 25,
  "phpmailer.smtp-user": "[email protected]",
  "phpmailer.smtp-password": "xxxxx",
  "differential.require-test-plan-field": false
}

上述配置完成后进入phabricator/bin

 执行./mail send-test --to [email protected] --subject hi < body.txt

 通过./mail list-outbound

[[email protected] bin]# ./mail list-outbound
1  Sent   [Phabricator] Email Verification
2  Sent   [Phabricator] New User "sylar" Awaiting Approval
4  Sent   hi
5  Sent   [Phabricator] Phabricator Account "sylar" Approved
6  Sent   [Phabricator] admin (admin) has invited you to join Phabricator
7  Sent   [Phabricator] admin (admin) has invited you to join Phabricator
8  Sent   [Phabricator] admin (admin) has invited you to join Phabricator
9  Sent   [Phabricator] admin (admin) has invited you to join Phabricator
6,进去Auth---->Add Provider让phabricator支持用户名密码登陆
 
这样基础的phabricator服务就配置完成了

 

 
 

以上是关于搭建phabricator代码审核工具的主要内容,如果未能解决你的问题,请参考以下文章

Mac OS下基于XAMPP搭建Phabricator

Phabricator 无法创建审核

**代码审查:Phabricator命令行工具Arcanist的基本用法

phabricator 从提要故事中获取提交作者,以获取关注、评论和审核的故事

code review工具之codebrag安装使用

使用Phabricator进行代码审查