首页 > 其他分享 >Gerrit 不使用代理服务的搭建配置

Gerrit 不使用代理服务的搭建配置

时间:2022-11-13 12:31:50浏览次数:69  
标签:google java v3.6 gerrit Gerrit version 代理服务 com 搭建

1、前言

Gerrit 名声已很大了,我也就不在过多阐述介绍了,凡是需要安装搭建 Gerrit 服务器的,网上一搜索都是大把精彩教程。但是,基本都是基于代理服务的搭建安装,一种是基于 apache+gerrit 代理的配置,一种是基于 nginx+gerrit 代理的配置,我之前发布的好几篇关于Gerrit 服务的搭建,都有详细的介绍分享,需要的都可以回顾去看看,本文介绍的是 Gerrit 自身带的服务 jetty 服务配置。


2、系统平台

操作系统:Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-52-generic x86_64)

Gerrit 不使用代理服务的搭建配置_git

搭建服务之前,还是老规矩,要先执行系统更新,执行如下两条指令:

sudo apt update

$ sudo apt -y upgrade


3、下载

Gerrit 不使用代理服务的搭建配置_git_02

官方下载地址: ​​https://www.gerritcodereview.com/3.6.html​

指令下载方式如下图所示:

Gerrit 不使用代理服务的搭建配置_java_03

#下载指令
$ wget https://gerrit-releases.storage.googleapis.com/gerrit-3.6.3.war

查看 JDK 版本

$ java -version

java version "17.0.5" 2022-10-18 LTS

Java(TM) SE Runtime Environment (build 17.0.5+9-LTS-191)

Java HotSpot(TM) 64-Bit Server VM (build 17.0.5+9-LTS-191, mixed mode, sharing)

$


4、开始安装

执行安装指令: $ java -jar gerrit-3.6.3.war init -d /home/scmroot/review_path

如下图所示完整的执行过程

Gerrit 不使用代理服务的搭建配置_eclipse_04

完整代码片段如下:

$ java -jar gerrit-3.6.3.war init -d /home/scmroot/review_path

Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore

[2022-11-13 09:26:01,877] [main] INFO com.google.gerrit.server.config.GerritServerConfigProvider : No /home/scmroot/review_path/etc/gerrit.config; assuming defaults


*** Gerrit Code Review 3.6.3

***


Create '/home/scmroot/review_path' [Y/n]? Y


*** Git Repositories

***


Location of Git repositories [git]: git


*** JGit Configuration

***


Auto-configured "receive.autogc = false" to disable auto-gc after git-receive-pack.


*** Index

***


Type [lucene]:


*** User Authentication

***


Authentication method [openid/?]:

Enable signed push support [y/N]?

Use case insensitive usernames [Y/n]?


*** 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 [scmroot]:

Java runtime [/usr/local/jdk17.0.5]:

Copy gerrit-3.6.3.war to /home/scmroot/review_path/bin/gerrit.war [Y/n]? Y

Copying gerrit-3.6.3.war to /home/scmroot/review_path/bin/gerrit.war


*** SSH Daemon

***


Listen on address [*]:

Listen on port [29418]:

Generating SSH host key ... rsa... ed25519... ecdsa 256... ecdsa 384... ecdsa 521... done


*** HTTP Daemon

***


Behind reverse proxy [y/N]? N

