微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ubuntu搭建Phabricator

安装MysqL5.7,Nginx

安装 PHP7.1

sudo apt-get install software-properties-common
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/PHP
sudo apt-get update

sudo apt-get -y install PHP7.1
sudo apt-get -y install PHP7.1-MysqL
sudo apt-get install PHP7.1-fpm

apt-get install PHP7.1-curl PHP7.1-xml PHP7.1-mcrypt PHP7.1-json PHP7.1-gd PHP7.1-mbstring

Nginx配置:

error_log  /var/log/Nginx/error.log;
pid        /var/run/Nginx.pid;

events {
    use   epoll;  
    worker_connections  65535;
}


http {
    include mime.types;
    default_type  application/octet-stream;
    log_not_found off;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" "$host" '
    	'$status $body_bytes_sent "$http_referer" '
    	'"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/Nginx/access.log;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

    keepalive_timeout  75s;
    client_max_body_size       100m;

    gzip on;
    gzip_http_version 1.0;
    gzip_min_length 1000;
    gzip_proxied any;
    gzip_types text/css text/xml application/x-javascript text/plain application/json  application/xml application/javascript;
    gzip_comp_level 5;

server {
  server_name YOU_DOMAIN;
  root        /opt/phabricator/webroot/;
  try_files $uri $uri/ /index.PHP;


  location / {
    index index.PHP;
    rewrite ^/(.*)$ /index.PHP?__path__=/$1 last;
  }

  location /index.PHP {
    fastcgi_pass   localhost:9000;
    fastcgi_index   index.PHP;

    #required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param  REDIRECT_STATUS    200;

    #variables to make the $_SERVER populate in PHP
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;

    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    Nginx/$Nginx_version;

    fastcgi_param  REMOTE_ADDR        $remote_addr;
  }
}

}

下载phabricator

$ cd somewhere/ # somewhere我选择的 /opt/
somewhere/ $ git clone https://github.com/phacility/libphutil.git
somewhere/ $ git clone https://github.com/phacility/arcanist.git
somewhere/ $ git clone https://github.com/phacility/phabricator.git

编辑/etc/PHP/7.1/fpm/pool.d/www.conf

listen = /run/PHP/PHP7.1-fpm.sock
listen = 9000


listen.allowed_clients = 127.0.0.1

重启PHP服务

service PHP7.1-fpm stop
service PHP7.1-fpm start

重启Nginx

添加MysqL用户

MysqL -rroot -p
>grant all privileges on `phabricator\_%`.* to 'phabricator'@localhost identified by 'phabricator';

设置phabricator

cd /opt/phabricator/bin
./config set MysqL.host localhost
./config set MysqL.port 3306
./config set MysqL.pass phabricator
./config set MysqL.pass phabricator

#更新数据库
./storage upgrade

进入web界面,创建admin用户解决issue

Arcanist是Phabricator的命令行接口.

安装:

# sudo apt-get install PHP5 PHP5-curl  # ubuntu 系统
# sudo yum install PHP5 # centos 系统

# cd /usr/local/bin  # 安装目标路径,如目录不在PATH,则将 export PATH=$PATH:/usr/local/bin 加入 .bashrc
# git clone https://github.com/phacility/libphutil.git
# git clone https://github.com/phacility/arcanist.git
# ln -s arcanist/bin/arc arc # 创建软链接,使arc命令位于PATH中
在.bashrc加入下面一行,使arc命令可以自动补全:
source /usr/local/bin/arcanist/resources/shell/bash-completion

注: ( 或用 npm 安装: npm install -g arcanist,无需配置,参见 https://www.npmjs.com/package/arcanist )

配置:

在git库目录创建 .arcconfig,内容如下:

{
   "phabricator.uri" : "http://HOSTNAME","editor": "vim","base": "git:merge-base(FETCH_HEAD)"
}

安装证书:

# arc install-certificate
提示用浏览器打开一个链接登录获取一个Token,复制该 Token,粘贴到终端即可


工作流程:

1. 运行 git commit -am "修复了 XX BUG" ,commit你的改动
2. 运行 arc diff ,提交Differential,它会提醒你填写一些信息:
Test Plan - 必填,详细说明你的测试计划;
Reviewers - 必填,审查人的账户,多个使用","隔开;
Subscribers - 非必填订阅人,多个使用","隔开。
提交成功后,审查人就能在Differential收到通知
3. 如果 review 没有通过,你需要在原来的基础上修改修改完并 commit 之后需要执行 arc diff --update D(id) 继续 review
4. 如果 review 通过了,只需要运行 arc land --onto dev, 将代码push到dev分支


命令参考:
arc help --full # 查看详细帮助
arc diff # 提交认的diff, arc diff origin/develop,指定diff的分支,注意origin后是斜线
arc diff xxx --preview # 提交针对某个分支的commit,并只生成diff文件,不在web端创建revision
arc which # 查看arc diff 会提交哪个范围的diff
arc land # 提交代码删除该分支 或 使用 git push
arc list # 查看有哪些revision和其状态


参考网址:
http://share.zuijiao.net/?p=22
https://secure.phabricator.com/book/phabricator/article/arcanist/
https://secure.phabricator.com/book/phabricator/

https://secure.phabricator.com/book/phabricator/article/installation_guide/

https://secure.phabricator.com/book/phabricator/article/configuration_guide/

http://stackoverflow.com/questions/1720244/create-new-user-in-MysqL-and-give-it-full-access-to-one-database

原文地址:https://www.jb51.cc/ubuntu/353708.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