2018/2/8

phabricator : repository URI I/O Type Observe

observer 的 uri 跟 mirror 剛好相反,自己不 host repo,但是會定期的向這個 observe uri 做 pull。
repo 的 uri 中有一個是 observe 時,其他的 uri 不可以有 write 屬性,因為這個 repo 無法 push 到 observe uri去。

對 obvsere uri 的 repo 操作。
programmer 直接clone remote (observe) uri 的 server project。
一樣 commit, arc diff 操作。
就跟對 phabricator host 的 repo 一樣。
arc 會產生 rev code,送 review request。
approve 後arc land 會 commit , push 到 這個 server (不是 pha server)。
然後在 phabicator 的 differential 上也會出現 rev diff code diff。
也會有 commit log。

2018/2/7

phabricator : repository I/O type mirror

mirror 這格 io type 是 把 phabricator host 的 repo push 到你指定的其他 git server 上。
是讓其他 git server 做備份的意思。

所以這個 uri 不用顯示為 clone uri 給 user 看。
還有可以對已經host 的 repo 增加這格 uri,讓 pharbicator push 到 另一個 server 做 mirror

這個 mirror (push) 功能不支援 svn

bookmark : phabricator: arc land on branch

from : how to merge commit using arc land on branch

I have a commit to fix a bug which is to merge on the current release branch.

Track a branch from remote naming release in local.
$ git branch -a 

$ git branch --track release remotes/origin/release 
Make another branch from release for issue fixing, e.g fix-issue
$ git branch fix-issue release 
$ git checkout fix-issue 
Make a change to fix a bug and commit those changes.

Upload changes to differential for reviewer
$ arc diff [It will create a revision number like 'DX', X is a number].  
If reviewer accept the revision then merge the revision
$ arc land --onto release  
Note: If you skip step 2, and commit change on tracked branch release, then arc land or arc land --onto release will show following error.

Work around is simple. Make a patch for that revision which will create a branch containing those changes.
$ arc patch D123 
Merge the revision to the release branch
$ arc land arcD123 --onto release 

2018/2/6

something about phabricator

ref:diffusion Hosting

Some general tips for troubleshooting problems with HTTP:

  • Make sure diffusion.allow-http-auth is enabled in your Phabricator config.
  • Make sure HTTP serving is enabled for the repository you're trying to clone. You can find this in Edit Repository → Hosting.
  • Make sure you've configured a VCS password. This is separate from your main account password. You can configure this in Settings → VCS Password.
Make sure the main repository screen in Diffusion shows a clone/checkout command for HTTP.
If it doesn't, something above isn't set up correctly:
double-check your configuration.
You should see a svn checkout http://..., git clone http://... or hg clone http://... command.
Run that command verbatim to clone the repository.

If you're using Git, using GIT_CURL_VERBOSE may help assess login failures.
To do so, specify it on the command line before the git clone command, like this:
$ GIT_CURL_VERBOSE=1 git clone ...
This will make git print out a lot more information.


要是由 phabricator 來 host repository,他提供 SSH 和部份 HTTP 作為 repository 的 protocol
SSH 需要 user /password,HTTP 則允許匿名操作。

SSH

如果這個 repository 要用 SSH protocol

HTTP

要用 http protocol 的話,要先把 http_auth 打開。
在 repository 新增一個 git repository 後,直接選 active。就會產生一個 phabricator 自己 host 的 repository
然後在 repository 頁面,會看到 error : find no git-....-backend。
follow link:
I checked everything once again, and this particular issue with the binary not being found was caused by a bad symlynk in /support/bin.

The correct way was:

cd to ../phabricator/support/bin

sudo ln -sv /usr/lib/git-core/git-http-backend
After this the permission issues are solved.

等repo managenet 頁面都 OK,到 uri 可以看到 phabricator 產生了三個 uri link
到 repository 主頁面去 "clone" 就會出現clone link..

但是 clone 時,會問你 username 和 password。
這是你在 phabricator server 上的 username,
因為他不希望你把 http (VCS) password 和 login password 搞得一樣,所以在 user 的 setting 頁面,會有多一個 "VCS password" 讓你設定。
設好之後,就用這個做 clone 時的 password。


一堆問題

