GitLab电子邮件通知不发送 [英] GitLab email notifications not sending

查看:1386
本文介绍了GitLab电子邮件通知不发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在Ubuntu 12.04服务器上安装GitLab v5.0,现在有电子邮件通知的问题。我不能让GitLab发送任何电子邮件。



我有我的 config / environments / production.rb 文件设置使用sendmail作为传输服务:

  config.action_mailer.delivery_method =:sendmail 
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

我可以从shell中成功地手动使用sendmail,如下所述: http:// scratching 。/ / p>

我的配置/ gitlab.yml 文件设置为以下电子邮件设置:

  email_from:gitlab@myops.com 

我已经看到这可能是Sidekiq没有运行的问题,所以我运行了以下命令,没有任何改变..我仍然无法发送电子邮件:

  $ sudo -u git -H bundle exec rake sidekiq:start RAILS_ENV = production 
$ ps aux | grep - i sidekiq
git 2791 2.1 4.2 206476 86620 pts / 0 Sl 14:45 0:23 sidekiq 2.7.5 gitlab [0 of 25忙]

对我来说,Sidekiq确实在运行...这里还有什么问题?关于电子邮件设置,GitLab的wiki似乎没有太多的文档...



我发现在sidekiq.log中记录了以下错误:

  2013-04-24T21:09:01Z 2791 TID-1jaur8 Sidekiq :: Extensions :: DelayedMailer JID-21bd3ec0f086351088992396信息:start 
