여기에서는 Docker를 이용하여 Gerrit 3.5.1 설치하는 방법을 설명한다.

 

설치를 위해 참고한 사이트는 다음과 같다.

 

mkdir gerrit httpd
mkdir gerrit/etc

 

file: docker-compose.yml

version: '3'

services:
  gerrit:
    image: gerritcodereview/gerrit:3.5.1-ubuntu20
    user: root
    ports:
      - "29418:29418"
    volumes:
      - ./gerrit/etc:/var/gerrit/etc
    environment:
      - CANONICAL_WEB_URL=http://localhost:8100
    command: init   # Note 1

  apache:
    image: httpd
    volumes:
      - ./httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf
      - ./httpd/.htpasswd:/usr/local/apache2/conf/.htpasswd
    ports:
       - "8100:80"

 

file: gerrit/etc/gerrit.config

[gerrit]
  basePath = git

[index]
  type = LUCENE

[auth]
  type = http
  logoutUrl = http://aa:aa@localhost:8100/logout

[sendemail]
  smtpServer = localhost

[sshd]
  listenAddress = *:29418

[httpd]
  listenUrl = http://*:8080/

[cache]
  directory = cache

[plugins]
  allowRemoteAdmin = true

Gerrit 초기화를 위해 다음 명령을 실행한다. 초기화 이후에 자동으로 종료된다.

docker-compose up gerrit

초기화가 끝나면, docker-compose.yml 내의 'command: init'을 주석처리한다.

 

그리고 gerrit.config을 살펴보면, 필요한 속성이 추가되었음을 확인할 수 있다.

 

Gerrit과 Apache를 같이 실행한다.

docker-compose up

실행 후 표시되는 로그 화면에서 'Gerrit Code Review 3.5.1 ready'이 나오면 정상적으로 실행된 것이다.

 

gerrit_1  | [2022-05-11T04:58:10.069Z] [main] INFO  org.eclipse.jetty.server.handler.ContextHandler : Started o.e.j.s.ServletContextHandler@41e35358{/,null,AVAILABLE}
gerrit_1  | [2022-05-11T04:58:10.081Z] [main] INFO  org.eclipse.jetty.server.AbstractConnector : Started ServerConnector@f1d5f3{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
gerrit_1  | [2022-05-11T04:58:10.082Z] [main] INFO  org.eclipse.jetty.server.Server : Started @7894ms
gerrit_1  | [2022-05-11T04:58:10.084Z] [main] INFO  com.google.gerrit.pgm.Daemon : Gerrit Code Review 3.5.1 ready

 

브라우저에서 http://localhost:8100 을 열면 Gerrit에 접근할 수 있다.

 

+ Recent posts