Gerrit,是一種以GIT作為底層的code review system,它使用網頁介面,讓團隊進行review,決定是否能夠提交,退回或是繼續修改。
可以由此download, https://gerrit-releases.storage.googleapis.com/index.html 。
安裝步驟可以參考裡面的Documentation,
1. 先建立database
我是採用mysql,其他db的設定可以參考Gerrit的Document。CREATE USER 'gerrit2'@'localhost' IDENTIFIED BY 'secret'; CREATE DATABASE reviewdb; GRANT ALL ON reviewdb.* TO 'gerrit2'@'localhost'; FLUSH PRIVILEGES;
2. Initialize the Site
基本上gerrit2會跳出對話框,將問題的資訊填完就可以安奘成功了。gerrit2@vista:~$ ls examples.desktop gerrit-2.11.war gerrit2@vista:~$ java -jar gerrit-2.11.war init -d review_site Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore *** Gerrit Code Review 2.11 *** Create '/home/gerrit2/review_site' [Y/n]? *** Git Repositories *** Location of Git repositories [git]: *** SQL Database *** Database server type [h2]: mysql Gerrit Code Review is not shipped with MySQL Connector/J 5.1.21 ** This library is required for your configuration. ** Download and install it now [Y/n]? Downloading http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar ... OK Checksum mysql-connector-java-5.1.21.jar OK Server hostname [localhost]: Server port [(mysql default)]: Database name [reviewdb]: Database username [gerrit2]: gerrit2's password : confirm password : *** Index *** Type [LUCENE/?]: *** User Authentication *** Authentication method [OPENID/?]: *** Review Labels *** Install Verified label [y/N]? *** Email Delivery *** SMTP server hostname [localhost]: SMTP server port [(default)]: SMTP encryption [NONE/?]: SMTP username : *** Container Process *** Run as [gerrit2]: Java runtime [/usr/lib/jvm/java-7-openjdk-amd64/jre]: Copy gerrit-2.11.war to /home/gerrit2/review_site/bin/gerrit.war [Y/n]? Copying gerrit-2.11.war to /home/gerrit2/review_site/bin/gerrit.war *** SSH Daemon *** Listen on address [*]: Listen on port [29418]: Gerrit Code Review is not shipped with Bouncy Castle Crypto SSL v151 If available, Gerrit can take advantage of features in the library, but will also function without it. Download and install it now [Y/n]? Downloading http://www.bouncycastle.org/download/bcpkix-jdk15on-151.jar ... OK Checksum bcpkix-jdk15on-151.jar OK Gerrit Code Review is not shipped with Bouncy Castle Crypto Provider v151 ** This library is required by Bouncy Castle Crypto SSL v151. ** Download and install it now [Y/n]? Downloading http://www.bouncycastle.org/download/bcprov-jdk15on-151.jar ... OK Checksum bcprov-jdk15on-151.jar OK Generating SSH host key ... rsa... dsa... done *** HTTP Daemon *** Behind reverse proxy [y/N]? Use SSL (https://) [y/N]? Listen on address [*]: Listen on port [8080]: 6267 Canonical URL [http://localhost:6267/]: *** Plugins *** Installing plugins. Install plugin download-commands version v2.11 [y/N]? Install plugin reviewnotes version v2.11 [y/N]? Install plugin singleusergroup version v2.11 [y/N]? Install plugin replication version v2.11 [y/N]? Install plugin commit-message-length-validator version v2.11 [y/N]? Initializing plugins. No plugins found with init steps. Execute now [Y/n]? Initialized /home/gerrit2/review_site Executing /home/gerrit2/review_site/bin/gerrit.sh start Starting Gerrit Code Review: OK Waiting for server on localhost:6267 ... OK
3. Start/Stop Daemon
可以透過review_site/bin/gerrit.sh將deamon進行開關,通常我會在rc5.d中建立link到該script中
review_site/bin/gerrit.sh start review_site/bin/gerrit.sh stop review_site/bin/gerrit.sh restart
4. Setup Administrator
可以用Web開啟gerrit並且設定第一個User,即Adminstrator。基本上我是自己建立一個OpenID,你可以選擇其他認證方式。
參考資料: Gerrit Document