Use SSL (https://) [y/N]?

Listen on address [*]: 8080

Listen on port [8080]: 8080

Canonical URL [http://8080:8080/]: http://192.*.*.*:8080


*** Cache

***



*** Plugins

***


Installing plugins.

Install plugin codemirror-editor version v3.6.3 [y/N]? y

Installed codemirror-editor v3.6.3

Install plugin commit-message-length-validator version v3.6.3 [y/N]? y

Installed commit-message-length-validator v3.6.3

Install plugin delete-project version v3.6.3 [y/N]? y

Installed delete-project v3.6.3

Install plugin download-commands version v3.6.3 [y/N]? y

Installed download-commands v3.6.3

Install plugin gitiles version v3.6.3 [y/N]? y

Installed gitiles v3.6.3

Install plugin hooks version v3.6.3 [y/N]? y

Installed hooks v3.6.3

Install plugin plugin-manager version v3.6.3 [y/N]? N

Install plugin replication version v3.6.3 [y/N]? y

Installed replication v3.6.3

Install plugin reviewnotes version v3.6.3 [y/N]? y

Installed reviewnotes v3.6.3

Install plugin singleusergroup version v3.6.3 [y/N]? y

Installed singleusergroup v3.6.3

Install plugin webhooks version v3.6.3 [y/N]? y

Installed webhooks v3.6.3

Initializing plugins.


============================================================================

Welcome to the Gerrit community


Find more information on the homepage: https://www.gerritcodereview.com

Discuss Gerrit on the mailing list: https://groups.google.com/g/repo-discuss

============================================================================

Initialized /home/scmroot/review_path

Init complete, reindexing accounts,changes,groups,projects with: reindex --site-path /home/scmroot/review_path --threads 1 --index accounts --index changes --index groups --index proj ects --disable-cache-statsReindexed 0 documents in accounts index in 0.0s (0.0/s)

Index accounts in version 11 is ready

Reindexing groups: 100% (2/2)

Reindexed 2 documents in groups index in 0.4s (5.2/s)

Index groups in version 8 is ready

Reindexing changes: Slicing projects: 100% (2/2), done

Reindexed 0 documents in changes index in 0.0s (0.0/s)

Index changes in version 77 is ready

Reindexing projects: 100% (2/2)

Reindexed 2 documents in projects index in 0.0s (43.5/s)

Index projects in version 4 is ready

Executing /home/scmroot/review_path/bin/gerrit.sh start

Starting Gerrit Code Review: WARNING: Could not adjust Gerrit's process for the kernel's out-of-memory killer.

This may be caused by /home/scmroot/review_path/bin/gerrit.sh not being run as root.

Consider changing the OOM score adjustment manually for Gerrit's PID=11130 with e.g.:

echo '-1000' | sudo tee /proc/11130/oom_score_adj

FAILED

error: cannot start Gerrit: exit status 1

Waiting for server on 192.168.126.134:8080 ...


^Cscmroot@scmrootcicd:~/soft$

安装完成后,进入安装目录,查看启动的 log 信息,显示如下信息:

Gerrit 不使用代理服务的搭建配置_java_05

可以看到有报错地方,导致gerrit服务没有启动成功。

[2022-11-13T09:29:53.628+08:00] [WorkQueue-2[java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@55a680f8[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@5f5eeb88[Wrapped task = com.google.gerrit.server.logging.LoggingContextAwareRunnable@51991e13]]]] INFO  com.googlesource.gerrit.plugins.deleteproject.fs.RepositoryCleanupTask : Cleaning up expired git repositories...

[2022-11-13T09:29:53.639+08:00] [WorkQueue-2[java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@55a680f8[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@5f5eeb88[Wrapped task = com.google.gerrit.server.logging.LoggingContextAwareRunnable@51991e13]]]] INFO com.googlesource.gerrit.plugins.deleteproject.fs.RepositoryCleanupTask : Cleaning up expired git repositories... Done

[2022-11-13T09:29:54.274+08:00] [main] INFO org.eclipse.jetty.server.handler.ContextHandler : Started o.e.j.s.ServletContextHandler@43a34f02{/,null,AVAILABLE}

[2022-11-13T09:29:54.288+08:00] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon

java.lang.IllegalStateException: Cannot start HTTP daemon

at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:109)

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

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

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

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

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:568)

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

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

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

at Main.main(Main.java:29)

Caused by: java.io.IOException: Failed to bind to /0.0.31.144:8080

at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)

at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)

at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)

at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)

at org.eclipse.jetty.server.Server.doStart(Server.java:401)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)

at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:95)

... 12 more

Caused by: java.net.BindException: Cannot assign requested address

at java.base/sun.nio.ch.Net.bind0(Native Method)

at java.base/sun.nio.ch.Net.bind(Net.java:555)

