使用Gerrit发送测试邮件

                                      作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.安装HTTP服务

1>.安装HTTP服务

[root@gerrit.yinzhengjie.org.cn ~]# yum -y install httpd

2>.使用HTTP配置反响代理

[root@gerrit.yinzhengjie.org.cn ~]# tail - /etc/httpd/conf/httpd.conf
Listen
<VirtualHost *:>
ServerName gerrit.yinzhengjie.org.cn
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On <Proxy *>
Order deny,allow
Allow from all
</Proxy> <Location /login/>
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthUserFile /etc/httpd/passwords
</Location> AllowEncodedSlashes On
ProxyPass / http://gerrit.yinzhengjie.org.cn:8888/
</VirtualHost>
[root@gerrit.yinzhengjie.org.cn ~]#

3>.创建passwd文件,添加gerrit登录用户

[root@gerrit.yinzhengjie.org.cn ~]# htpasswd -cb /etc/httpd/passwords admin admin          #注意,"-c"参数为创建,仅限第一次添加用户时使用,用户名和密码均为admin
Adding password for user admin
[root@gerrit.yinzhengjie.org.cn ~]# htpasswd -b /etc/httpd/passwords jason yinzhengjie       #第二次创建时不要加"-c"参数。创建一个jason用户,密码为"yinzhengjie"
Adding password for user jason
[root@gerrit.yinzhengjie.org.cn ~]#
[root@gerrit.yinzhengjie.org.cn ~]#
[root@gerrit.yinzhengjie.org.cn ~]# cat /etc/httpd/passwords                       #我们查看该文件的确有2个用户,但是密码时经过加密处理的!
admin:$apr1$Em..sIno$GMpAsQlJ4l.S4C0Qnu0iD/
jason:$apr1$892G6DfX$IBkKm8paM/4wPvowppI/d1
[root@gerrit.yinzhengjie.org.cn ~]#
[root@gerrit.yinzhengjie.org.cn ~]# 

4>.启动HTTP服务

