# deepin配置phabricator[linux][deb][局域网可用]

袁亦
2023-12-01

局域网内配置phabricator[linux][deb]

Step1 安装文件

https://bitnami.com/stack/phabricator/installer

step2 一路点击安装后

浏览器输入: 127.0.0.1:8080,应该可以看到phab的界面啦,进入后左上角有一些感叹号,提示你哪些还没有配置

step3 开始按照如下文档配置

https://secure.phabricator.com/book/phabricator/article/configuration_guide/
其中webserver这一部分不需要配置

# 可以停止系统的webserver,避免干扰自己的webserver      
sudo apache2ctl stop

step4 接着用phab来host你打项目然后配置uri

请仔细阅读如下内容:(如果遇到问题可以看文章末尾我遇到打问题)
https://secure.phabricator.com/book/phabricator/article/diffusion_uris/

下面是一些我的配置,仅供参考

1 配置sudo

vim /etc/sudoers
(当然首先需要添加git用户)

部分内容如下:
# See sudoers(5) for more information on "#include" directives:

git ALL=(ALL:ALL) ALL
git ALL=(nash5) SETENV: NOPASSWD: ALL

#includedir /etc/sudoers.d

git ALL=(nash5) SETENV: NOPASSWD: /home/nash5/Softwares/bitnamiLocalPhab/git/bin/git, /home/nash5/Softwares/bitnamiLocalPhab/git/libexec/git-core/git-http-backend, /home/nash5/Softwares/bitnamiLocalPhab/apps/phabricator/arcanist/support/hg, /home/nash5/Softwares/bitnamiLocalPhab/git/bin/git-receiv-pack, /usr/bin/ssh

2 sshd配置:

主要配置这两个文件:

  • 1 sshd_config.phabricator
nash5@nash5:~/tmp/t3$ cat /etc/ssh/sshd_config.phabricator 
# NOTE: You must have OpenSSHD 6.2 or newer; support for AuthorizedKeysCommand
# was added in this version.

# NOTE: Edit these to the correct values for your setup.

AuthorizedKeysCommand /usr/libexec/phabricator-ssh-hook.sh
AuthorizedKeysCommandUser git
AllowUsers git 

# You may need to tweak these options, but mostly they just turn off everything
# dangerous.

Port 2333
Protocol 2
PermitRootLogin no
AllowAgentForwarding no
AllowTcpForwarding no
PrintMotd no
PrintLastLog no
PasswordAuthentication no
ChallengeResponseAuthentication no
AuthorizedKeysFile none

PidFile /var/run/sshd-phabricator.pid
  • 2 hook:
nash5@nash5:~/tmp/t3$ cat /usr/libexec/phabricator-ssh-hook.sh 
#!/bin/sh

# NOTE: Replace this with the username that you expect users to connect with.
VCSUSER="git"

# NOTE: Replace this with the path to your Phabricator directory.
ROOT="/home/nash5/Softwares/bitnamiLocalPhab/apps/phabricator/htdocs"

if [ "$1" != "$VCSUSER" ];
then
  exit 1
fi

exec "$ROOT/bin/ssh-auth" $@

3 我的phab的config的local.json文件(bin/config -set … 就是在写入这个文件)

务必注意: “phabricator.base-uri”: "host:port"
位于: /home/nash5/Softwares/bitnamiLocalPhab/apps/phabricator/htdocs

{
  "phabricator.base-uri": "host:port",
  "diffusion.ssh-port": 2333,
  "diffusion.allow-http-auth": true,
  "diffusion.ssh-user": "git",
  "phd.user": "nash5",
  "config.ignore-issues": {
    "config.PATH.d81cdb9c": true,
    "config.PATH.fb540170": true,
    "config.PATH.17241315": true,
    "mysql.mode": true,
    "mysql.ft_stopword_file": true,
    "mysql.ft_min_word_len": true,
    "mysql.innodb_buffer_pool_size": true,
    "mysql.utf8mb4": true,
    "extension.apc.stat-enabled": true,
    "mysql.ft_boolean_syntax": true,
    "mysql.max_allowed_packet": true,
    "pygments.noenabled": true,
    "extension.apcu": true,
    "extension.opcache.production": true,
    "security.security.alternate-file-domain": true
  },
  "security.hmac-key": "5939c2be8eea1e37821723324e2330271eeec5b1c78b",
  "storage.mysql-engine.max-size": 8388608,
  "mysql.pass": "233b233c20",
  "mysql.user": "bn_phabricator",
  "mysql.port": "3306",
  "mysql.host": "localhost",
  "repository.default-local-path": "/home/nash5/Softwares/bitnamiLocalPhab/apps/phabricator/repo",
  "storage.default-namespace": "bitnami_phabricator",
  "phd.log-directory": "/home/nash5/Softwares/bitnamiLocalPhab/apps/phabricator/tmp/phd/log"
}

setp5 配置自动开机

deepin: 开机自动启动:(在如下位置产生如下文件 权限记得改)

nash5@nash5:~$ cat ~/.config/autostart/phab.desktop 
[Desktop Entry]
Icon=/home/nash5/Softwares/bitnamiLocalPhab/apps/phabricator/htdocs/webroot/rsrc/image/logo/light-eye.png
Exec=/home/nash5/Softwares/bitnamiLocalPhab/phabAutoStart.sh
Type=Application
hidden=true
NoDisplay=false
X-Deepin-CreatedBy=com.deepin.SessionManager
X-Deepin-AppID=phab
Hidden=false

nash5@nash5:~$ cat /home/nash5/Softwares/bitnamiLocalPhab/phabAutoStart.sh
#!/bin/bash

#开启sshd
/usr/sbin/sshd -f /etc/ssh/sshd_config.phabricator

# 运行phab的启动脚本
sh /home/nash5/Softwares/bitnamiLocalPhab/ctlscript.sh start

你可能会用到的命令

netstat nlt | grep 8080

sudo journalctl -f # 可以查看sshd服务的日志

重启整个服务

nash5@nash5:~/Softwares/bitnamiLocalPhab$ sh ctlscript.sh -h\
> 
usage: ctlscript.sh help
       ctlscript.sh (start|stop|restart|status)
       ctlscript.sh (start|stop|restart|status) mysql
       ctlscript.sh (start|stop|restart|status) apache
       ctlscript.sh (start|stop|restart|status) phabricator

help       - this screen
start      - start the service(s)
stop       - stop  the service(s)
restart    - restart or start the service(s)
status     - show the status of the service(s)

问题解决:

1 如果你git clone出现 connection refused:

sudo journalctl -f # 可以查看sshd服务的日志,根据报错来解决问题

2 如果你用别的机器访问出现: This request asked for “/” on host “222.20.76.124”, but no site is configured which can serve this request.

修改phab的base-uri即可:
/home/nash5/Softwares/bitnamiLocalPhab/apps/phabricator/htdocs/conf/local/local.json

3 如果你出现git:sudo password needed

尝试:visudo中添加:

git ALL=(nash5) SETENV: NOPASSWD: ALL

欢迎评论区一起交流~

 类似资料: