Rufus-scheduler configuration to create incidents from mail
Added by Eduardo HM over 3 years ago
Good afternoon everyone,
I have the following Redmine environment:
Environment: Redmine version 4.1.0.stable Ruby version 2.3.8-p459 (2018-10-18) [x86_64-linux] Rails version 5.2.4.1 Environment production Database adapter Mysql2 Mailer queue ActiveJob :: QueueAdapters :: AsyncAdapter Mailer delivery smtp
I have achieved that by command line, when launching the "receive_imap" task, the emails are processed and the incidents are correctly created in the project that I designate in redmine. The example of the command that I launch through the CLI is the following:
rake -f / var / www / redmine / Rakefile redmine: email: receive_imap RAILS_ENV = "production" ssl = 1 port = 993 host = mail.mydomain.com username = XXXXX password = YYYYY allow_override = all move_on_success = redmine_success move_on_failure = redmine_failure = redmine_failure project = test-mail
If I put this inside the crontab, it doesn't do anything to me.
I have read that it is recommended to use rufus-scheduler. I have followed the steps, installing the gem, adding it to the GemFile file, I have created the file to schedule mail processing every x minutes as shown below:
require 'rubygems' require 'rake' require 'rufus-scheduler' load File.join (Rails.root, 'Rakefile') ENV ['host'] = 'mail.mydomian.org' ENV ['port'] = '993' ENV ['ssl'] = '1' ENV ['username'] = 'XXXX' ENV ['password'] = 'YYYYY' ENV ['project'] = 'test-mail' ENV ['allow_override'] = 'all' ENV ['move_on_success'] = 'redmine_success' ENV ['move_on_failure'] = 'redmine_failure' scheduler = Rufus :: Scheduler.new # Check emails every 10 mins scheduler.interval '5m' c task = Rake.application ['redmine: email: receive_imap'] task.reenable task.invoke end
This file I have put into config / initializers and I have restarted the redmine service. After a few minutes, I don't see any mail being processed. What do I have wrongly configured?
Thanks in advanced!!
Replies (2)
RE: Rufus-scheduler configuration to create incidents from mail - Added by Liane Hampe over 3 years ago
Hi Eduardo
There are serveral things which could cause your problems. You can check the following:
1) Cron
The cron jobs needs to be run by the user who runs redmine on your server.
2) Rufus scheduler
a) Rufus scheduler does not play nicely with passenger due to its spawning process feature. You can read it here: https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/#smart-spawning-faq.
b) Probably you need to require 'redmine/imap' too. You can check that in your logs.
Regards
Liane
RE: Rufus-scheduler configuration to create incidents from mail - Added by Eduardo HM over 3 years ago
Thank you very much for the quick answer,
what I needed to make it work with rufus-scheduler was to add "require redmine / imap" at the beginning of the file where the task scheduler is configured.
This is missing in the documentation that Redmine puts to configure this part.
Thank you very much again for the help
Best regards.