[root@gerrit.yinzhengjie.org.cn ~]# systemctl start httpd
[root@gerrit.yinzhengjie.org.cn ~]#
[root@gerrit.yinzhengjie.org.cn ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@gerrit.yinzhengjie.org.cn ~]#
[root@gerrit.yinzhengjie.org.cn ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed -- :: EDT; 22h ago
Docs: man:httpd()
man:apachectl()
Main PID: (httpd)
Status: "Total requests: 233; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
└─ /usr/sbin/httpd -DFOREGROUND Jun :: gerrit.yinzhengjie.org.cn systemd[]: Starting The Apache HTTP Server...
Jun :: gerrit.yinzhengjie.org.cn systemd[]: Started The Apache HTTP Server.
[root@gerrit.yinzhengjie.org.cn ~]#  

二.安装Gerrit(需要有jdk环境)

1>.安装Gerrit

[root@gerrit.yinzhengjie.org.cn ~]# java -jar gerrit-3.0..war   init -d /yinzhengjie/softwares/gerrit
Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
[-- ::,] [main] INFO com.google.gerrit.server.config.GerritServerConfigProvider : No /yinzhengjie/softwares/gerrit/etc/gerrit.config; assuming defaults *** Gerrit Code Review 3.0.
*** Create '/yinzhengjie/softwares/gerrit' [Y/n]? *** Git Repositories
*** Location of Git repositories [git]: *** Index
*** Type [lucene/?]: *** User Authentication
*** Authentication method [openid/?]: http
Get username from custom HTTP header [y/N]? n
SSO logout URL :
Enable signed push support [y/N]? *** Review Labels
*** Install Verified label [y/N]? *** Email Delivery
*** SMTP server hostname [localhost]: smtp.ym..com
SMTP server port [(default)]:
SMTP encryption [none/?]:
SMTP username [root]: yinzhengjie@aggrx.com
yinzhengjie@aggrx.com's password :
confirm password : *** Container Process
*** Run as [root]:
Java runtime [/yinzhengjie/softwares/jdk1..0_201/jre]:
Copy gerrit-3.0..war to /yinzhengjie/softwares/gerrit/bin/gerrit.war [Y/n]? y
Copying gerrit-3.0..war to /yinzhengjie/softwares/gerrit/bin/gerrit.war *** SSH Daemon
*** Listen on address [*]: gerrit.yinzhengjie.org.cn
Listen on port []:
Generating SSH host key ... rsa... ed25519... ecdsa ... ecdsa ... ecdsa ... done *** HTTP Daemon
*** Behind reverse proxy [y/N]? y
Proxy uses SSL (https://) [y/N]? n
Subdirectory on proxy server [/]:
Listen on address [*]: gerrit.yinzhengjie.org.cn
Listen on port []:
Canonical URL [http://gerrit.yinzhengjie.org.cn/]: http://gerrit.yinzhengjie.org.cn:8090/ *** Cache
*** *** Plugins
*** Installing plugins.
Install plugin codemirror-editor version v3.0.0 [y/N]? y
Installed codemirror-editor v3.0.0
Install plugin commit-message-length-validator version v3.0.0 [y/N]? y
Installed commit-message-length-validator v3.0.0
Install plugin delete-project version v3.0.0 [y/N]? y
Installed delete-project v3.0.0
Install plugin download-commands version v3.0.0 [y/N]? y
Installed download-commands v3.0.0
Install plugin gitiles version v3.0.0 [y/N]? y
Installed gitiles v3.0.0
Install plugin hooks version v3.0.0 [y/N]? y
Installed hooks v3.0.0
Install plugin plugin-manager version v3.0.0 [y/N]? y
Installed plugin-manager v3.0.0
Install plugin replication version v3.0.0 [y/N]? y
Installed replication v3.0.0
Install plugin reviewnotes version v3.0.0 [y/N]? y
Installed reviewnotes v3.0.0
Install plugin singleusergroup version v3.0.0 [y/N]? y
Installed singleusergroup v3.0.0
Install plugin webhooks version v3.0.0 [y/N]? y
Installed webhooks v3.0.0
Initializing plugins. yInitialized /yinzhengjie/softwares/gerrit
Reindexing projects: % (/) with: reindex --site-path /yinzhengjie/softwares/gerrit --threads --index projects
Reindexed documents in projects index in .1s (23.0/s)
Executing /yinzhengjie/softwares/gerrit/bin/gerrit.sh start
Starting Gerrit Code Review: OK
Waiting for server on gerrit.yinzhengjie.org.cn: ... OK
Opening http://gerrit.yinzhengjie.org.cn/#/admin/projects/ ...FAILED
Open Gerrit with a JavaScript capable browser:
http://gerrit.yinzhengjie.org.cn/#/admin/projects/
[root@gerrit.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 172.30.1.81: *:*
LISTEN *: *:*
LISTEN *: *:*
LISTEN 172.30.1.81: *:*
LISTEN 127.0.0.1: *:*
LISTEN *: *:*
LISTEN ::: :::*
[root@gerrit.yinzhengjie.org.cn ~]#

2>.修改Gerrit配置文件,添加from字段

[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]# ll
total
drwxr-xr-x root root Jun : bin
drwxr-xr-x root root Jun : cache
drwxr-xr-x root root Jun : data
drwxr-xr-x root root Jun : db
drwxr-xr-x root root Jun : etc
drwxr-xr-x root root Jun : git
drwxr-xr-x root root Jun : index
drwxr-xr-x root root Jun : lib
drwxr-xr-x root root Jun : logs
drwxr-xr-x root root Jun : plugins
drwxr-xr-x root root Jun : static
drwx------ root root Jun : tmp
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]#
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]#
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]# cat etc/gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://gerrit.yinzhengjie.org.cn:8090/
serverId = 8102839b--4d4c-8e55-ecfe5c397833
[container]
javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
user = root
javaHome = /yinzhengjie/softwares/jdk1..0_201/jre
[index]
type = LUCENE
[auth]
type = HTTP
[receive]
enableSignedPush = false
[sendemail]
smtpServer = smtp.ym..com
smtpServerPort =
smtpUser = yinzhengjie@aggrx.com
from = yinzhengjie@aggrx.com
[sshd]
listenAddress = gerrit.yinzhengjie.org.cn:
[httpd]
listenUrl = proxy-http://gerrit.yinzhengjie.org.cn:8888/
[cache]
directory = cache
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]#
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]#
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]#
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]# ./bin/gerrit.sh restart
Stopping Gerrit Code Review: OK
Starting Gerrit Code Review: OK
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]#
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 172.30.1.81: *:*
LISTEN *: *:*
LISTEN *: *:*
LISTEN 172.30.1.81: *:*
LISTEN 127.0.0.1: *:*
LISTEN *: *:*
LISTEN ::: :::*
[root@gerrit.yinzhengjie.org.cn /yinzhengjie/softwares/gerrit]#

三.使用Gerrit Web UI发送邮件

1>.使用admin用户登陆

2>.点击设置

3>.设置发送邮箱地址为:yinzhengjie@aggrx.com

4>.邮箱发送成功

