Page MenuHomePhorge

No OneTemporary

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f0979ab
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+arcanist
+phabricator
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..4edb1ee
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,44 @@
+FROM ubuntu:22.04
+
+RUN apt-get update && \
+ apt-get upgrade -y
+
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt-get install -y sudo netcat-traditional iputils-ping git nginx mariadb-client ca-certificates software-properties-common apt-transport-https && \
+ add-apt-repository -y ppa:ondrej/php && \
+ apt-get update && \
+ apt-get install -y php7.4 php7.4-fpm php7.4-mysql php7.4-gd php7.4-curl php7.4-apcu php7.4-cli php7.4-mbstring php7.4-zip php7.4-xdebug php7.4-iconv
+
+ADD ./docker-context/nginx.conf /etc/nginx/
+ADD ./docker-context/phab.conf /etc/nginx/conf.d/
+
+# Allow www-data (entrypoint) to sudo as root to run nginx
+RUN echo "www-data ALL=(root) NOPASSWD: /usr/sbin/nginx" >> /etc/sudoers && \
+ echo "www-data ALL=(root) NOPASSWD: /usr/sbin/php-fpm7.4" >> /etc/sudoers && \
+ echo "www-data ALL=(phab-phd) NOPASSWD: ALL" >> /etc/sudoers && \
+ echo "phab-phd ALL=(root) NOPASSWD: ALL" >> /etc/sudoers
+
+RUN useradd --system phab-phd && \
+ groupadd phab && \
+ usermod -a -G phab phab-phd && \
+ usermod -a -G phab www-data
+
+RUN mkdir -p /opt/phabdev/ && \
+ mkdir -p /opt/filestore && \
+ mkdir -p /opt/repos && \
+ mkdir -p /var/log/phabricator && \
+ mkdir -p /run/php/
+
+RUN chown -R phab-phd:phab /opt/ && \
+ chown -R www-data:phab /var/log/phabricator/ && \
+ chmod -R g+rw /opt/ && \
+ chmod -R g+rw /var/log/phabricator/
+
+# Run entrypoint as the web service account
+USER www-data
+
+ADD ./docker-context/local.json /opt/phabdev
+ADD ./docker-context/entrypoint.sh /opt/phabdev
+
+ENTRYPOINT ["/opt/phabdev/entrypoint.sh"]
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..51022e6
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,46 @@
+version: "3.2"
+
+services:
+ phabdev-db:
+ container_name: phabdev-db
+ image: mariadb
+ restart: always
+ environment:
+ - MARIADB_ROOT_PASSWORD=phabricator_secret
+ networks:
+ - phabnet
+ volumes:
+ - db-data:/var/lib/mysql
+
+ phabricator:
+ container_name: phabdev
+ build: .
+ restart: "no"
+ networks:
+ - phabnet
+ volumes:
+ - ./phabricator:/var/www/phabricator/
+ - ./arcanist:/var/www/arcanist/
+ - filestore:/opt/filestore/
+ - repos:/opt/repos/
+ ports:
+ - "8080:80"
+
+networks:
+ phabnet:
+
+volumes:
+ db-data:
+ name: "phabdev-db"
+ external: false
+ driver: local
+
+ filestore:
+ name: "phabdev-filestore"
+ external: false
+ driver: local
+
+ repos:
+ name: "phabdev-repos"
+ external: false
+ driver: local
diff --git a/docker-context/entrypoint.sh b/docker-context/entrypoint.sh
new file mode 100755
index 0000000..acfba29
--- /dev/null
+++ b/docker-context/entrypoint.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+installdir=/var/www/phabricator
+
+# The install directory is mapped to a local folder. Only copy this default config
+# over if there isn't one already, otherwise use the one that's there.
+if [[ ! -f "$installdir/conf/local.json" ]]; then
+ mv /opt/phabdev/local.json $installdir/conf/local/
+fi
+
+# Wait for mysql
+while ! nc -z phabdev-db 3306 2>/dev/null
+do
+ sleep 0.1
+done
+
+mariadb --host=phabdev-db --user=root --password=phabricator_secret --execute="GRANT ALL PRIVILEGES ON *.* TO 'phabricator'@'%' IDENTIFIED BY 'phabricator' WITH GRANT OPTION;"
+
+$installdir/bin/storage upgrade --force
+
+sudo -u phab-phd $installdir/bin/phd start
+
+sudo php-fpm7.4 --daemonize
+
+echo "Starting web server on http://localhost:8080 ..."
+exec sudo nginx
+
diff --git a/docker-context/local.json b/docker-context/local.json
new file mode 100644
index 0000000..633cc0f
--- /dev/null
+++ b/docker-context/local.json
@@ -0,0 +1,12 @@
+{
+ "phabricator.silent": true,
+ "log.access.path": "/var/log/phabricator/access.log",
+ "repository.default-local-path": "/opt/repos",
+ "storage.default-namespace": "phabricator",
+ "mysql.pass": "phabricator",
+ "mysql.user": "phabricator",
+ "mysql.host": "phabdev-db",
+ "storage.local-disk.path": "/opt/filestore",
+ "phd.user": "phab-phd",
+ "phabricator.base-uri": "http://phabricator.dev"
+}
diff --git a/docker-context/nginx.conf b/docker-context/nginx.conf
new file mode 100644
index 0000000..30fc097
--- /dev/null
+++ b/docker-context/nginx.conf
@@ -0,0 +1,32 @@
+user www-data;
+worker_processes auto;
+pid /run/nginx.pid;
+daemon off;
+include /etc/nginx/modules-enabled/*.conf;
+
+
+error_log /var/log/nginx/error.log;
+error_log /var/log/nginx/error.log notice;
+error_log /var/log/nginx/error.log info;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
+
+ access_log /var/log/nginx/access.log main;
+
+ sendfile on;
+ keepalive_timeout 65;
+ index index.html index.htm;
+
+ include /etc/nginx/conf.d/*.conf;
+}
+
diff --git a/docker-context/phab.conf b/docker-context/phab.conf
new file mode 100644
index 0000000..5f1209a
--- /dev/null
+++ b/docker-context/phab.conf
@@ -0,0 +1,42 @@
+# redirect all traffic to https
+server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+ server_name phabricator.dev;
+ root /var/www/phabricator/webroot;
+
+ client_max_body_size 512m;
+
+ location / {
+ index index.php;
+ rewrite ^/(.*)$ /index.php?__path__=/$1 last;
+ }
+
+ location = /favicon.ico {
+ try_files $uri =204;
+ }
+
+ location /index.php {
+ # php-fpm is configured to host on port 9000 for the cgi proxy
+ fastcgi_pass 127.0.0.1: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;
+
+ fastcgi_param HTTPS false;
+ }
+}
+
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..cd13bae
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,15 @@
+A docker-compose configuration for running a phabricator server for development
+
+## Setup
+1. Clone this repository
+2. Symlink `phabricator` and `arcanist` inside the repo folder
+```
+$ ln -s ../phabricator phabricator
+$ ln -s ../arcanist arcanist
+```
+3. Start the containers
+```
+$ docker-compose up
+```
+4. Navigate to `http://localhost:8080`
+

File Metadata

Mime Type
text/x-diff
Expires
Jan 19 2025, 22:43 (6 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129515
Default Alt Text
(7 KB)

Event Timeline