pha 自己 host repo 的問題很多,大多是權限問題,
要 follow 上面,有關這些 daemon 的 user 權限。
Creating System User Account 這一個 section 說的。
* www-user 就是指 web server 的 run user,用 nginx 的話,會是 "www-data" * daemon-user 就是指 phd 的 run user,為方便,就直接指定為 "root" * vcs-user 大概是指要由 ssh 提供 repo access 時的 username。 上面三個都要有 access git 的權限,所以要修改 sudoer:
www-data ALL=(root) SETENV: NOPASSWD: /usr/lib/git-core/git, /usr/bin/git, /var/lib/git, /usr/lib/git-core/git-http-backend, /usr/bin/ssh, /etc/ssh, /etc/default/ssh, /etc/init.d/ssh

另外,還用 config set user 把 phd.user 和 diffusion.vcs user 設為 root

另外,直接由 pha new git repo, active repo 的 empty repo 會沒有 master branch,
所以要先clone (repo 頁面的 clone button 有 url link) 下來,
$ git commit --allow-empty -m "init"
$ git push origin master
先在 pha 的 repo create master branch 後,再開始 clone.. edir,, arc...

2018/2/5

Failed to load class or interface 'SimpleXMLElement': the class or interface 'SimpleXMLElement' 
is not defined in the library map for any loaded phutil library.

https://secure.phabricator.com/T11725

 libargon2-0{u} libsodium23{u} php-apcu-bc{a} php-cli{u} php-pear{a} php-xml php7.2-cli{u} php7.2-common{u} php7.2-json{u} 
  php7.2-opcache{u} php7.2-readline{u} php7.2-xml{u} 
大概是 php5.6-xml 沒裝或版本錯。

phabricator : local/client 端的diff, commit tool - arcanist

ref: phabricator 結合 arcanist 使用
原來 phabricator 的用法跟 gerrit 不一樣,需要配合phabricator 自己的 tool。
像 gerrit 只要 push 到特定的 ref/XXX 之後,就會驅動 gerrit 的 codereview 事件。不需要而外的 tool
phabricator 就要用自己的 tool (arc) 做到跟 phabricator server 的溝通。

所以第一步:安裝 arc (arcanist):

找一個folder clone https://github.com/phacility/arcanist
然後把 arcanist/bin 加到 PATH 中。(我是建arc 的 link 到 ~/bin/ 下)

設定 global property (editor, phabricator location..)
arc set-config editor "vim"
arc set-config default http://192.168.144.82
另外需要你在phabricator server 帳戶的certificate..
arc install-certicicate
依照說明 copy phabricator 網站資料過來就可以。

可以用來看這些 config 的命令:
arc get-config --verbose


一般的 code review 動作

ref:Simple flow using Arcanist and Differential for code review


這個 php7.0 不支援的限制很麻煩。
所以 要在 stretch 上裝 php5.6:

sendmail : mail to self with broken config

只是為了在自己機器上的測試...
apt-get install 完 sendmail 後,什麼都沒設...

用 telnet 連接 mail service port: 25
因為沒有設定好主機名稱(沒有 dns),所以 sendmail 只認識 localhost
darling@franxx:/var/log$ telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 franxx ESMTP Sendmail 8.15.2/8.15.2/Debian-3; Mon, 5 Feb 2018 10:26:17 +0800; 
(No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
HELO localhost
250 franxx Hello localhost [127.0.0.1], pleased to meet you
MAIL FROM : darling@localhost
250 2.1.0 darling@localhost... Sender ok
RCPT TO : darling@localhost
250 2.1.5 darling@localhost... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
this is the mail
and more
.
250 2.0.0 w152QHi9022136 Message accepted for delivery
quit
221 2.0.0 franxx closing connection
Connection closed by foreign host.
You have new mail in /var/mail/darling
darling@franxx:/var/log$ mail -p
Return-Path: 
Received: from localhost (localhost [127.0.0.1])
 by franxx (8.15.2/8.15.2/Debian-3) with SMTP id w152QHi9022136
 for darling@localhost; Mon, 5 Feb 2018 10:27:03 +0800
Date: Mon, 5 Feb 2018 10:26:17 +0800
From: darling 
Message-Id: <201802050227.w152QHi9022136@franxx>

this is the mail
and more
命令說明:
  • 先要用 HELO 說明自己主機名稱,因為 sendmail 可以同時服務很多主機名撐。
  • MAIL FROM : 寄信人。
  • RCPT TO : 收信人
  • DATA 信件內容,用 "." 符號結束。
對於沒有限制 sender 跟檢查的 mail server,這樣的設定也可以寄。(gmail 就不行)
就是 RCPT TO 寫對方 emai address 就可以,

ref:https://ubuntuforums.org/showthread.php?t=1819158"