phabricator 安裝使用

Installation Requirements

  • 1 臺 Linux host
  • mysql >= 5.5
  • php >= 5.2
  • webserver 服務熔萧,apache
  • domain name
    Installing Required Components

RedHat Derivatives Install Script

#!/bin/bash
confirm() {
echo "Press RETURN to continue, or ^C to cancel.";
read -e ignored 
}
RHEL_VER_FILE="/etc/redhat-release"
if [[ ! -f $RHEL_VER_FILE ]]
then
echo "It looks like you're not running a Red Hat-derived distribution."
echo "This script is intended to install Phabricator on RHEL-derived"
echo "distributions such as RHEL, Fedora, CentOS, and Scientific Linux."
echo "Proceed with caution."
confirm 
fi
echo "PHABRICATOR RED HAT DERIVATIVE INSTALLATION SCRIPT";
echo "This script will install Phabricator and all of its core dependencies.";
echo "Run it from the directory you want to install into.";
echo
RHEL_REGEX="release ([0-9]+)\."
if [[ $(cat $RHEL_VER_FILE) =~ $RHEL_REGEX ]]
then
RHEL_MAJOR_VER=${BASH_REMATCH[1]}
else
echo "Ut oh, we were unable to determine your distribution's major"
echo "version number. Please make sure you're running 6.0+ before"
echo "proceeding."
confirm 
fi
if [[ $RHEL_MAJOR_VER < 6 && $RHEL_MAJOR_VER > 0 ]]
then
echo "** WARNING **"
echo "A major version less than 6 was detected. Because of this,"
echo "several needed dependencies are not available via default repos."
echo "Specifically, RHEL 5 does not have a PEAR package for php53-*."
echo "We will attempt to install it manually, for APC. Please be careful."
confirm 
fi
echo "Phabricator will be installed to: $(pwd).";
confirm 
echo "Testing sudo/root..."
if [[ $EUID -ne 0 ]] # Check if we're root. If we are, continue.
then
sudo true
SUDO="sudo"
if [[ $? -ne 0 ]]
then
echo "ERROR: You must be able to sudo to run this script, or run it as root.";
exit 1
fi
fi
if [[ $RHEL_MAJOR_VER == 5 ]]
then
# RHEL 5's "php" package is actually 5.1. The "php53" package won't let us install php-pecl-apc.
# (it tries to pull in php 5.1 stuff) ...
yum repolist | grep -i epel 
if [ $? -ne 0 ]; then
echo "It doesn't look like you have the EPEL repo enabled. We are to add it"
echo "for you, so that we can install git."
$SUDO rpm -Uvh https://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 
fi
YUMCOMMAND="$SUDO yum install httpd git php53 php53-cli php53-mysql php53-process php53-devel php53-gd gcc wget make pcre-devel mysql-server"
else
# RHEL 6+ defaults with php 5.3
YUMCOMMAND="$SUDO yum install httpd git php php-cli php-mysql php-process php-devel php-gd php-pecl-apc php-pecl-json php-mbstring mysql-server"
fi
echo "Dropping to yum to install dependencies..."
echo "Running: ${YUMCOMMAND}"
echo "Yum will prompt you with [Y/n] to continue installing."
$YUMCOMMAND
if [[ $? -ne 0 ]]
then
echo "The yum command failed. Please fix the errors and re-run this script."
exit 1
fi
if [[ $RHEL_MAJOR_VER == 5 ]]
then
# Now that we've ensured all the devel packages required for pecl/apc are there, let's
# set up PEAR, and install apc.
echo "Attempting to install PEAR"
wget https://pear.php.net/go-pear.phar 
$SUDO php go-pear.phar && $SUDO pecl install apc 
fi
if [[ $? -ne 0 ]]
then
echo "The apc install failed. Continuing without APC, performance may be impacted."
fi
pidof httpd 2>&1 > /dev/null 
if [[ $? -eq 0 ]]
then
echo "If php was installed above, please run: /etc/init.d/httpd graceful"
else
echo "Please remember to start the httpd with: /etc/init.d/httpd start"
fi
pidof mysqld 2>&1 > /dev/null 
if [[ $? -ne 0 ]]
then
echo "Please remember to start the mysql server: /etc/init.d/mysqld start"
fi
confirm 
if [[ ! -e libphutil ]]
then
git clone https://github.com/phacility/libphutil.git 
else
(cd libphutil && git pull --rebase)
fi
if [[ ! -e arcanist ]]
then
git clone https://github.com/phacility/arcanist.git 
else
(cd arcanist && git pull --rebase)
fi
if [[ ! -e phabricator ]]
then
git clone https://github.com/phacility/phabricator.git 
else
(cd phabricator && git pull --rebase)
fi
echo
echo
echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':";
echo
echo " https://secure.phabricator.com/book/phabricator/article/configuration_guide/";