5>.登陆yinzhengjie@aggrx.com邮箱验证是否成功接收邮件

6>.查看测试邮件内容

 7>.根据链接点进去,可以发现邮件添加成功啦~

使用Gerrit发送测试邮件的更多相关文章

  1. wordpress发送测试邮件

    下面的邮箱设置使用了qq邮箱的设置 写上接收测试邮件的邮箱  再send test

  2. python3修改HTMLTestRunner,生成有截图的测试报告,并发送测试邮件(二)

    3. 如何将第一步得到的地址和名称 输入 进第二步里的表格中呢... 用上述查找元素的方法,发现HTMLTestRunner.py中REPORT_TEST_WITH_OUTPUT_TMPL是用来输出测 ...

  3. WordPress用户注册无法发送密码邮件怎么回事?

    wordpress无法发送电子邮件.可能原因:您的主机禁用了 mail() 函数 等等几句话.在网上一搜,很快找到了解决方案:使用wp-mail-smtp插件. 一.插件下载安装.可以在wordpre ...

  4. Python发送SMTP邮件指南

      SMTP(Simple Mail Transfer Protocol)简单邮件传输协议,Python内置对SMTP的支持,可以发送纯文本文件,HTML邮件以及附带文件.   一.两个模块 Pyth ...

  5. sql 邮件发送测试情况

    sql 邮件发送测试情况 select * from msdb.dbo.sysmail_allitems select * from msdb.dbo.sysmail_event_log

  6. MailUtils 测试邮件是否发送

    import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail ...

  7. jenkins构建邮件自动发送,测试邮件发送成功,构建项目邮件发送不成功的问题

    提示问题: Connection error sending email,retrying once more in 10 seconds…… Connection error sending ema ...

  8. CI框架使用PHPmail插件发送QQ邮件:

    有助请顶,不好请评.0:33 2016/3/12CI框架使用PHPmail插件发送QQ邮件:发送成功,不过修改了主机参数,还包含了一个phpmail中的一个另外的文件,详见下方:参见:http://c ...

  9. 5分钟 wamp下php phpmaile发送qq邮件 2015最新方法说明

    13:40 2015/11/20 5分钟 wamp下php phpmaile发送qq邮件 2015最新方法说明 关键点:现在qq邮箱开通smtp服务后会给你一个很长的独立新密码,发邮件配置中的密码需要 ...

随机推荐

  1. 【翻译】Flink Table Api & SQL — 配置

    本文翻译自官网:Configuration https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/table/config.h ...

  2. XT交易所Websocket API

    WebSocketAPI xt为用户提供了一个简单的而又强大的API,旨在帮助用户快速高效的将xt交易功能整合到自己应用当中. WebSocket服务地址 xt WebSocket服务连接地址:wss ...

  3. 元素高度变化使用动画transition

    高度变化,使用transition,没有效果,可以使用max-height替换. 思路: 初始元素max-height:0; 不显示,父元素hover时,重新设置元素的max-height的值, 可以 ...

  4. ArcGIS Server 10.2忘记用户名密码的解决方案

    忘记了ArcGIS Server Manager的密码,可以采用以下方法进行重置. 1.找到ArcGIS Server的安装目录 D:\Program Files\ArcGIS\Server\tool ...

  5. python:将时间戳格式化为yyyyMMdd hh:mm:ss

    import time #将10位时间戳或者13位转换为时间字符串,默认为2017-10-01 13:37:04格式 def timestamp_to_date(time_stamp, format_ ...

  6. mysql 8.0下的SELECT list is not in GROUP BY clause and contains nonaggregated column

    mysql的版本 mysql> select version();+-----------+| version() |+-----------+| 8.0.12 |+-----------+ 在 ...

  7. php imagick添加文字和图片的方法

    Imagick添加文字和图片的方法<pre><?php $image = new Imagick(); $image->readImage("/home/www/wo ...

  8. PHP7之Trait详解

    转自: https://www.jianshu.com/p/fc053b2d7fd1 php从以前到现在一直都是单继承的语言,无法同时从两个基类中继承属性和方法,为了解决这个问题,php出了Trait ...

  9. day50——js补充

    day50 前端内容回顾 HTML 标签分类 块级标签:div p h1-h6 form hr br ul li ol table标签 内联标签:span a img label input sele ...

  10. POI2015 WYC

    也许更好的阅读体验 \(\mathcal{Description}\) 给定一张n个点m条边的带权有向图,每条边的边权只可能是1,2,3中的一种.将所有可能的路径按路径长度排序,请输出第k小的路径的长 ...