이번 글에서는 Gerrit 3.1.10에서 Gerrit 3.5.1로의 이전에 관한 내용을 서술한다.
참고글은 다음과 같다
Gerrit 3.1.10 - 이전 설치 ( Migration, Docker )에서 작성한 내용과 아주 유사하다.
설치 준비
mkdir gerrit_3.5.1 && cd gerrit_3.5.1
touch docker-compose.yml
mkdir gerrit
cp -r $SRC/gerrit/cache gerrit
cp -r $SRC/gerrit/db gerrit
cp -r $SRC/gerrit/etc gerrit
cp -r $SRC/gerrit/git gerrit
cp -r $SRC/gerrit/index gerrit
mkdir httpd
cp $SRC/httpd/httpd.conf httpd # 설정파일, 원래 장소에서 복사
cp $SRC/httpd/.htpasswd httpd # 계정과 암호파일, 원래 장소에서 복사
노트:
- plugins은 3.5.1용으로 설치하기 위해서 기존 백업데이터를 이용하지 않았다.
file: docker-compose.yml
version: '3'
services:
gerrit:
image: gerritcodereview/gerrit:3.5.1-ubuntu20
user: root
ports:
- "29418:29418"
volumes:
- ./gerrit/db:/var/gerrit/db
- ./gerrit/etc:/var/gerrit/etc
- ./gerrit/git:/var/gerrit/git
- ./gerrit/index:/var/gerrit/index
environment:
- CANONICAL_WEB_URL=http://localhost:8100
command: init
apache:
image: httpd
volumes:
- ./httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./httpd/.htpasswd:/usr/local/apache2/conf/.htpasswd
ports:
- "8100:80"
노트:
- plugins은 3.5.1용으로 설치하기 위해서 기존 백업데이터를 이용하지 않았다. 즉, volumes 항목에서 제외하였다.
- command: init 부분이 아주 중요하다. 이 부분이 없으면, 백업한 자료들을 모두 초기화한다. 기존 자료를 이용하여 초기화 하기 위해서는 주석을 풀고, 실행해주어야 한다. (1회성)
file: gerrit/etc/gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://localhost:8100/
serverId = 5618f8c1-7707-41a7-be27-c2f23aa6790c
[index]
type = lucene
[auth]
type = http
logoutUrl = http://aa:aa@localhost:8100/login
trustContainerAuth = true # remote로 plugin 설치위해
[receive]
enableSignedPush = false
[sendemail]
enable = true
smtpServer = smtprelay.MYCOMPANY.COM
smtpServerPort = 25
smtpUser = SMTPUSER
smtpPass = SMPTPASS
[user]
email = no_reply@MYCOMPANY.COM
anonymousCoward = COMPANY Gerrit
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://*:8080/
[cache]
directory = cache
[commentLink "its-jira"]
match = \\[([A-Z]+-[0-9]+)\\]
html = <a href=\"https://jira.MYCOMPANY.COM/browse/$1\">[$1]</a>
association = SUGGESTED
[its-jira]
url = https://jira.MYCOMPANY
username = JIRA-USER
password = JIRA-PASS
[plugins]
allowRemoteAdmin = true
file: gerrit/etc/its/actions.config
[rule "merged"]
event-type = change-merged
action = add-standard-comment
file: httpd/httpd.conf
...
LoadModule proxy_module modules/mod_proxy.so # 주석제거
...
LoadModule proxy_http_module modules/mod_proxy_http.so # 주석제거
...
# 파일끝에 아래 추가
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
<VirtualHost *>
ServerName gerrit
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location "/">
AuthType Basic
AuthName "Gerrit Code Review"
AuthBasicProvider file
AuthUserFile '/usr/local/apache2/conf/.htpasswd'
Require valid-user
</Location>
AllowEncodedSlashes On
ProxyPass / http://gerrit:8080/ nocanon
</VirtualHost>
설치 실행
먼저 docker-compose.yml의 command 부분 주석을 제거하고 Gerrit의 초기화를 실행한다.
docker-compose up gerrit
Gerrit 3.1.10 초기화때와는 다르게, 초기화가 완료되면 자동 종료된다.
gerrit_1 | [2022-05-17 09:59:26,479] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin replication, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,480] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin codemirror-editor, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,481] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin gitiles, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,481] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin reviewnotes, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,482] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin download-commands, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,482] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin commit-message-length-validator, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,483] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin webhooks, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,483] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin avatars-gravatar, version 4d45f66597
gerrit_1 | [2022-05-17 09:59:26,483] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin delete-project, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,484] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin plugin-manager, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,484] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin singleusergroup, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,484] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin hooks, version v3.5.1
gerrit_1 | [2022-05-17 09:59:26,484] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Unloading plugin uploadvalidator, version v3.0.0-rc1-284-gefecf8cdf4
gerrit_1 | [2022-05-17 09:59:26,578] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_replication_220517_0958_9713708846942515415.jar
gerrit_1 | [2022-05-17 09:59:26,579] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_codemirror-editor_220517_0958_2369289632520411003.jar
gerrit_1 | [2022-05-17 09:59:26,579] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_gitiles_220517_0958_14918039203576338770.jar
gerrit_1 | [2022-05-17 09:59:26,579] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_reviewnotes_220517_0958_5216294365523276074.jar
gerrit_1 | [2022-05-17 09:59:26,579] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_download-commands_220517_0958_4264228789875070900.jar
gerrit_1 | [2022-05-17 09:59:26,580] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_commit-message-length-validator_220517_0958_13705660632656731886.jar
gerrit_1 | [2022-05-17 09:59:26,580] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_webhooks_220517_0958_13317217803860358281.jar
gerrit_1 | [2022-05-17 09:59:26,580] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_avatars-gravatar_220517_0958_8896828478575643447.jar
gerrit_1 | [2022-05-17 09:59:26,580] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_delete-project_220517_0958_10873195147850721930.jar
gerrit_1 | [2022-05-17 09:59:26,580] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_plugin-manager_220517_0958_1093134940356759420.jar
gerrit_1 | [2022-05-17 09:59:26,580] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_singleusergroup_220517_0958_9729983710349567030.jar
gerrit_1 | [2022-05-17 09:59:26,580] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_hooks_220517_0958_4063223096168124260.jar
gerrit_1 | [2022-05-17 09:59:26,580] [main] INFO com.google.gerrit.server.plugins.CleanupHandle : Cleaned plugin plugin_uploadvalidator_220517_0958_16440575924884005494.jar
gerrit_351_gerrit_1 exited with code 0
이후에 다시 docker-compose.yml의 command 부분을 주석처리하고 다시 Gerrit 및 httpd 서비스를 실행한다.
docker-compose up
이후에 Gerrit을 실행하면, 정상적으로 동작함을 확인할 수 있다.

플러그인 설치를 위해 Install plugins을 클릭하고, its-base와 its-jira를 설치해주었다. ( Jira와 Link 및 comment 추가를 위해 )

기존 이력도 확인할 수 있고, 좌측아래에서 버전이 3.5.1 임을 확인할 수 있다.

Gerrit와 Jira의 연계 테스트를 위해서 하나의 commit을 merge했더니, Jira에 comment가 잘 추가되었다.

'Gerrit' 카테고리의 다른 글
Gerrit 3.1.10 - 이전 설치 ( Migration, Docker ) (0) | 2022.05.16 |
---|---|
Gerrit 3.5.1 - 설치 ( Docker ) (0) | 2022.05.11 |
Gerrit - LDAP 설정 (0) | 2022.05.03 |
Gerrit - 설치 ( Standalone ) (0) | 2022.04.22 |
Gerrit - 설치 ( Quickstart ) (0) | 2022.04.20 |