at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)

at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)

at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)

at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)

... 19 more

scmroot@scmrootcicd:~/review_path/logs$


关键报错是 : Caused by: java.io.IOException: Failed to bind to /0.0.31.144:8080  ,,本机的 IP 地址配置有错。

5、修改配置文件

进入etc目录下,修改关键的 gerrit.config 文件,大致修改如下:

Gerrit 不使用代理服务的搭建配置_git_06

修改成正确的 IP 地址,就可以重新执行启动 gerrit 服务了。

sh ../bin/gerrit.sh start

查看 log 日志,没有明细报错,说明配置修改正确,gerrit 服务正常启动了。

Gerrit 不使用代理服务的搭建配置_eclipse_07

打开浏览器访问 gerrit  系统

Gerrit 不使用代理服务的搭建配置_git_08

可以看到 gerrit 首页已正常显示了,注册一个账号,就可以登录系统,正常使用了。

使用 SCM 用户登录后,创建一个 demo 仓库。

Gerrit 不使用代理服务的搭建配置_git_09

Gerrit 不使用代理服务的搭建配置_git_10

查看到 Plugins 信息,就是安装的 v3.6.3 版本对应的插件。

Gerrit 不使用代理服务的搭建配置_java_11


到此,最新版 Gerrit 3.6.3 版本,不适用代理服务的搭建配就分享结束了,希望对各位有所帮助,请给个红心点个赞,谢谢各位。


标签:google,java,v3.6,gerrit,Gerrit,version,代理服务,com,搭建
From: https://blog.51cto.com/wst021sh/5847726

相关文章

  • 学习笔记-java代码审计-环境搭建+前置知识
    Java代码审计-环境搭建+前置知识0x00中间件tomcat因为个人比较矫情,不想在mac搭java的开发环境,就想着有没有本地写代码然后部署到虚拟机上运行。毕竟java是静态语言,在编......
  • rocketmq环境搭建-windows
    最近使用到了rockmetmq,官网上有快速开始的指导,简单记录下自己搭建的过程;1、先到官网下载mq:https://rocketmq.apache.org/download/,我这里下载的是:rocketmq-all-4.9.2-bin-......
  • CentOS 7使用ttyd搭建一个WEB共享终端(WebSSH)
    官网下载地址:​​https://github.com/tsl0922/ttyd/releases​​下载ttyd:wget-Ottyd​​https://github.com/tsl0922/ttyd/releases/download/1.6.0/ttyd_linux.x86_64......
  • 2.搭建服务消费者user-consumer
    搭建服务消费者user-consumer1.创建user-consumer模块,导入依赖<dependency><groupId>org.springframework.boot</groupId><artifactId>spri......
  • Pytest接口测试框架实战项目搭建(三)—— 统一登录处理
    一、前言业务系统的登录均要经过统一登录系统S,本篇演示2个业务系统的登录,一个是内部业务系统C,一个是外部用户使用的系统W,因为账号密码以及headers信息都不一样,所以要......
  • ubuntu搭建sftp服务
    sftp直接使用系统的sshd服务,无需额外安装软件,配置也比较简单。一、添加用户添加一个sftp用户,不设置家目录,指定不能登录的shell,然后设置登录密码useradd-M-s/sbin/n......
  • 如何使用vite搭建vue3项目详解
    目录一:npm构建二:更改http://localhost:3000/到8080与Network路由访问三:配置vite别名(npminstall@types/node--save-dev)四:路由(npminstallvue-router@4)五:vuex(n......
  • 1.PHP Study搭建Dvwa,Pikachu,Sqli环境
    原文链接:​​https://blog.csdn.net/qq_43360657/article/details/127819241?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%......
  • 使用vue 搭建猫眼后台演员列表
    首先创建一个DirectorList.vue js部分 ......
  • 深度学习环境搭建
    深度学习环境配置注意--pycharm+anaconda+torchanaconda是python的一个大的发行版,里面有很多python相关的包,若要进行深度学习环境搭建,必须要下载它和pycharm联合使......