0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Phabricator] Installation Guide with Docker

Posted at

Phabricator

Facebook的opensource專案
它是軟體開發協同作業的工具集合包
包含以下:

  • Arcanist: CLI
  • Diffusion: repository browser可整合GitHub, GitLab等
  • Differential: pre-push code review
  • Audit: post-push code review
  • ...

詳見phabricator on GitHub
以下介紹如何安裝至本機並搭配docker建制環境
至於有興趣的使用者可以試著更進一步使用docker-compose撰寫更容易建制環境的方式

Installation Requirements

  • nginx
  • php-fpm(required "php-mysql" extensions)
  • MySQL
$ mkdir <work_dir>
$ cd <work_dir>
$ git clone https://github.com/phacility/libphutil.git
$ git clone https://github.com/phacility/arcanist.git
$ git clone https://github.com/phacility/phabricator.git

Configuration

MySql

pull mysql docker image and run it

$ docker run --name local-mysql -v <volume>/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=<mysql_root_password> -p 3306:3306 -d mysql

php-fpm

get php5-fpm-mysql dockerfile and build image

$ git clone https://github.com/Jim-Lin/php5-fpm-mysql.git
$ cd php5-fpm-mysql
$ docker build -t php:5-fpm-mysql .

當php:5-fpm-mysql image build完成之後, run image

$ docker run --name local-fpm --link local-mysql:db -p 9000:9000 -v <work_dir>:/path/to -d php:5-fpm-mysql

其中work_dir mount to /path/to會在接下來的nginx段落說明

nginx

首先建立default.conf

server {
  root        /path/to/phabricator/webroot;

  location / {
    index index.php;
    rewrite ^/(.*)$ /index.php?__path__=/$1 last;
  }

  location = /favicon.ico {
    try_files $uri =204;
  }

  location /index.php {
    fastcgi_pass   fpm: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;
  }
}

  • root: /path/to/對應到前面run php-fpm image的work_dir
  • fastcgi_pass: fpm:9000是之後run nginx image link到local-fpm的別名
$ docker run --name local-nginx --link local-fpm:fpm -p 80:80 -p 443:443 -v <volume>/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro -d nginx

Setup

進入local-fpm container中

$ docker exec -it local-fpm bash

進入之後執行storage upgrade

$ cd /path/to/phabricator
$ ./bin/storage upgrade --user root --password <mysql_root_password>

upgrade期間會要求設定

$ ./bin/config set mysql.host db
$ ./bin/config set mysql.user root
$ ./bin/config set mysql.pass <mysql_root_password>
$ ./bin/config set mysql.port <mysql_port>
  • host: 請填container已經link到local-mysql的別名db
  • port: 預設不填是3306

upgrade之後
in your browser go to http://127.0.0.1

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?