Installation of Phabricator

This post records my procedure of installing Phabricator (P for short).

mkdir /usr/local/phabricator

install_ubuntu.sh

Till this far, P is installed, but configuration is more important.

First, we need to set up the web access to P.

cd /etc/apache2

create a P site

cd sites-available/

cp default phabricator

write P as

<VirtualHost *:80>

ServerAdmin webmaster@localhost

ServerName MY-PC-ADDRESS-ON-THE-NETWORK

DocumentRoot /usr/local/phabricator/phabricator/webroot

RewriteEngine on

RewriteRule ^/rsrc/(.*) – [L,QSA]

RewriteRule ^/favicon.ico – [L,QSA]

RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]

<Directory “/usr/local/phabricator/phabricator/webroot”>

Order allow,deny

Allow from all

</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

enable P while disabling default

a2dissite default

a2ensite phabricator

service apache2 reload

setup mysql

./storage upgrade

./storage upgrade –user <username> –password <your password>

P accesses information from MySQL, so if mysql is password protected, the configuration of P need to remember that password.

./config set mysql.pass <your password>

set up initial account, and later we can manage account with portal.

./accountadmin

After that, we are able to see the web site alive. But it is not over. P provides a nice interface for you to solve any problem.

Simply follow the pop-ups warnings, for time zone etc.

Outbound Email

Unless you’ve already a SMTP server, which needs a domain, a public IP, etc.(I have no experience in this.), it would be not necessary for an email server for you.

Possibility is using EC2 free tier to set up private SMTP server.

The mail is disabled on my side so far, and without it, we have to create a new user or edit an existing user by console.

./accountadmin

File Storage

We use local disk.

./config set storage.local-disk.path <FILE PATH>

However, by the default storage engine selector MySQL>Local>S3, this enabling of disk path is not easy to see. <File Path> must allow creating directory, i.e. enable +x mode.

Don’t forget to enable php upload max size in php.ini.

However, I keep seeing this message

Uploaded file is too large: file is larger than the ‘upload_max_filesize’ setting in php.ini.

If the file is beyond 2 MB, but I have set php to accept 5 MB!

Anyway, once uploading files larger than 1MB and smaller than 2 MB, the file is uploaded to the file path correctly with a created directory.

Differential for Code Review

Review is done before pushing code. It is useful in the extreme case like working with an intern.

Although I don’t like the case specially I was an intern before, it is somehow true that a concerned and serious system architect would always keep an critical eye on things committed to his repository. They don’t want to see rubbish. Well, it is my personal feeling, but I have no idea of how Differential could help for easy reviewing, especially when reviewers need to run the uncommitted code!

To use Differential, a web interface was firstly tried out. What I did was simply copy and paste a diff file without (END).

P requires a format checking before pasting into Differential. Example is like this.

diff - - git a/xxx.java b/c

index 2faa7d4..b573086 100644

— a/xxx.java

+++ b/xxx.java

@@ -108,7 +108,7 @@

– WebResource resource = Client.create().resource (“http://localhost:7474/

+ WebResource resource = Client.create().resource (engine.getServerURL()+”

ClientResponse response = resource

It follows with a summary of revision and a test plan for this revision.

The reviewers will receive a notification and apply or reject the revision and then the author of the revision can close or modify the revision.

What is Lint and Unit?

And the theoretical challenge is still there, i.e. how the reviewer run the code, other than simply looking at it.

Diffusion for Git

Diffusion is needed for tools, including Audit, Herald rules, others involving commits.

Create a new repository

mkdir repository

chmod o+wx repository

create a non-passphrase ssh key pairs, ssh-keygen

pass phabricator_rsa.pub to git system admin for granting git access to project repository.

create a new user called phabricator in the running system.

copy and rename the private key to /home/phabricator/.ssh/id_rsa

make sure the owner is phabricator.

For the better of life, change the owner of P to the new user.

chown -R phabricator:phabricator phabricator/

Run for testing the connection with git.

./repository/test_connection.php XX

But why it keeps asking phabricator@git server’s password.

Try to see what is dumped out.

ls-remote phabricator@gitaddress just-testing

It is not the way of our git server setup for opening the ssh door under same username gitosis for all git users.

Since currently we use gitosis as ssh user to the git server. The SSH user is changed at the portal from “phabricator” to “gitosis”.

Now we have, “OKAY Connection successful. The credentials for this repository appear to be correctly configured.”

Start tracking daemons

Since, daemons in P needs to write log into var/tmp/phd/pid, we need to allow user phabricator to do that

usermod -a -G www-data phabricator

id phabricator

chmod g+w /var/tmp/phd/pid

Run the daemon,

./bin/phd start|stop|status|restart

However, I got this after running daemons.

Expected to find repo at ‘…./phabricator/phabricator/repository’, but the actual git repository root for this directory is ‘…./phabricator/phabricator’. Something is misconfigured. The repository’s ‘Local Path’ should be set to some place where the daemon can check out a working copy, and should not be inside another git repository

It is because /p/p/ has a .git configuration when installing P, and repository is not allowed to inside it. Simply move repository to /p/repository.

Ok, I have to say I have to manually set up the git repository. Otherwise, P will not do it by itself, and reporting exceptions.

Initialize the git repository

git clone gitosis@gitaddress:project.git

Then all the history will be imported into P.

Audit Code

It must be after Git Repository is set up.

Quite simple by just following the manual. Here, we only tested the default trigger, i.e.

Commit with “Auditors: username1, username2”.

Simply note that, if you like to use a test branch to test the feature, after push the newly test branch to remote,

you need to restart the daemon process.

Maniphest the track of bugs

The default interface is cool enough, except a few lines of customization of fields.

{
"hpls:estimated-hours" : {
"label" : "Estimated Hours",
"type" : "int",
"caption" : "Estimated number of hours this will take.",
"required" : false
},

“hpls:deadline” : {
“label” : “Deadline”,
“type” : “date”,
“required” : true,
“caption” : “The task will be due in.”
}
}

What I did is simply adding an estimated hours field and a deadline field.

Phriction a Wiki

Oo, I don’t want to say too much in setting up a wiki.

The cheat sheet is very useful.

So far, Phabricator should be enough for my minimum usage, and here I should close my installation page.
More functionalities and configurations will be covered if there is a need in another page.

Job done!

Advertisements
Tagged ,

2 thoughts on “Installation of Phabricator

  1. Manu Ganji says:

    It should be

    cp default phabricator.conf

    Other wise it won’t get added as a site by apache2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: