Gerrit 手动安装

(optional) Create a non-privileged user to run Gerrit
$ sudo adduser gerrit2
$ sudo su gerrit2




Initialize review site (batch mode) and start Gerrit
$ java -jar gerrit-2.11.5.war init --batch -d ./
$ java -jar gerrit-2.11.5.war reindex


gerrit 的启动停止命令:
  gerrit.sh restart 
  gerrit.sh stop
  gerrit.sh start






配置gerrit.config 
[gerrit] 
basePath = git 
canonicalWebUrl = http://127.0.0.1:8099/
[database] 
type = h2 
database = db/ReviewDB 
[index] type = LUCENE 
[auth] type = HTTP
[sendemail] 
smtpServer = smtp.exmail.qq.com
smtpServerPort = 465 
smtpEncryption = ssl 
smtpUser = [email protected] 
smtpPass =xxx 
sslVerify = false 
from=CodeReview
[container] 
user = xxx 
javaHome = /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre 
[sshd] 
listenAddress = *:29418
[httpd] listenUrl = proxy-http://*:8089/ 
[cache] directory = cache 
~    


nginx 配置:


     server { 


     listen 8099; 
     server_name 0.0.0.0; 
     allow all; 
     deny all; 
     auth_basic "THSTACK INC. Review System Login"; 
     auth_basic_user_file ~/opt/gerrit/etc/htpasswd.conf; 
     location / {
      proxy_pass http://127.0.0.1:8089; 
      } 
    } 
   




     信息与上面的对的上。 
   
创建 htpasswd.conf 文件,并添加 admin 用户、密码到文件中


# touch /etc/gerrit/etc/htpasswd.conf
# htpasswd /etc/gerrit/etc/htpasswd.conf admin
  New password: 
  Re-type new password: 
  Adding password for user admin


启动各服务:访问:http://127.0.0.1:8099 (这是nginx的地址用admin登陆。

登陆后添加邮箱、ssh。创建其它用户。




 
  
注意: [2016-01-14 14:00:50,460] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon

com.google.inject.ProvisionException: Unable to provision, see the following errors:


1) No index versions ready; run Reindex


1 error

at com.google.gerrit.lucene.LuceneVersionManager.start(LuceneVersionManager.java:119)

at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:74)

at com.google.gerrit.pgm.Daemon.start(Daemon.java:293)

at com.google.gerrit.pgm.Daemon.run(Daemon.java:205)

at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)

at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)

at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)

at Main.main(Main.java:25)

解决:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/pgm-reindex.html

'java' -jar gerrit.war 'reindex' []

DESCRIPTION

Rebuilds the secondary index.

OPTIONS

--threads

Number of threads to use for indexing.

--schema-version

Schema version to reindex; default is most recent version.

--output

Prefix for output; path for local disk index, or prefix for remote index.

--verbose

Output debug information for each change.

--dry-run

Dry run. Don’t write anything to index.

CONTEXT

The secondary index must be enabled. See index.type.


你可能感兴趣的:(Gerrit)