Skip to content

Instantly share code, notes, and snippets.

@thanhtoan1196
Last active September 16, 2017 03:47
Show Gist options
  • Save thanhtoan1196/df86549543cad2defea7305798afc1e4 to your computer and use it in GitHub Desktop.
Save thanhtoan1196/df86549543cad2defea7305798afc1e4 to your computer and use it in GitHub Desktop.
phabricator

Phabricator Ubuntu Installation Guide

This is a supplement to the official Phabricator Installation Guide, because their guide will leave you with all kinds of permission and config errors and ~15,000 setup issues on startup.

Install bonus packages:

sudo apt-get install python-pygments

And create repo directory if phabricator will be hosting repos:

sudo mkdir /var/repo

Install phabricator:

mkdir -p /home/ubuntu/tools/phabricator
cd /home/ubuntu/tools/phabricator
sudo apt install git nginx mysql-server
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1
sudo apt-get install php7.1-mbstring php7.1-iconv php7.1-mysql php7.1-curl php7.1-fpm php7.1-gd php7.1-apcu
git clone https://github.com/phacility/libphutil.git
git clone https://github.com/phacility/arcanist.git
git clone https://github.com/phacility/phabricator.git

Recommended Phabricator Configurations to set:

cd /home/ubuntu/tools/phabricator/phabricator
./bin/config set mysql.host <MYSQL_HOST>
./bin/config set mysql.port <MYSQL_PORT>
./bin/config set mysql.user <MYSQL_USER>
./bin/config set mysql.pass <MYSQL_PASSWD>
./bin/config set phabricator.base-uri 'http://phabricator.mydomain.net/'
./bin/config set pygments.enabled true
./bin/config set storage.mysql-engine.max-size 8388608

Nginx Configuration:

First verify that nginx is displaying a default page on port 80, then setup apache configuration file (/etc/nginx/conf.d/phabricator.conf): `

server {
    server_name phabricator.mydomain.net;
    root        /home/ubuntu/tools/phabricator/phabricator/webroot;
    client_max_body_size 32M;

    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;
    }
}

Configure mysql and storage:

Add these new lines to /etc/mysql/mysql.conf.d/mysqld.cnf under the [mysqld] heading:

sql_mode = STRICT_ALL_TABLES

This new line should be about 40% of the memory of the box:

innodb_buffer_pool_size = 400M

And also adjust max_allowed_packet to 32M (this line will already exist)

max_allowed_packet = 32M

Restart mysql and run phabricator storage upgrade:

sudo service mysql restart
sudo service php7.1-fpm stop
/home/ubuntu/tools/phabricator/phabricator/bin/storage upgrade

Configure php:

Adjust the following fields in /etc/php/7.1/fpm/php.ini

post_max_size = 32M
date.timezone = Asia/Ho_Chi_Minh
opcache.validate_timestamps = 0
memory_limit = -1
upload_max_filesize = 32MB

Config /etc/php/7.1/fpm/pool.d/www.conf

listen = 9000

Then restart apache

sudo service apache2 restart

Restart phd daemons and nginx:

/home/ubuntu/tools/phabricator/phabricator/bin/phd restart
sudo service php7.1-fpm restart
sudo service nginx restart

Refer to the phabricator configuration guide for next steps:

Also see the official Phabricator Configuration Guide for additional advanced configuration steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment