How To Install Phabricator and Do Graceful Shutdown for Server Routine Maintenance-Tested

Deepesh Tripathi
4 min readFeb 20, 2020

--

Recently, there was faulty hardware in our phabricator server and due to this reason as a administrator we were supposed to give outage window to our hardware vendor.

Because we were doing this activity first time after installation of phabricator. hence it was mission critical for us as we had the responsiblity to maintain the source code data and project management data what phabricator secures in mariadb.

I checked online whether there is any recommended way to gracefully shutdown the phabricator application, i found an article on phabricator official site but the main part I found missed that is about how to gracefully shutdown phabricator application.

This challenge made me thought through the complete method of procedure and as a system admin i decided to test whatever is mentioned online in order to check the integrity and challenges which may come after server reboot.

First, let’s understand how to install phabricator in Centos7 machine.

To install phabricator in your centos7 machine all you need is below two things:

  1. Apache
  2. PHP

let’s see the installation of apache in centos7

yum install httpd

For Phabricator to work it is required to have PHP5.5+ version, hence please ensure to install php5.5 or above to avoid any hassle.

# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install PHP

# yum -y install php55w php55w-opcache
# yum -y install php55w-xml php55w-mcrypt php55w-gd php55w-devel php55w-mysql php55w-intl php55w-mbstring

Now enable and start the httpd.

:~# systemctl enable httpd
:~# systemctl start httpd

Then, set the Firewall rule to allow the use of Apache.

:~# firewall-cmd --add-port=80/tcp --permanent
:~# firewall-cmd --reload

At this stage you will be able to load the apache default page.

open the web browser and go to HTTP://Your-server/. You will be prompted to below screeen.

Mariadb installation

Phabricator required mariadb for keeping the project management data. Hence, in this step we will see how to install mariadb.

yum install mariadb-server

enable and start the mariadb.

:~# systemctl enable mariadb
:~# systemctl start mariadb

post db installation you would require a password to connect to db. hence you can set the password using “mysql_secure_installation” utility

mysql_secure_installation

So, you will be asked for many configuration questions. The answer like this: Y, N, Y, N.

At this point httpd,php and mariadb is installed in the system. These all are backend infrastructure required to run phabricator.

now it is time to install the phabricator and git.

Phabricator and Git Installation

:~# yum install git

Next, clone the Phabricator files into a folder that we’ll create inside Apache’s root directory.

:~# mkdir /var/www/html/phabricator
:~# cd /var/www/html/phabricator
:~# git clone https://github.com/phacility/libphutil.git
:~# git clone https://github.com/phacility/arcanist.git
:~# git clone https://github.com/phacility/phabricator.git

create a phabricator.conf file inside /etc/httpd/conf.d/phabricator.conf

:~# nano /etc/httpd/conf.d/phabricator.conf

Put the below configuration in above created file.

<VirtualHost *:80>
ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html/phabricator/phabricator/webroot/
ServerName phabricator.your-domain.com
ServerAlias www.phabricator.your-domain.com
RewriteEngine on
RewriteRule ^/rsrc/(.*) - [L,QSA]
RewriteRule ^/favicon.ico - [L,QSA]
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
<Directory /var/www/html/phabricator/phabricator/webroot/>
AllowOverride All
</Directory>
ErrorLog /var/log/httpd/phabricator.example.com-error_log
CustomLog /var/log/httpd/phabricator.example.com-access_log common
</VirtualHost>

Now, restart the apache.

systemctl restart httpd

The next step is to configure Phabricator with MariaDB. hence you will run these commands.

:~# ./bin/config set mysql.host localhost
:~# ./bin/config set mysql.user root
:~# ./bin/config set mysql.port 3306
:~# ./bin/config set mysql.pass <your_mariadb_root_password>

before doing this you should ensure, your arcanist,libphutils and phabricator folder are created with these names only other wise further steps will fail.

In above steps you have set all the parameters to connect phab and mariadb.

Now, run the upgrade script.

:~# ./bin/storage upgrade --user root --password your_mariadb_root_password

if you forgot the password you need to worry , you can see the password and other config with below commands.

:~# ./bin/config get mysql.user
:~# ./bin/config get mysql.pass
:~# ./bin/config get mysql.port

Now restart the MariaDB server to reflect changes.

:~# systemctl restart mariadb

Opening the Phabricator

Type in your host url in browser:

you have to first create the application admin and set the password to login.

second most important step is to make this application usable to other users for that you have to set the authorisation policy from admin console. only after that other users can register and start using the application.

click on add provider and select provider based on your org policy.

Gracefully Shutdown the application.

For application shutdown gracefully, first you should stop the mariadb service and subsequently apache.

systemctl stop mariadb
systemctl stop httpd

Post your maintenance activity just start these services.

systemctl start mariadb
systemctl start httpd

We have checked this procedure through a proper test and we could keep our phabricator data intact as in place as before maintenance shutdown.

--

--

Deepesh Tripathi

A Tech Geek | Meditator | Writer | Vedic Scholar | Speaker who loves to write about technology and humanity for personal and professional transformation.