clone 必須代碼倉庫

$ cd somewhere/ # pick some install directory
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

Configuration

Webserver: Configuring nginx
# /etc/nginx/nginx.conf
#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] $http_host:$server_port $scheme "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" '
                      '$connection $upstream_addr '
                      '$upstream_response_time $request_time $request_length';
    #access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
    include conf.d/*.conf;
}
/etc/nginx/conf.d/phab.conf
server {
  listen 80;
  server_name phabricator-qa.graviti.cn;
  root        /usr/local/phacility/phabricator/webroot;
  access_log  /var/log/phabricator/access.log main;
  error_log  /var/log/phabricator/error.log;
  client_max_body_size 64m;
  location / {
    index index.php;
    rewrite ^/(.*)$ /index.php?__path__=/$1 last;
  }
  location /index.php {
    try_files $uri =404;
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_index   index.php;
    fastcgi_param  SCRIPT_FILENAME  /usr/local/phacility/phabricator/webroot$fastcgi_script_name;
    include fastcgi_params;
  }
}

配置環(huán)境

添加 phd 用戶
useradd phd
添加軟鏈
ln -s /usr/local/phacility/phabricator/resources/sshd/phabricator-ssh-hook.sh phabricator-ssh-hook.sh
配置 phab

直接配置 conf/local/local.json 文件

{
  "security.require-https": true,
  "diffusion.ssh-port": 2224,
  "diffusion.ssh-user": "git",
  "phd.user": "phd",
  "cluster.mailers": [
    {
      "key": "local-mailer",
      "type": "sendmail",
      "options": {
        "message-id": true
      }
    }
  ],
  "repository.default-local-path": "/data/repo/",
  "storage.local-disk.path": "/data/phabricator/",
  "phabricator.base-uri": "https://phabricator.xxxx.com",
  "mysql.pass": "Wxxxxxx3",
  "mysql.user": "root",
  "mysql.host": "127.0.0.1"
}

或者,通過命令更改配置

./bin/config set mysql.host 127.0.0.1
./bin/config set mysql.pass xxxxxx
./bin/config set mysql.port 3306
./bin/config set mysql.user root

更新數(shù)據(jù)庫

root@service-3054-190911205326 phabricator]# ./bin/storage upgrade
Before running storage upgrades, you should take down the Phabricator web
interface and stop any running Phabricator daemons (you can disable this
warning with --force).
    Are you ready to continue? [y/N] y
Loading quickstart template onto "127.0.0.1"...
Applying patch "phabricator:db.paste" to host "127.0.0.1"...
Applying patch "phabricator:20190523.myisam.01.documentfield.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190718.paste.01.edge.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190718.paste.02.edgedata.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190718.paste.03.paste.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190718.paste.04.xaction.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190718.paste.05.comment.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190802.email.01.storage.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190802.email.02.xaction.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190815.account.01.carts.php" to host "127.0.0.1"...
Applying patch "phabricator:20190815.account.02.subscriptions.php" to host "127.0.0.1"...
Applying patch "phabricator:20190816.payment.01.xaction.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190816.subscription.01.xaction.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190822.merchant.01.view.sql" to host "127.0.0.1"...
Applying patch "phabricator:20190909.herald.01.rebuild.php" to host "127.0.0.1"...
Storage is up to date. Use "storage status" for details.
Synchronizing static tables...
Verifying database schemata on "127.0.0.1"...

Database                Table                Name        Issues
phabricator_conpherence  conpherence_index                  Better Table Engine Available
phabricator_differential differential_revision phid         Surplus Key
phabricator_differential differential_revision key_modified Missing Key
phabricator_differential differential_revision key_phid     Missing Key
phabricator_phortune     phortune_accountemail key_account  Missing Key
phabricator_phortune     phortune_accountemail key_address  Missing Key
phabricator_phortune     phortune_accountemail key_phid     Missing Key
Applying schema adjustments...
Done.                                                                         
Completed applying all schema adjustments.
 ANALYZE  Analyzing tables...                                                 
Done.                                                                         
 ANALYZED  Analyzed 535 table(s).
使用 phd 管理后臺

phd 是一個命令行程序(位于 phabricator/bin/phd )

[root@service-3054-190911205326 phabricator]# ./bin/phd help
NAME
      phd - manage daemons
SYNOPSIS
      phd command [options]
          Manage Phabricator daemons.
WORKFLOWS
聋呢。。澎粟。漓藕。。
Use help command for a detailed command reference.
Use --show-standard-options to show additional options.

通常情況下畜隶,你會使用:

  • phd start 啟動所有后臺進程;
  • phd restart 重啟所有后臺進程;
  • phd status 列出所有后臺進程;
  • phd stop 停止所有后臺進程。

如果你想要更細粒度的控制号胚,你可以使用:

  • phd launch 啟動單個后臺進程;
  • phd debug 調(diào)試

啟動 phabricator

[root@service-3054-190911205326 phabricator]# ./bin/phd start
Freeing active task leases...
Freed 0 task lease(s).
Starting daemons as phd
Launching daemons:
(Logs will appear in "/var/tmp/phd/log/daemons.log".)
    (Pool: 1) PhabricatorRepositoryPullLocalDaemon
    (Pool: 1) PhabricatorTriggerDaemon
    (Pool: 1) PhabricatorFactDaemon
    (Pool: 4) PhabricatorTaskmasterDaemon
Done.
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末籽慢,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子猫胁,更是在濱河造成了極大的恐慌箱亿,老刑警劉巖,帶你破解...
    沈念sama閱讀 206,839評論 6 482
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件弃秆,死亡現(xiàn)場離奇詭異届惋,居然都是意外死亡髓帽,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,543評論 2 382
  • 文/潘曉璐 我一進店門脑豹,熙熙樓的掌柜王于貴愁眉苦臉地迎上來氢卡,“玉大人,你說我怎么就攤上這事晨缴。” “怎么了峡捡?”我有些...
    開封第一講書人閱讀 153,116評論 0 344
  • 文/不壞的土叔 我叫張陵击碗,是天一觀的道長。 經(jīng)常有香客問我们拙,道長稍途,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 55,371評論 1 279
  • 正文 為了忘掉前任砚婆,我火速辦了婚禮械拍,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘装盯。我一直安慰自己坷虑,他們只是感情好,可當我...
    茶點故事閱讀 64,384評論 5 374
  • 文/花漫 我一把揭開白布埂奈。 她就那樣靜靜地躺著迄损,像睡著了一般。 火紅的嫁衣襯著肌膚如雪账磺。 梳的紋絲不亂的頭發(fā)上芹敌,一...
    開封第一講書人閱讀 49,111評論 1 285
  • 那天,我揣著相機與錄音垮抗,去河邊找鬼氏捞。 笑死,一個胖子當著我的面吹牛冒版,可吹牛的內(nèi)容都是我干的液茎。 我是一名探鬼主播,決...
    沈念sama閱讀 38,416評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼辞嗡,長吁一口氣:“原來是場噩夢啊……” “哼豁护!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起欲间,我...
    開封第一講書人閱讀 37,053評論 0 259
  • 序言:老撾萬榮一對情侶失蹤楚里,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后猎贴,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體班缎,經(jīng)...
    沈念sama閱讀 43,558評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡蝴光,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,007評論 2 325
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了达址。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片蔑祟。...
    茶點故事閱讀 38,117評論 1 334
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖沉唠,靈堂內(nèi)的尸體忽然破棺而出疆虚,到底是詐尸還是另有隱情,我是刑警寧澤满葛,帶...
    沈念sama閱讀 33,756評論 4 324
  • 正文 年R本政府宣布径簿,位于F島的核電站,受9級特大地震影響嘀韧,放射性物質(zhì)發(fā)生泄漏篇亭。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 39,324評論 3 307
  • 文/蒙蒙 一锄贷、第九天 我趴在偏房一處隱蔽的房頂上張望译蒂。 院中可真熱鬧,春花似錦谊却、人聲如沸柔昼。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,315評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽岳锁。三九已至,卻和暖如春蹦魔,著一層夾襖步出監(jiān)牢的瞬間激率,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,539評論 1 262
  • 我被黑心中介騙來泰國打工勿决, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留乒躺,地道東北人。 一個月前我還...
    沈念sama閱讀 45,578評論 2 355
  • 正文 我出身青樓低缩,卻偏偏與公主長得像嘉冒,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子咆繁,可洞房花燭夜當晚...
    茶點故事閱讀 42,877評論 2 345

推薦閱讀更多精彩內(nèi)容