Merge branch '1363-redo-mailroom-support' into 'master'

Use bundled `mail_room config` from gitlab-rails

Closes #1363

See merge request !1342
This commit is contained in:
Marin Jankovski 2017-02-22 10:36:52 +00:00
commit 5511b24618
2 changed files with 4 additions and 57 deletions

View File

@ -1,48 +0,0 @@
:mailboxes:
<%
require "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/mail_room" unless defined?(Gitlab::MailRoom)
config = Gitlab::MailRoom.config
if Gitlab::MailRoom.enabled?
%>
-
:host: <%= config[:host].to_json %>
:port: <%= config[:port].to_json %>
:ssl: <%= config[:ssl].to_json %>
:start_tls: <%= config[:start_tls].to_json %>
:email: <%= config[:user].to_json %>
:password: <%= config[:password].to_json %>
:idle_timeout: <%= config[:idle_timeout].to_json %>
:name: <%= config[:mailbox].to_json %>
:delete_after_delivery: true
:delivery_method: sidekiq
:delivery_options:
:redis_url: <%= config[:redis_url].to_json %>
:namespace: <%= Gitlab::Redis::SIDEKIQ_NAMESPACE %>
:queue: email_receiver
:worker: EmailReceiverWorker
<% if config[:sentinels] %>
:sentinels:
<% config[:sentinels].each do |sentinel| %>
-
:host: <%= sentinel[:host] %>
:port: <%= sentinel[:port] %>
<% end %>
<% end %>
:arbitration_method: redis
:arbitration_options:
:redis_url: <%= config[:redis_url].to_json %>
:namespace: <%= Gitlab::Redis::MAILROOM_NAMESPACE %>
<% if config[:sentinels] %>
:sentinels:
<% config[:sentinels].each do |sentinel| %>
-
:host: <%= sentinel[:host] %>
:port: <%= sentinel[:port] %>
<% end %>
<% end %>
<% end %>

View File

@ -17,15 +17,10 @@
user = AccountHelper.new(node).gitlab_user
mailroom_log_dir = node['gitlab']['mailroom']['log_directory']
mail_room_config = File.join(node['gitlab']['gitlab-rails']['dir'], "etc", "mail_room.yml")
GITLAB_RAILS_SOURCE_DIR = '/opt/gitlab/embedded/service/gitlab-rails'.freeze
# mail_room reads YAML-embedded ERB files, and this config file loads the GitLab Rails stack.
# See: https://github.com/tpitale/mail_room/commit/d0cb7d2d9ecfb109f62f673dd907673777e04740
# It does NOT work as a cookbook template at the moment.
cookbook_file mail_room_config do
notifies :restart, 'service[mailroom]'
end
mailroom_log_dir = node['gitlab']['mailroom']['log_directory']
mail_room_config = File.join(GITLAB_RAILS_SOURCE_DIR, 'config', 'mail_room.yml')
directory mailroom_log_dir do
owner user
@ -44,7 +39,7 @@ runit_service 'mailroom' do
end
if node['gitlab']['bootstrap']['enable']
execute "/opt/gitlab/bin/gitlab-ctl start mailroom" do
execute '/opt/gitlab/bin/gitlab-ctl start mailroom' do
retries 20
end
end