一直对Reviewboard有犹豫,是因为它有一个很大的缺点,就是没有很好地集成统计功能,或者确切地说,就是类似bugzilla那样的report生成功能。这个对于代码质量跟踪是一个很大的缺点。
一个发现
在看reviewboard的时候,发现他们自己的code review用的就是reviewboard,尤其令我感到惊喜的,就是有“report”这个功能。
这个正是我一直关注的ReviewBoard3.0.x上所没有的。于是就激发了我尝试一下4.0-RC版本的冲动。
部署
- 还是老套路,启动一个干净的Docker,准备把Reviewboard/DB/memcached都装在上面
- 经过了多次尝试,有一个基本的认知,就是要部署4.0-RC,一定要抛弃python2.7,只走python3的康庄大道
过程记录
- 先启动一个Ubuntu20.10的docker
docker run -itd --name reviewboard_4.0 --privileged=true ubuntu:20.10
- 进入docker,直接就是root,安装一堆软件,不要装python2
apt update -y
apt install python3-pip vim net-tools -y
apt install apache2 apache2-dev memcached -y
apt-get install postgresql-12 -y
apt-get install libapache2-mod-wsgi-py3 -y
- 版本控制的软件按需安装
apt-get install git-core -y
apt-get install subversion python3-svn -y
- 安装python包
pip3 install --upgrade setuptools
pip3 install --upgrade pip
pip3 install mod_wsgi
- 安装Reviewboard4.0-RC
pip3 install \
--trusted-host downloads.reviewboard.org \
-f http://downloads.reviewboard.org/releases/ReviewBoard/4.0/ \
-f http://downloads.reviewboard.org/releases/rbintegrations/2.0/ \
--pre -U ReviewBoard
# pip3 list | grep ReviewBoard
ReviewBoard 4.0rc2
- 安装连接postgres数据口的支持
pip3 install -U 'ReviewBoard[postgres]'
- 启动postgres,创建数据库/用户名/密码,都是reviewboard
root@69991d4b808b:/# service postgresql start
[ OK ]rting PostgreSQL 10 database server
root@69991d4b808b:/#
root@69991d4b808b:/# su - postgres
postgres@69991d4b808b:~$ createdb reviewboard
postgres@69991d4b808b:~$ createuser -P --interactive
Enter name of role to add: reviewboard
Enter password for new role: reviewboard
Enter it again: reviewboard
Shall the new role be a superuser? (y/n) y
- 查看数据库,并设置操作权限
postgres@69991d4b808b:~$ psql
psql (10.16 (Ubuntu 10.16-0ubuntu0.18.04.1))
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-------------+----------+----------+---------+---------+-----------------------
postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
reviewboard | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
postgres=#
postgres=# GRANT ALL PRIVILEGES ON DATABASE reviewboard to reviewboard
postgres-#
ctrl+d退出
- 启动memcached
root@69991d4b808b:/# service memcached start
- 创建站点文件夹
root@69991d4b808b:/# mkdir /var/www/reviewboard
- 开始生成站点,需要填入一些信息
root@69991d4b808b:/# rb-site install /var/www/reviewboard
Domain Name: localhost
Root Path [/]: #回车
Database Type: 1
Database Name [reviewboard]: #回车
Database Server [localhost]: #回车
Database Username: reviewboard
Database Password: #输入reviewboard
Confirm Database Password: #输入reviewboard
Memcached Server [localhost:11211]: #回车
Username [admin]: #回车
Password: #设置管理员登录密码,先设置成admin
Confirm Password: #输入admin
- 修改目录owner
root@69991d4b808b:/# chown -R www-data /var/www/reviewboard/data/
root@69991d4b808b:/# chown -R www-data /var/www/reviewboard/htdocs/media/uploaded/
root@69991d4b808b:/# chown -R www-data /var/www/reviewboard/htdocs/media/ext/
root@69991d4b808b:/# chown -R www-data /var/www/reviewboard/htdocs/static/ext/
- 拷贝站点配置到apache2的目录
root@69991d4b808b:/etc/apache2/sites-available# ls -l
total 12
-rw-r--r-- 1 root root 1332 Apr 14 2020 000-default.conf
-rw-r--r-- 1 root root 6338 Apr 14 2020 default-ssl.conf
root@69991d4b808b:/etc/apache2/sites-available# cp /var/www/reviewboard/conf/apache-wsgi.conf reviewboard.conf
root@69991d4b808b:/etc/apache2/sites-available# cd ../sites-enabled
root@69991d4b808b:/etc/apache2/sites-enabled# ln -s ../sites-available/reviewboard.conf
root@69991d4b808b:/etc/apache2/sites-enabled#
- 修改站点访问权限,localhost改为*
root@69991d4b808b:/etc/apache2/sites-enabled# vim /var/www/reviewboard/conf/settings_local.py
ALLOWED_HOSTS = [
"*"
]
- 使能wsgi
root@69991d4b808b:/etc/apache2/sites-enabled# a2enmod wsgi
Module wsgi already enabled
- 启动apache2
root@69991d4b808b:/etc/apache2/sites-enabled# service apache2 start
* Starting Apache httpd web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
root@69991d4b808b:/etc/apache2/sites-enabled# netstat -apn | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 9277/apache2
tcp 0 0 172.17.0.4:33962 91.189.88.142:80 TIME_WAIT -
root@69991d4b808b:/etc/apache2/sites-enabled#
- 修改站点信息,reload apache2
root@69991d4b808b:/etc/apache2/sites-enabled# rm 000-default.conf
root@69991d4b808b:/etc/apache2/sites-enabled# a2ensite reviewboard.conf
Site reviewboard already enabled
root@69991d4b808b:/etc/apache2/sites-enabled#
root@69991d4b808b:/etc/apache2/sites-enabled# service apache2 reload
* Reloading Apache httpd web server apache2 *
root@69991d4b808b:/etc/apache2/sites-enabled#
- 如果发现此时不能通过http://[docker-ip]访问reviewboard,可以看一下log来找原因
root@69991d4b808b:/etc/apache2/sites-enabled# vim /var/log/apache2/error.log
打开网页
- 如果一切顺利,可以看到
- 可是,等等,说好的report按键去哪里了呢?????
- 仔细一看才发现reviewboard自己用的是4.0-rc(dev),多了一个dev字样,我是真的无语了…