The Go Blog

gerrit

bantana
14 July 2015

design

ldap gerrit ssh

install

sudo apt-get install slapd ldap-utils git

install java:

export JAVA_HOME=/usr/local/java
export PATH=$PATH:$JAVA_HOME/bin

$ java -version
java version "1.8.0_33"
Java(TM) SE Runtime Environment (build 1.8.0_33-b05)
Java HotSpot(TM) Client VM (build 25.33-b05, mixed mode)

install gerrit:

java -jar gerrit.war init --batch -d ~/gerritsite

configure

gerritsite/etc/gerrit.config

[gerrit]
  basePath = git
  canonicalWebUrl = http://192.168.88.230:8080/
[database]
  type = h2
  database = db/ReviewDB
[index]
  type = LUCENE
[auth]
#     type = DEVELOPMENT_BECOME_ANY_ACCOUNT
  type = ldap
[ldap]
   server = ldap://127.0.0.1
   accountBase = ou=people,dc=aozsky,dc=com
   groupBase = ou=groups,dc=aozsky,dc=com
   referral = follow
   accountPattern = (uid=${username})
   groupPattern = (cn=${groupname})
   accountFullName = cn
   accountMemberField = memberOf
   accountEmailAddress = mail
[sendemail]
  smtpServer = localhost
[container]
  user = pi
  javaHome = /usr/local/jdk1.8.0_33/jre
[sshd]
  listenAddress = *:29418
[httpd]
  listenUrl = http://*:8080/
[cache]
  directory = cache

usage

ssh gerrit -i .ssh/id_rsa_aozsky

  ****    Welcome to Gerrit Code Review    ****

  Hi bantana, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
  To clone a hosted Git repository, use:

  git clone ssh://bantana@192.168.88.230:29418/REPOSITORY_NAME.git

Connection to 192.168.88.230 closed.

faq

mail:

[sendemail]
        enable = true
        smtpServer = smtp.gmail.com
        smtpServerPort = 465
        smtpEncryption = ssl
        smtpUser = mailaddr@gmail..com
        smtpPass = mail_pwd
        sslVerify = false
        from = Code Review < mailaddr@gmail..com>

todo

Related articles