2012-05-21 3 views
32

gitlab.ymlで次の構成となっている。gitlabのメールセットアップ

email: 
    from: [email protected] 
    host: gitlabhq.com 

しかし、私は別のメールサーバーを使用する他の変数(ホスト、ポート、ユーザー、パスワードなど)を指定する必要があります。

どうすればいいですか?

+0

私は同じソリューションを探していますが。もっと良い方法が見つかったら教えてください –

+0

gitlabを実行しているホストに単純なSMTPリレーをインストールすることはできませんか?認証されたメールサーバを使用してメールを中継するように設定することができます –

+0

ここをご覧ください:http://stackoverflow.com/questions/16201090/gitlab-email-notifications-not-sending/16690884#16690884 - ---- –

答えて

10

これも私を混乱させる。しかし、メール設定を変更するにはconfig/environments/production.rbで編集してください。通常のrailsアプリケーションのようにconfig.action_mailer.smtp_settingsを追加するだけです。

5

gitlab.ymlemail:host:の設定は、実際にはメールサーバー/ SMTPホスト用ではありません。あなたのGitlabホストへのリンクを電子メールで作成するのに使われます。私たちはgitlabサーバ 'gitlab.local'と呼んでいます(そしてDNSエントリを持っています)ので、コンフィグレーションはhost: gitlab.localです。

このように、ユーザーがGitlabから電子メールを受信すると、リンクはhttp://localhost/にリンクするのではなく、デフォルトでは機能します。

そこにはいくつかの冗長構成があります。 Gitlab内でgitクローンURLが正しく表示されるようにするには、同じホスト名でweb:host:git_host:host:を設定する必要があります。

web: 
    host: gitlab.local 
    port: 80 
    https: false 

email: 
    host: gitlab.local 
    protocol: http 

git_host: 
    host: gitlab.local 

HTTPSを使用している場合は、web:https:web:port:、およびemail:protocol:を変更。

+0

この回答はGitLabローカルのVMから送信されたGitLabアカウントの招待メールに適切なリンクを設定する独自のシナリオで役に立ちました。私がここに投稿した質問/回答を見てください:http://stackoverflow.com/questions/24589361/how-to-change-the-host-ip-sent-in-emails-to-new-gitlab-users-to-a -publicly-visib –

30

注::このメソッドは、古いバージョンのGitlabで便利でした。新しいバージョンのGirishのSee the answerあなたはこのような何かを追加することができますproduction.rb設定/環境/の終わりに


config.action_mailer.delivery_method = :smtp 
    config.action_mailer.smtp_settings = { 
     :address => 'yourserver.com', 
     :port => 25, 
     :domain => 'gitlab.yourserver.com', 
     :authentication => :plain, 
     :user_name => '[email protected]', 
     :password => 'yourPassword', 
     :enable_starttls_auto => true 
    } 

が可能な構成のより詳細な説明についてはactionmailerのマニュアルを参照してください:http://api.rubyonrails.org/classes/ActionMailer/Base.html

注::Gitlabアップデート後に再度ファイルを編集する必要がある可能性があります。

+4

注: ':authentication =>:login'または':cram_md5'が必要かもしれません。また、tls/sslがあなたのメールサーバで使用されていないときは 'enable_starttls_auto => false'を使うべきです通常ポートが上記のように25の場合) – ocodo

+1

これは動作しますが、Girish KGの提案したものよりもクリーンなオプションです。 production.rbファイルを変更した場合、gitによってgitlabをアップグレードする際に問題が発生する可能性があります。アップグレードを成功させるには、いくつかのリポジトリの競合を処理する必要があります。 – ProtheanTom

3

これは/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 

+1

ダウンワードの人は、なぜ彼らがdownvotedを言ってコメントを追加してください。だから、他の人がなぜこの作者の方法がうまくいかないのか理解できない/それが最善ではない。お願いします。 –

+0

これはすべて/etc/gitlab/gitlab.rbファイルで実行できますか? – unc0nnected

40

は、今では5.2+ Gitlabでは全く異なっています。

「/home/git/gitlab/config/initializers/smtp_settings.rb.sample」にあり、その指示に従うだけです。

+0

これは正しいです。デフォルトのインストールにはsmtp_settings.rb.sampleはありません。しかし、あなたはgithub – look

+0

からそれを得ることができ、後置を設定する必要がありますか?バージョン6.3.1の – janwen

+3

ファイルは/home/git/gitlab/config/initializers/smtp_settings.rb.sampleに移動されました – damko

6

Gitlab> 7つのオムニバスについては、以下のように/etc/gitlab/gitlab.rbを編集してsudo gitlab-ctl reconfigure

gitlab_rails['smtp_enable'] = true 
gitlab_rails['smtp_address'] = "smtp.server" 
gitlab_rails['smtp_port'] = 465 
gitlab_rails['smtp_user_name'] = "smtp user" 
gitlab_rails['smtp_password'] = "smtp password" 
gitlab_rails['smtp_domain'] = "example.com" 
gitlab_rails['smtp_authentication'] = "login" 
gitlab_rails['smtp_enable_starttls_auto'] = true 
gitlab_rails['smtp_openssl_verify_mode'] = 'none' 

出典実行します。https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md