web-dev-qa-db-ja.com

GitLabメール通知が送信されない

最近、GitLab v5.0をUbuntu 12.04サーバーにインストールしましたが、メール通知で問題が発生しています。 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

ここで説明するように、シェルからsendmailを手動で正常に使用できます: http://scratching.psybermonkey.net/2011/03/sendmail-how-to-test-sending-email.html

ぼくの config/gitlab.ymlファイルは、次のメール設定でセットアップされます。

email_from: [email protected]

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 busy] 

これは、Sidekiqが実際に実行されていることを私に示しています...ここで他に何が問題になる可能性がありますか?残念ながら、GitLabのwikiには、電子メール設定に関するドキュメントがあまりないようです...

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'

何か案は?

14
sadmicrowave

これは/config/environment/production.rbの最後にある私のエントリであり、私にとってはうまくいきます。


Sendmailオプションをコメント化し、外部SMTPリレーを使用する

  ##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 => '[email protected]', ## 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

8
Girish KG

CentOSでは、これは私に役立ちました:

ファイル/home/git/gitlab/config/environments/production.rbを確認してください(本番環境で実行している場合は、それが標準です)

そこでsendmailの設定を変更できます。 -tパラメータを削除してみてください。修正されました!一部のメールサーバーはこのパラメーターを受け入れません(確実にメールログを確認してください)

  config.action_mailer.sendmail_settings = {
    :location => '/usr/sbin/sendmail',
    :arguments => '-i'
  }
3
Roy B.