2013-04-24T21:09:01Z 2791 TID-1jaur8 Sidekiq :: Extensions :: DelayedMailer JID-21bd3ec0f086351088992396信息:失败:0.004秒
2013-04-24T21:09:01Z 2791 TID-1jaur8 WARN:{ class=>Sidekiq :: Extensions :: DelayedMailer,args=> [ - true= --\\\
-!ruby / class'Notify'\\\
-:new_user_email\\\
- - 4\\\
- pSzzULp8\\\
],at=> 1366819034.5969028jid=> 21bd3ec0f086351088992396,error_message=>找不到id = 4的用户,error_class=>ActiveRecord :: RecordNotFound,failed_at=>2013-04-24T15:57: 19Z,retry_count=> 10,retried_at=> 2013-04-24 21:09:01 UTC}
2013-04-24T21:09:01Z 2791 TID-1jaur8 WARN:找不到id = 4
的用户2013-04-24T21:09:01Z 2791 TID-1jaur8 WARN:/ home / git / gitlab /vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:343:in`find_one'
/ home / git / gitlab / vendor / bundle / ruby / 1.9.1 / gems / activerecord-3.2.13 / lib / active_record / relation / finder_methods.rb:314:在`find_with_ids'
/home/git/gitlab/vendor/bundle/ruby/1.9.1 $ / $ / $ / $ / 3.2.13 / lib / active_record / querying.rb:5:在`find'
/home/git/gitlab/app/mailers/notify.rb:23:in`new_user_email'
/ home / git / gitlab / vendor / bundle / ruby​​ / 1.9.1 / gems / actionpack-3.2.13 / lib / abstract_controller / base.rb:167:在'process_action'
/ home / git / gitlab / /ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in`process'
/ home / git / gitlab / vendor / bundle $ / $ / gems / actionmailer-3.2.13 / lib / action_mailer / base.rb:459:在'process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13 /lib/action_mailer/base.rb:453:in`initialize'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base。 rb:439:在`new'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:439:in`method_missing '
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/extensions/action_mailer.rb:20:in`执行'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:45:in'block(3 levels)in process'
/ home / git / gitlab / vendor / bundle / ruby​​ / 1.9.1 / gems / sidekiq-2.7.5 / lib / sidekiq / middleware / chain.rb:109:在`call'
/ home / git / gitlab /vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib /sidekiq/middleware/chain.rb:109:in`block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/中间件/服务器/ timeout.rb:11:在`block in call'
/usr/local/lib/ruby/1.9.1/timeout.rb:68:in`timeout'
/ home / git / gitlab / vendor / bundle / ruby​​ / 1.9.1 / gems / sidekiq-2.7.5 / lib / sidekiq / middleware / server / timeout.rb:10:在`call'
/ home / git / gitlab /vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in`block in invoke'
/ home / git / gitlab / vendor / bundle / ruby​​ / 1.9.1 / gems / sidekiq-2.7.5 / lib / sidekiq / middleware / server / active_record.rb:6:在`call'
/ home / git / gitlab / vendor / bundle / ruby /1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in`block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9。 1 / gems / sidekiq-2.7.5 / lib / sidekiq / middleware / server / retry_jobs.rb:49:在`call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems /sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in`block in invoke'
$ / $ / $ / $ home / git / gitlab / vendor / bundle / ruby​​ / 1.9.1 / gems / sidekiq-2.7.5 / lib / sidekiq / logging.rb:22:在`with_context'
/ home / git / gitlab / vendor
/ home / git / gitlab / vendor / bundles / ruby / 1.9.1 / gems / sidekiq-2.7.5 / lib / sidekiq / middleware / chain.rb:111:在`block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9 .1 / gems / sidekiq-2.7.5 / lib / sidekiq / middleware / chain.rb:114:在`call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/ sidekiq-2.7.5 / lib / sidekiq / middleware / chain.rb:114:在`invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5 /lib/sidekiq/processor.rb:44:in`block(2 levels)in process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/ lib / sidekiq / processor.rb:80:在`stats'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/ge ms / sidekiq-2.7.5 / lib / sidekiq / processor.rb:43:在'block in process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12 .4 / lib / celluloid / calls.rb:23:在`call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/ calls.rb:23:在`public_send'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `dispatch'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/future.rb:18:in`block in initialize'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in`call'
/ home / git / gitlab / vendor / bundle / ruby​​ / 1.9.1 / gems / celluloid-0.12.4 / lib / celluloid / internal_pool.rb:48:在`block in create'

任何想法?

解决方案

这是我的结尾在/config/environment/production.rb中,这对我来说是有效的。






评论发送sendmail选项并使用外部SMTP中继



  ## config.action_mailer.delivery_method =:sendmail ##注释此
#默认为:
## config.action_mailer.sendmail_settings = {
##:location => '/ usr / sbin / sendmail',
##:arguments => '-i -t'
##}

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

## SMTP设置
config.action_mailer.delivery_method =:smtp
config.action_mailer.smtp_settings = {
:address => '10 .146.10.90',##我的SMTP中继/网关
:port => 25,## SMTP Port
:domain => 'gitlab.example.com',##我的域
:authentication => :plain,##让它很简单,因为它在我的局域网内
##:user_name => 'gitlab@yourserver.com',##只要
##:password =>就不需要'yourPassword',## SMTP网关允许匿名中继
##:enable_starttls_auto => true ##在LAN
##:user_name => '',
##:password => '',
:enable_starttls_auto => true
}
end





I just recently install GitLab v5.0 on an Ubuntu 12.04 server and am now having issues with email notifications. I can't get GitLab to send any emails of any kind.

I've got my config/environments/production.rb file setup to use sendmail as the transport service:

config.action_mailer.delivery_method = :sendmail
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

And I can manually use sendmail successfully from the shell as described here: http://scratching.psybermonkey.net/2011/03/sendmail-how-to-test-sending-email.html

My config/gitlab.yml file is setup with the following email setting:

email_from: gitlab@myops.com

I've read that it could be a problem with Sidekiq not running so I ran the following command but nothing has changed.. I still can't send emails:

$ sudo -u git -H bundle exec rake sidekiq:start RAILS_ENV=production
$ ps aux |grep -i sidekiq
git       2791  2.1  4.2 206476 86620 pts/0    Sl   14:45   0:23 sidekiq 2.7.5 gitlab [0 of 25 busy] 

Which indicates to me that Sidekiq is indeed running... what else could be the issue here? There doesn't seem to be much documentation on GitLab's wiki regarding email settings unfortunately...

I found the following error being logged in sidekiq.log:

2013-04-24T21:09:01Z 2791 TID-1jaur8 Sidekiq::Extensions::DelayedMailer JID-21bd3ec0f086351088992396 INFO: start
2013-04-24T21:09:01Z 2791 TID-1jaur8 Sidekiq::Extensions::DelayedMailer JID-21bd3ec0f086351088992396 INFO: fail: 0.004 sec
2013-04-24T21:09:01Z 2791 TID-1jaur8 WARN: {"retry"=>true, "queue"=>"default", "timeout"=>30, "class"=>"Sidekiq::Extensions::DelayedMailer", "args"=>["---\n- !ruby/class 'Notify'\n- :new_user_email\n- - 4\n - pSzzULp8\n"], "at"=>1366819034.5969028, "jid"=>"21bd3ec0f086351088992396", "error_message"=>"Couldn't find User with id=4", "error_class"=>"ActiveRecord::RecordNotFound", "failed_at"=>"2013-04-24T15:57:19Z", "retry_count"=>10, "retried_at"=>2013-04-24 21:09:01 UTC}
2013-04-24T21:09:01Z 2791 TID-1jaur8 WARN: Couldn't find User with id=4
2013-04-24T21:09:01Z 2791 TID-1jaur8 WARN: /home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:343:in `find_one'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:314:in `find_with_ids'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:107:in `find'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/querying.rb:5:in `find'
/home/git/gitlab/app/mailers/notify.rb:23:in `new_user_email'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:459:in `process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:453:in `initialize'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:439:in `new'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:439:in `method_missing'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/extensions/action_mailer.rb:20:in `perform'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:45:in `block (3 levels) in process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:109:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:109:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/timeout.rb:11:in `block in call'
/usr/local/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/timeout.rb:10:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/retry_jobs.rb:49:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/logging.rb:22:in `with_context'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:114:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:114:in `invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:44:in `block (2 levels) in process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:80:in `stats'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:43:in `block in process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `public_send'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `dispatch'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/future.rb:18:in `block in initialize'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in `block in create'

Any ideas?

解决方案

This is my entries at the end in /config/environment/production.rb and that is working for me.


Comment out sendmail options and use external SMTP relays

  ##config.action_mailer.delivery_method = :sendmail ## Comment out this
  # Defaults to:
  ## config.action_mailer.sendmail_settings = {
  ##   :location => '/usr/sbin/sendmail',
  ##   :arguments => '-i -t'
  ## }

  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true

  ## SMTP Settings
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address => '10.146.10.90', ## My SMTP Relay/Gateway
      :port => 25, ## SMTP Port
      :domain => 'gitlab.example.com', ## My Domain
      :authentication => :plain, ## Let it be plain as it is inside my LAN
      ##:user_name => 'gitlab@yourserver.com', ## This is not required as long as 
      ##:password => 'yourPassword', ## SMTP Gateway allows anonymous relay
      ##:enable_starttls_auto => true ## In LAN
      ##:user_name => '',
      ##:password => '',
      :enable_starttls_auto => true
  }
end


这篇关于GitLab电子邮件通知不发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