1. 程式人生 > >搭建phabricator代碼審核工具

搭建phabricator代碼審核工具

org 安裝apache quest node pac conf listen cati pki

phabricator 依賴環境 系統centos,mysql,php,nginx 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代碼審核工具