前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >gitlab配置邮件通知功能操作记录

gitlab配置邮件通知功能操作记录

作者头像
洗尽了浮华
发布2018-01-23 10:56:45
2K0
发布2018-01-23 10:56:45
举报
文章被收录于专栏:散尽浮华散尽浮华

之前已经介绍了gitlab的部署http://www.cnblogs.com/kevingrace/p/5651402.html 但是没有配置邮箱通知功能,今天这里介绍下gitlab安装后的邮箱配置操作:

注意几点: 1)登陆gitlab后,只能在admin管理员账号下创建新账号,一般来说,创建好新账号后,会自动给新账号预留的邮箱发送通知邮件,点击邮件中的链接进行激活,首次登陆gitlab会进行密码设置。 2)如果不想在通知邮件里修改密码或没收到邮件,也可以绕过这一步。即在新账号创建后,在管理员状态下“编辑”新账号,设置一个密码,这个是初始密码。然后登陆新账号,这时候登陆后会强制进行初始密码的修改。

邮箱通知功能开通后,除了上面可以发送新建账号的激活邮件,还可以让用户通过邮箱注册gitlab,然后在管理员账号下对新注册账号进行project和group等权限授予。 这个有点不太安全,后续会介绍gitlab+openldap对接的操作记录,跟openldap结合后,gitlab的登陆就只能是LDAP方式了,邮箱注册功能就会失效!

废话不多说了,下面是gitlab开通邮箱通知功能的操作记录:

这里测试使用的是阿里云的企业邮箱 假设通知邮件的邮箱名为ops@wangshibo.cn,密码为zh@123bj 主要修改gitlan的三个文件,邮箱相关设置如下: 1)编辑/opt/gitlab-8.8.4-0/apps/gitlab/htdocs/config/gitlab.yml文件,开通email邮件功能 [root@test-huanqiu ~]# vim /opt/gitlab-8.8.4-0/apps/gitlab/htdocs/config/gitlab.yml ......... email_enabled: true # Email address used in the "From" field in mails sent by GitLab email_from: ops@wangshibo.cn #email_display_name: GitLab #email_reply_to: noreply@example.com ........

2)编辑/opt/gitlab-8.8.4-0/apps/gitlab/htdocs/config/initializers/smtp_settings.rb.sample文件 [root@test-huanqiu ~]# vim /opt/gitlab-8.8.4-0/apps/gitlab/htdocs/config/initializers/smtp_settings.rb.sample ........ ActionMailer::Base.smtp_settings = { address: "smtp.wangshibo.cn", port: 25, user_name: "ops@wangshibo.cn", password: "zh@123bj", domain: "wangshibo.cn", authentication: :login, enable_starttls_auto: true, openssl_verify_mode: 'none' # See ActionMailer documentation for other possible options } .......

3)编辑/opt/gitlab-8.8.4-0/apps/gitlab/htdocs/config/environments/production.rb文件,添加下面标红的几行内容,设置smtp模式 [root@test-huanqiu ~]# vim /opt/gitlab-8.8.4-0/apps/gitlab/htdocs/config/environments/production.rb ....... config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.wangshibo.cn", :port => "25", :domain => "wangshibo.cn", :authentication => :plain, :user_name => "ops@wangshibo.cn", :password => "zh@123bj", :enable_starttls_auto => true }

config.eager_load = true

config.allow_concurrency = false .......

最后,重启gitlab相关服务 [root@localhost gitlab-8.8.4-0]# pwd /opt/gitlab-8.8.4-0 [root@localhost gitlab-8.8.4-0]# ./ctlscript.sh restart

------------------------------------------------------------------------ 下面是腾讯企业邮箱的一个配置: 假设腾讯企业邮箱是:noreply@wangshibo.com,密码是H8*Cy9wXn8$SuhbT 1)gitlab.yml文件配置 ...... email_enabled: true # Email address used in the "From" field in mails sent by GitLab email_from: noreply@wangshibo.com #email_display_name: GitLab #email_reply_to: noreply@wangshibo.com ...... 2)smtp_settings.rb 文件配置 ..... ActionMailer::Base.smtp_settings = { address: "smtp.exmail.qq.com", port: 25, user_name: "noreply@wangshibo.com", password: "H8*Cy9wXn8$SuhbT", domain: "smtp.qq.com", authentication: :plain, enable_starttls_auto: true, openssl_verify_mode: 'none' # See ActionMailer documentation for other possible options } 3)production.rb文件配置 ...... config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.exmail.qq.com", :port => "25", :domain => "smtp.qq.com", :authentication => :plain, :user_name => "noreply@wangshibo.com", :password => "H8*Cy9wXn8$SuhbT", :enable_starttls_auto => true }

config.eager_load = true

config.allow_concurrency = false

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-11-29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
访问管理
访问管理(Cloud Access Management,CAM)可以帮助您安全、便捷地管理对腾讯云服务和资源的访问。您可以使用CAM创建子用户、用户组和角色,并通过策略控制其访问范围。CAM支持用户和角色SSO能力,您可以根据具体管理场景针对性设置企业内用户和腾讯云的互通能力。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档