Phabricator Docker 一鍵安裝及漢化

Phabricator的安裝還是挺麻煩的、又有數據庫、又有Nginx。有沒有已經做好了的Docker鏡像直接使用?答案肯定是有的。

依賴

安裝

下載docker-compose.yml文件

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

修改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:2019'
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - 'phabricator_data:/bitnami'
      - '/root/docker/my_vhost.conf:/opt/bitnami/apache/conf/vhosts/my_vhost.conf'
    environment:
      - PHABRICATOR_PASSWORD=Abc123456
    # 可選配置...
    depends_on:
      - mariadb
volumes:
  mariadb_data:
    driver: local
  phabricator_data:
    driver: local

my_vhost.conf文件

<VirtualHost *:80>
  ServerName localhost
  # 可以修改爲域名或者IP
  DocumentRoot "/opt/bitnami/phabricator/webroot"
  <Directory "/opt/bitnami/phabricator/webroot">
    Options Indexes FollowSymLinks Includes execCGI
    AllowOverride All
    Require all granted
  </Directory>
   RewriteEngine on
  RewriteRule ^/rsrc/(.*)     -                       [L,QSA]
  RewriteRule ^/favicon.ico   -                       [L,QSA]
  RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]
</VirtualHost>

啓動

docker-compose up -d

啓動登錄 http://localhost 會出現如下類似錯誤

Site Not Found

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

登錄容器添加配置

docker exec -ti docker_phabricator_1 bash
/opt/bitnami/phabricator/bin/config set phabricator.base-uri 'http://localhost'

重啓即可

docker-compose restart

可選配置

  • PHABRICATOR_HOST:Phabricator主機名。默認值:127.0.0.1
  • PHABRICATOR_USERNAME:Phabricator應用程序的用戶名。默認值:user
  • PHABRICATOR_PASSWORD:Phabricator應用程序密碼。默認值:bitnami1
  • PHABRICATOR_EMAIL:Phabricator應用程序電子郵件。默認值:[email protected]
  • 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

中文漢化

進行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

語言頁面設置
http://localhost/settings/user/user/page/language/saved

選擇Chinese(Simplified)保存即可

郵件配置

  1. 登錄phabricator窗口

2.配置發送來源

bin/config set metamta.default-address [email protected]
  1. 配置smtp

創建mailers.json文件

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

導入配置

config set cluster.mailers --stdin < mailers.json

發送郵件測試

bin/mail send-test --to [email protected] --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       443 ssl;
    server_name  pha.example.com;
    ssl_certificate /etc/nginx/conf.d/ssl/example.com.pem;
    ssl_certificate_key /etc/nginx/conf.d/ssl/example.com.key;

    location / {
        proxy_pass https://pha.example.com:8002;
	    proxy_set_header Upgrade $http_upgrade;
	    proxy_set_header Connection "upgrade";
    }
}
server {
    listen 80;
    server_name pha.example.com;
    rewrite ^(.*)$ https://$host$1 permanent;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章