From aa9a289ce55d5099e6a65f25e7c3b38f66148aca Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 11 Nov 2016 15:40:19 +0100 Subject: [PATCH 1/4] Make mail_room idle_timeout option configurable. --- config/gitlab.yml.example | 2 ++ config/mail_room.yml | 2 +- lib/gitlab/mail_room.rb | 1 + spec/config/mail_room_spec.rb | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 699ab6075b6..2da225904e1 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -138,6 +138,8 @@ production: &base # The mailbox where incoming mail will end up. Usually "inbox". mailbox: "inbox" + # The mailbox where incoming mail will end up. Usually "inbox". + idle_timeout: 60 ## Build Artifacts artifacts: diff --git a/config/mail_room.yml b/config/mail_room.yml index b026d510f1b..774c5350a45 100644 --- a/config/mail_room.yml +++ b/config/mail_room.yml @@ -15,7 +15,7 @@ :start_tls: <%= config[:start_tls].to_json %> :email: <%= config[:user].to_json %> :password: <%= config[:password].to_json %> - :idle_timeout: 60 + :idle_timeout: <%= config[:idle_timeout].to_json %> :name: <%= config[:mailbox].to_json %> diff --git a/lib/gitlab/mail_room.rb b/lib/gitlab/mail_room.rb index a5220d92312..3503fac40e8 100644 --- a/lib/gitlab/mail_room.rb +++ b/lib/gitlab/mail_room.rb @@ -31,6 +31,7 @@ module Gitlab config[:ssl] = false if config[:ssl].nil? config[:start_tls] = false if config[:start_tls].nil? config[:mailbox] = 'inbox' if config[:mailbox].nil? + config[:idle_timeout] = 60 if config[:idle_timeout].nil? if config[:enabled] && config[:address] gitlab_redis = Gitlab::Redis.new(rails_env) diff --git a/spec/config/mail_room_spec.rb b/spec/config/mail_room_spec.rb index 22bf3055538..294fae95752 100644 --- a/spec/config/mail_room_spec.rb +++ b/spec/config/mail_room_spec.rb @@ -47,6 +47,7 @@ describe 'mail_room.yml' do expect(mailbox[:email]).to eq('gitlab-incoming@gmail.com') expect(mailbox[:password]).to eq('[REDACTED]') expect(mailbox[:name]).to eq('inbox') + expect(mailbox[:idle_timeout]).to eq(60) redis_url = gitlab_redis.url sentinels = gitlab_redis.sentinels From 04f2dd65fb355eb3bf20e0d3deef9123132aacad Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 11 Nov 2016 15:49:51 +0100 Subject: [PATCH 2/4] Add idle_timeout to reply by email doc. --- config/gitlab.yml.example | 2 +- doc/administration/reply_by_email.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 2da225904e1..327e4a7937c 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -138,7 +138,7 @@ production: &base # The mailbox where incoming mail will end up. Usually "inbox". mailbox: "inbox" - # The mailbox where incoming mail will end up. Usually "inbox". + # The IDLE command timeout. idle_timeout: 60 ## Build Artifacts diff --git a/doc/administration/reply_by_email.md b/doc/administration/reply_by_email.md index 5a9a1582877..b42892eef68 100644 --- a/doc/administration/reply_by_email.md +++ b/doc/administration/reply_by_email.md @@ -105,6 +105,8 @@ To set up a basic Postfix mail server with IMAP access on Ubuntu, follow # The mailbox where incoming mail will end up. Usually "inbox". gitlab_rails['incoming_email_mailbox_name'] = "inbox" + # The IDLE command timeout. + gitlab_rails['incoming_email_idle_timeout'] = 60 ``` ```ruby @@ -133,6 +135,8 @@ To set up a basic Postfix mail server with IMAP access on Ubuntu, follow # The mailbox where incoming mail will end up. Usually "inbox". gitlab_rails['incoming_email_mailbox_name'] = "inbox" + # The IDLE command timeout. + gitlab_rails['incoming_email_idle_timeout'] = 60 ``` 1. Reconfigure GitLab and restart mailroom for the changes to take effect: @@ -192,6 +196,8 @@ To set up a basic Postfix mail server with IMAP access on Ubuntu, follow # The mailbox where incoming mail will end up. Usually "inbox". mailbox: "inbox" + # The IDLE command timeout. + email_idle_timeout: 60 ``` ```yaml @@ -221,6 +227,8 @@ To set up a basic Postfix mail server with IMAP access on Ubuntu, follow # The mailbox where incoming mail will end up. Usually "inbox". mailbox: "inbox" + # The IDLE command timeout. + email_idle_timeout: 60 ``` 1. Enable `mail_room` in the init script at `/etc/default/gitlab`: @@ -277,6 +285,8 @@ To set up a basic Postfix mail server with IMAP access on Ubuntu, follow # The mailbox where incoming mail will end up. Usually "inbox". mailbox: "inbox" + # The IDLE command timeout. + email_idle_timeout: 60 ``` As mentioned, the part after `+` is ignored, and this will end up in the mailbox for `gitlab-incoming@gmail.com`. From c44a77836a4f6f64888094ea3d393e87fc894403 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 16 Nov 2016 12:49:41 +0100 Subject: [PATCH 3/4] Add mail_room idle_timeout to the Changelog. --- changelogs/unreleased/mailroom_idle_timeout.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/unreleased/mailroom_idle_timeout.yml diff --git a/changelogs/unreleased/mailroom_idle_timeout.yml b/changelogs/unreleased/mailroom_idle_timeout.yml new file mode 100644 index 00000000000..276b28a56dd --- /dev/null +++ b/changelogs/unreleased/mailroom_idle_timeout.yml @@ -0,0 +1,4 @@ +--- +title: Allow mail_room idle_timeout option to be configurable +merge_request: 7423 +author: From c61a9b0f1a12972dd3c2ae4e968c11c72ced6756 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 16 Nov 2016 16:24:46 +0100 Subject: [PATCH 4/4] Correct the idle_timeout in the docs for installation from source. --- doc/administration/reply_by_email.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/administration/reply_by_email.md b/doc/administration/reply_by_email.md index b42892eef68..14cd7a03826 100644 --- a/doc/administration/reply_by_email.md +++ b/doc/administration/reply_by_email.md @@ -197,7 +197,7 @@ To set up a basic Postfix mail server with IMAP access on Ubuntu, follow # The mailbox where incoming mail will end up. Usually "inbox". mailbox: "inbox" # The IDLE command timeout. - email_idle_timeout: 60 + idle_timeout: 60 ``` ```yaml @@ -228,7 +228,7 @@ To set up a basic Postfix mail server with IMAP access on Ubuntu, follow # The mailbox where incoming mail will end up. Usually "inbox". mailbox: "inbox" # The IDLE command timeout. - email_idle_timeout: 60 + idle_timeout: 60 ``` 1. Enable `mail_room` in the init script at `/etc/default/gitlab`: @@ -286,7 +286,7 @@ To set up a basic Postfix mail server with IMAP access on Ubuntu, follow # The mailbox where incoming mail will end up. Usually "inbox". mailbox: "inbox" # The IDLE command timeout. - email_idle_timeout: 60 + idle_timeout: 60 ``` As mentioned, the part after `+` is ignored, and this will end up in the mailbox for `gitlab-incoming@gmail.com`.