使用Gerrit发送测试邮件
使用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发送测试邮件的更多相关文章
- wordpress发送测试邮件
下面的邮箱设置使用了qq邮箱的设置 写上接收测试邮件的邮箱 再send test
- python3修改HTMLTestRunner,生成有截图的测试报告,并发送测试邮件(二)
3. 如何将第一步得到的地址和名称 输入 进第二步里的表格中呢... 用上述查找元素的方法,发现HTMLTestRunner.py中REPORT_TEST_WITH_OUTPUT_TMPL是用来输出测 ...
- WordPress用户注册无法发送密码邮件怎么回事?
wordpress无法发送电子邮件.可能原因:您的主机禁用了 mail() 函数 等等几句话.在网上一搜,很快找到了解决方案:使用wp-mail-smtp插件. 一.插件下载安装.可以在wordpre ...
- Python发送SMTP邮件指南
SMTP(Simple Mail Transfer Protocol)简单邮件传输协议,Python内置对SMTP的支持,可以发送纯文本文件,HTML邮件以及附带文件. 一.两个模块 Pyth ...
- sql 邮件发送测试情况
sql 邮件发送测试情况 select * from msdb.dbo.sysmail_allitems select * from msdb.dbo.sysmail_event_log
- MailUtils 测试邮件是否发送
import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail ...
- jenkins构建邮件自动发送,测试邮件发送成功,构建项目邮件发送不成功的问题
提示问题: Connection error sending email,retrying once more in 10 seconds…… Connection error sending ema ...
- CI框架使用PHPmail插件发送QQ邮件:
有助请顶,不好请评.0:33 2016/3/12CI框架使用PHPmail插件发送QQ邮件:发送成功,不过修改了主机参数,还包含了一个phpmail中的一个另外的文件,详见下方:参见:http://c ...
- 5分钟 wamp下php phpmaile发送qq邮件 2015最新方法说明
13:40 2015/11/20 5分钟 wamp下php phpmaile发送qq邮件 2015最新方法说明 关键点:现在qq邮箱开通smtp服务后会给你一个很长的独立新密码,发邮件配置中的密码需要 ...
随机推荐
- Springboot中IDE支持两种打包方式,即jar包和war包
Springboot中IDE支持两种打包方式,即jar包和war包 打包之前修改pom.xml中的packaging节点,改为jar或者war 在项目的根目录执行maven 命令clean pa ...
- Docker是什么?
Docker是什么? Docker是一个虚拟环境容器,可以将你的环境.代码.配置文件等一并打包到这个容器中,并发布和应用到任意平台中.比如,你在本地部署了git,jenkins等,可以将其与插件一并打 ...
- Java之输入和输出
输出 在前面的代码中,我们总是用System.out.println()来向屏幕输出一些内容: println是print line的缩写,表示输出并换行.因此,如果输出后不想换行,可以用print( ...
- 【并行计算-CUDA开发】OpenACC与OpenHMPP
在西雅图超级计算大会(SC11)上发布了新的基于指令的加速器并行编程标准,既OpenACC.这个开发标准的目的是让更多的编程人员可以用到GPU计算,同时计算结果可以跨加速器使用,甚至能用在多核CPU上 ...
- 关于docker的scratch镜像与helloworld
关于docker的scratch镜像与helloworld 参考:https://hub.docker.com/_/scratch?tab=description 参考:https://segment ...
- ReflectionUtils.invokeMethod的作用
Object invokeMethod(Method method, Object target, Object... args)在指定对象(target)上,使用指定参数(args),执行方法(me ...
- 浅析 Java 中的继承和重写
浅析 Java 中的继承和重写 Java 中的构造方法不能被继承. Java 中 static 修饰的方法可以被继承,但不能被子类重写. Java 中 final 修饰方法不允许被子类重写,但是可以被 ...
- 21 Oracle 数据库的安装教程
1.百度网盘中下载oracle 11g的安装包 win64_11gR2_database 解压后: 2.安装过程 <1>双击setup.exe,等待一会(2分钟左右),跳出如下界面. 点击 ...
- C++工程师养成 每日一题(string使用)
题目: 题目来源牛客网:https://www.nowcoder.com/practice/f0db4c36573d459cae44ac90b90c6212?tpId 输入两个字符串,从第一字符串中删 ...
- ETCD服务
ETCD 简介 ETCD是一个开源的.分布式的键值对数据存储系统,由Go语言实现,用于存储key-value键值对,同时不仅仅是存储,主要用途是提供共享配置及服务发现,使用Raft一致性算法来管理高度 ...