├── .dockerignore ├── Dockerfile ├── README.md ├── database ├── Dockerfile ├── download.sh ├── my-phabricator.cnf └── setup.sh ├── docker-compose.yml ├── download.sh ├── entrypoint.sh ├── local.json └── phabricator.conf /.dockerignore: -------------------------------------------------------------------------------- 1 | database 2 | phabricator 3 | arc 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Docker image for running https://github.com/phacility/phabricator 3 | # 4 | 5 | FROM debian:jessie 6 | MAINTAINER Yvonnick Esnault 7 | 8 | ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true 9 | 10 | # TODO: review this dependency list 11 | RUN apt-get clean && apt-get update && apt-get install -y \ 12 | git \ 13 | apache2 \ 14 | curl \ 15 | libapache2-mod-php5 \ 16 | libmysqlclient18 \ 17 | mercurial \ 18 | mysql-client \ 19 | php-apc \ 20 | php5 \ 21 | php5-apcu \ 22 | php5-cli \ 23 | php5-curl \ 24 | php5-gd \ 25 | php5-json \ 26 | php5-ldap \ 27 | php5-mysql \ 28 | python-pygments \ 29 | sendmail \ 30 | subversion \ 31 | tar \ 32 | sudo \ 33 | && apt-get clean && rm -rf /var/lib/apt/lists/* 34 | 35 | # For some reason phabricator doesn't have tagged releases. To support 36 | # repeatable builds use the latest SHA 37 | ADD download.sh /opt/download.sh 38 | 39 | ARG PHABRICATOR_COMMIT=79f2e81f38 40 | ARG ARCANIST_COMMIT=c304c4e045 41 | ARG LIBPHUTIL_COMMIT=55f554b618 42 | 43 | WORKDIR /opt 44 | RUN bash download.sh phabricator $PHABRICATOR_COMMIT 45 | RUN bash download.sh arcanist $ARCANIST_COMMIT 46 | RUN bash download.sh libphutil $LIBPHUTIL_COMMIT 47 | 48 | # Setup apache 49 | RUN a2enmod rewrite 50 | ADD phabricator.conf /etc/apache2/sites-available/phabricator.conf 51 | RUN ln -s /etc/apache2/sites-available/phabricator.conf \ 52 | /etc/apache2/sites-enabled/phabricator.conf && \ 53 | rm -f /etc/apache2/sites-enabled/000-default.conf 54 | 55 | # Setup phabricator 56 | RUN mkdir -p /opt/phabricator/conf/local /var/repo 57 | ADD local.json /opt/phabricator/conf/local/local.json 58 | RUN sed -e 's/post_max_size =.*/post_max_size = 32M/' \ 59 | -e 's/upload_max_filesize =.*/upload_max_filesize = 32M/' \ 60 | -e 's/;opcache.validate_timestamps=.*/opcache.validate_timestamps=0/' \ 61 | -i /etc/php5/apache2/php.ini 62 | RUN ln -s /usr/lib/git-core/git-http-backend /opt/phabricator/support/bin 63 | RUN /opt/phabricator/bin/config set phd.user "root" 64 | RUN echo "www-data ALL=(ALL) SETENV: NOPASSWD: /opt/phabricator/support/bin/git-http-backend" >> /etc/sudoers 65 | 66 | EXPOSE 80 67 | ADD entrypoint.sh /entrypoint.sh 68 | ENTRYPOINT ["/entrypoint.sh"] 69 | CMD ["start-server"] 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | docker-phabricator 2 | ================== 3 | 4 | **THIS IMAGE IS UNMAINTAINED** 5 | 6 | *If you want to use it, please update https://github.com/yesnault/docker-phabricator/blob/master/Dockerfile#L39 before docker build it.* 7 | 8 | A docker composition for Phabricator : 9 | - One container used by mysql, see https://github.com/yesnault/docker-phabricator/tree/master/database 10 | - One container used by apache (phabricator) 11 | 12 | Run with image from hub.docker.com - OUTDATED - NOT RECOMMANDED 13 | ---- 14 | Run a mysql container : 15 | ``` 16 | docker run --name databasePhabricator yesnault/docker-phabricator-mysql 17 | ``` 18 | 19 | Run phabricator : 20 | ``` 21 | docker run -p 8081:80 --link databasePhabricator:database yesnault/docker-phabricator 22 | ``` 23 | Go to http://localhost:8081 24 | -------------------------------------------------------------------------------- /database/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Docker image for the phabricator database 3 | # 4 | 5 | FROM debian:jessie 6 | MAINTAINER Yvonnick Esnault 7 | 8 | ENV DEBIAN_FRONTEND noninteractive 9 | ENV DEBCONF_NONINTERACTIVE_SEEN true 10 | 11 | RUN apt-get update && apt-get install -y \ 12 | curl \ 13 | mysql-server 14 | 15 | RUN sed -i -e "s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" \ 16 | /etc/mysql/my.cnf 17 | ADD my-phabricator.cnf /etc/mysql/conf.d/my-phabricator.cnf 18 | 19 | ADD download.sh /opt/mysql/download.sh 20 | RUN bash /opt/mysql/download.sh 21 | 22 | ADD setup.sh /opt/mysql/setup.sh 23 | RUN bash /opt/mysql/setup.sh 24 | 25 | VOLUME ["/var/lib/mysql"] 26 | CMD mysqld_safe 27 | -------------------------------------------------------------------------------- /database/download.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | # 3 | # Download files required to boostrap the mysql database 4 | # 5 | 6 | set -eu 7 | set -o pipefail 8 | 9 | # This should match the pinned version of the webapp 10 | PHABRICATOR_VERSION=5aca529980 11 | BASE_URL=https://raw.githubusercontent.com/phacility/phabricator/${PHABRICATOR_VERSION}/resources/sql/ 12 | 13 | mkdir -p /opt/phabricator/resources/sql/ 14 | cd /opt/phabricator/resources/sql/ 15 | 16 | curl -L -o stopwords.txt ${BASE_URL}/stopwords.txt 17 | curl -L -o quickstart.sql ${BASE_URL}/quickstart.sql 18 | 19 | # Render template `quickstart.sql`. Reproduced from 20 | # src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php 21 | sed -i -e 's/{$CHARSET}/utf8mb4/g' quickstart.sql 22 | sed -i -e 's/{$CHARSET_SORT}/utf8mb4/g' quickstart.sql 23 | sed -i -e 's/{$CHARSET_FULLTEXT}/utf8mb4/g' quickstart.sql 24 | sed -i -e 's/{$COLLATE_TEXT}/utf8mb4_bin/g' quickstart.sql 25 | sed -i -e 's/{$COLLATE_SORT}/utf8mb4_unicode_ci/g' quickstart.sql 26 | sed -i -e 's/{$COLLATE_FULLTEXT}/utf8mb4_unicode_ci/g' quickstart.sql 27 | sed -i -e 's/{$NAMESPACE}/default/g' quickstart.sql 28 | -------------------------------------------------------------------------------- /database/my-phabricator.cnf: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # * Phabricator specific settings 4 | # 5 | [mysqld] 6 | sql_mode=STRICT_ALL_TABLES 7 | ft_stopword_file=/opt/phabricator/resources/sql/stopwords.txt 8 | ft_min_word_len=3 9 | innodb_buffer_pool_size=410M 10 | ft_boolean_syntax=' |-><()~*:""&^' 11 | max_allowed_packet=33554432 12 | -------------------------------------------------------------------------------- /database/setup.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | # 3 | # Set up the mysql database with tables and users 4 | # 5 | 6 | set -eu 7 | set -o pipefail 8 | 9 | echo "init mysql admin user" 10 | mysql_install_db 11 | mysqld_safe & 12 | # TODO: replace sleep with polling 13 | sleep 10s 14 | 15 | echo "GRANT ALL ON *.* TO admin@'%' IDENTIFIED BY 'admin' WITH GRANT OPTION; FLUSH PRIVILEGES" | mysql 16 | cat /opt/phabricator/resources/sql/quickstart.sql | mysql 17 | 18 | # TODO: create a default admin account 19 | # TODO: address setup issues described in /config/issue/ 20 | 21 | pkill -f mysqld 22 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Optional Volumes: 4 | # - /opt/phabricator/conf - configuration 5 | # - /var/repo - code repos 6 | # 7 | # 8 | phabricator: 9 | build: . 10 | links: ['database'] 11 | ports: ['8081:80'] 12 | 13 | 14 | database: 15 | build: database/ 16 | -------------------------------------------------------------------------------- /download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | package=$1 6 | sha=$2 7 | 8 | curl -L https://github.com/phacility/${package}/archive/${sha}.tar.gz | tar -xzf - 9 | # The archive contains a directory with the sha, move it to a path without it 10 | mv $package-$sha* $package 11 | 12 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "${LOCAL_JSON}" ]; then 4 | [ -z "${MYSQL_HOST}" ] && export MYSQL_HOST="database" 5 | [ -z "${MYSQL_USER}" ] && export MYSQL_USER="admin" 6 | [ -z "${MYSQL_PASS}" ] && export MYSQL_PASS="admin" 7 | 8 | # Patching the settings file. 9 | sed -e "s/{{MYSQL_HOST}}/${MYSQL_HOST}/g" \ 10 | -e "s/{{MYSQL_USER}}/${MYSQL_USER}/g" \ 11 | -e "s/{{MYSQL_PASS}}/${MYSQL_PASS}/g" \ 12 | -i /opt/phabricator/conf/local/local.json 13 | else 14 | echo "${LOCAL_JSON}" > /opt/phabricator/conf/local/local.json 15 | fi 16 | 17 | if [ "${1}" = "start-server" ]; then 18 | exec bash -c "/opt/phabricator/bin/storage upgrade --force; /opt/phabricator/bin/phd start; source /etc/apache2/envvars; /usr/sbin/apache2 -DFOREGROUND" 19 | else 20 | exec $@ 21 | fi 22 | -------------------------------------------------------------------------------- /local.json: -------------------------------------------------------------------------------- 1 | { 2 | "storage.default-namespace": "default", 3 | "mysql.host": "{{MYSQL_HOST}}", 4 | "mysql.user": "{{MYSQL_USER}}", 5 | "mysql.pass": "{{MYSQL_PASS}}", 6 | "pygments.enabled": true 7 | } 8 | -------------------------------------------------------------------------------- /phabricator.conf: -------------------------------------------------------------------------------- 1 | 2 | # Make sure you include "/webroot" at the end! 3 | DocumentRoot /opt/phabricator/webroot 4 | 5 | RewriteEngine on 6 | RewriteRule ^/rsrc/(.*) - [L,QSA] 7 | RewriteRule ^/favicon.ico - [L,QSA] 8 | RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] 9 | 10 | 11 | 12 | Options FollowSymLinks 13 | AllowOverride None 14 | Require all granted 15 | 16 | --------------------------------------------------------------------------------