使用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. SVM – 回归

    SVM的算法是很versatile的,在回归领域SVM同样十分出色的.而且和SVC类似,SVR的原理也是基于支持向量(来绘制辅助线),只不过在分类领域,支持向量是最靠近超平面的点,在回归领域,支持向量 ...

  2. java自定义jar包让jemeter使用

    背景:可能在做定义化的要求上,jmeter原有的jar包,已经不能满足我们,就需要自己写一个方法,以下就是写入的一个模拟post的请求,在jmeter中使用的案例 一:写代码 1.代码中的有两个包,原 ...

  3. iOS - 截取数组前几个元素放入新的数组,剩余的放入另外一个数组

    NSArray *array = [NSArray arrayWithObjects:@"Crystal",@"Maisie",@"Lukas&quo ...

  4. Linux CentOS7 下无图形界面安装Oracle11G R2版本

    01,系统 Centos7 数据库版本 Oracle_11gR2 ,以及硬件要求 内存不能小于 1G,可用硬盘不小于8G Swap分区空间不小于2G grep MemTotal /proc/memin ...

  5. linux 下core文件生成、路径、格式设置及调试

    core文件生成及调试1 代码 #include<stdio.h> int main() { int *p = NULL; *p = 0; return 0; } 2 在当前shell执行 ...

  6. kubernetes之Scheduler原理分析

    scheduler在整个系统承担了承上启下的重要功能 承上值负责接受Controller Manager创建新的pod,安排目标Node 旗下指安置工作完成后,目标Node上的kubelet服务进程接 ...

  7. 机器学习中什么是端到端的学习(end-to-end learning)?

    相对于深度学习,传统机器学习的流程往往由多个独立的模块组成,比如在一个典型的自然语言处理(Natural Language Processing)问题中,包括分词.词性标注.句法分析.语义分析等多个独 ...

  8. python学习-29 map函数-filter函数

    movie_person = ['小红','小明','小王','富豪_sb','美女_sb'] def filter_test(array): ret = [] for i in array: if ...

  9. 个人学习笔记:C语言程序结构

    个人笔记:C语言程序 函数 语句 输入输出对象 标识符 关键字 函数 一个C语言源程序,是由一个或多个函数定义顺序组成的,其中必须有一个函数名为main的主函数.C语言源程序中的函数是指完成特定数据处 ...

  10. [译] QUIC Wire Layout Specification - Frame Types and Formats | QUIC协议标准中文翻译(4) 帧类型和格式

    欢迎访问我的个人网站获取更好的阅读排版体验: [译] QUIC Wire Layout Specification - Frame Types and Formats | QUIC协议标准中文翻译(4 ...