docker bitnami/phabricator

安装

$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-phabricator/master/docker-compose.yml > docker-compose.yml
$ docker-compose up --build -d

docker-compose.yml

version: '2'
services:
  mariadb:
    image: 'bitnami/mariadb:10.3'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_EXTRA_FLAGS=--local-infile=0
    volumes:
      - 'mariadb_data:/bitnami'
  phabricator:
    image: 'bitnami/phabricator:2020'
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - 'phabricator_data:/bitnami'
    depends_on:
      - mariadb
volumes:
  mariadb_data:
    driver: local
  phabricator_data:
    driver: local

修改后的 docker-compose.yml

version: '3.7'
services:
  phabricator:
    image: 'bitnami/phabricator:latest'
    ports:
      - '8080:80'
      - '8443:443'
      - '22:22'
      - '223:222'
    volumes:
      - 'phabricator_data:/bitnami'
      - './zh_cn/:/opt/bitnami/phabricator/src/extensions/'
    environment:
      - MARIADB_USER=root
      - MARIADB_PASSWORD=pilot123
      - MARIADB_HOST=172.17.0.1
      - MARIADB_PORT_NUMBER=3377
      - PHABRICATOR_HOST=172.17.0.1
      - PHABRICATOR_USERNAME=admin
      - PHABRICATOR_PASSWORD=password
      - PHABRICATOR_EMAIL=xyzla@xyzla.com
      - PHABRICATOR_FIRSTNAME=admin
      - PHABRICATOR_LASTNAME=admin
      - PHABRICATOR_USE_LFS=yes
      - PHABRICATOR_SSH_PORT_NUMBER=22
      - PHABRICATOR_ENABLE_GIT_SSH_REPOSITORY=yes
volumes:
  phabricator_data:
    driver: local

启动登录 http://dev.qqghp.com 会出现如下类似错误

Site Not Found

This request asked for "/" on host "dev.qqghp.com", but no site is configured which can serve this request.

登录容器 添加 配置

docker exec -it docker-id bash
/opt/bitnami/phabricator/bin/config set phabricator.base-uri 'https://dev.xyzla.com'

重启即可

docker-compose restart

可选配置

  • PHABRICATOR_HOST:Phabricator主机名。默认值:127.0.0.1
  • PHABRICATOR_USERNAME:Phabricator应用程序的用户名。默认值:user
  • PHABRICATOR_PASSWORD:Phabricator应用程序密码。默认值:bitnami1
  • PHABRICATOR_EMAIL:Phabricator应用程序电子邮件。默认值:user@example.com
  • PHABRICATOR_FIRSTNAME:Phabricator用户的名字。默认值:FirstName
  • PHABRICATOR_LASTNAME:Phabricator用户的姓氏。默认值: LastName
  • PHABRICATOR_ALTERNATE_FILE_DOMAIN:Phabricator文件域
  • PHABRICATOR_USE_LFS:将Phabricator配置为使用Git LFS。默认值:no
  • PHABRICATOR_SSH_PORT_NUMBER:SSH服务器端口。默认值:22
  • PHABRICATOR_ENABLE_GIT_SSH_REPOSITORY:使用SSH身份验证配置自托管的GIT存储库。默认值:no
  • MARIADB_USER:MariaDB数据库的根用户。默认值:root
  • MARIADB_PASSWORD:MariaDB的根密码
  • MARIADB_HOST:MariaDB服务器的主机名。默认值:mariadb
  • MARIADB_PORT_NUMBER:MariaDB服务器使用的端口。默认值:3306

中文汉化

github - arielyang/phabricator_zh_Hans

进行phabricator容器

docker exec -ti docker_phabricator_1 bash
cd /opt/bitnami/phabricator/src/extensions
curl -O https://raw.githubusercontent.com/arielyang/phabricator_zh_Hans/master/dist/PhabricatorSimplifiedChineseTranslation.php

curl -D https://github.com/arielyang/phabricator_zh_Hans/blob/master/dist/(stable)%20Promote%202019%20Week%2050/PhabricatorSimplifiedChineseTranslation.php

语言页面设置, 选择 Chinese(Simplified) 保存即可

https://dev.xyzla.com/settings/user/user/page/language/saved

https://dev.xyzla.com/settings/user/admin/page/language/saved

邮件配置

  1. 登录 phabricator shell
docker exec -ti docker_phabricator_1 bash
  1. 配置发送来源
/opt/bitnami/phabricator/bin/config set metamta.default-address noreply@xyzla.com
  1. 配置 smtp

创建mailers.json文件

cat <<EOF > mailers.json
[
  {
    "key": "stmp-mailer",
    "type": "smtp",
    "options": {
      "host": "smtp.exmail.qq.com",
      "port": 465,
      "user": "noreply@xyzla.com",
      "password": "password",
      "protocol": "ssl"
    }
  }
]
EOF

导入配置

/opt/bitnami/phabricator/bin/config set cluster.mailers --stdin < mailers.json

发送邮件测试

/opt/bitnami/phabricator/bin/mail send-test --to xyzla@xyzla.com --subject hello < mailers.json

bin/mail send-test --to noreply@example.com --subject hello < mailers.json
Reading message body from stdin...
Mail sent! You can view details by running this command:

    phabricator/ $ ./bin/mail show-outbound --id 27

HTTPS设置

登录容器

设置允许使用https

config set security.require-https true

nginx转发配置

server {
   listen       80;
   server_name  dev.xyzla.com;
   return      301 https://$server_name$request_uri;      #http重定向到https,这是nginx最新支持的写法
   #rewrite ^(.*) https://$server_name$1 permanent;
}

server {
    listen 443 ssl;
    server_name dev.xyzla.com;

    location / {
          proxy_redirect off;  
          proxy_set_header Host $host;  
          proxy_set_header X-Forwarded-Host $host;  
          proxy_set_header X-Forwarded-Server $host;  
          proxy_set_header X-Real-IP $remote_addr;  
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
          proxy_buffering on;  
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
          proxy_pass http://172.17.0.1:8080;
    }


    ssl_certificate /etc/nginx/conf.d/ssl/dev.xyzla.com.pem;
    ssl_certificate_key /etc/nginx/conf.d/ssl/dev.xyzla.com.key;
    # Enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access_manage.log main;
}
sed -i 's/#Port 22/Port 2222/' /etc/ssh/sshd_config 
sudo service ssh restart

参考

  1. github - bitnami/bitnami-docker-phabricator
  2. github - philpep/docker-phabricator
  3. Phabricator Docker 一键安装及汉化