Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

AWS Server: Mailman Shuts Down? #101

Open
ays0110 opened this issue Jun 6, 2014 · 4 comments
Open

AWS Server: Mailman Shuts Down? #101

ays0110 opened this issue Jun 6, 2014 · 4 comments

Comments

@ays0110
Copy link

ays0110 commented Jun 6, 2014

Not a bug, but any advice on what to do if you're running mailman on an AWS server, and mailman keeps shutting down? I'm trying to have a mailman always live and listening to messages, but mailman keeps terminating after 24 hours or so? The longest it's been continuously live was about 36 hours.

I'm not sure what's causing this, I don't see an error that crashed it in the logs, so I'm assuming it just decided to shut down?

@KieranP
Copy link
Contributor

KieranP commented Jun 10, 2014

It can crash for a number of reasons, such as syntax errors, stale DB connections, or other reasons. This is what we do within our Ruby on Rails app to keep it running 24/7. It's in a script mailman_server which we restart with each deploy:

#!/usr/bin/env ruby

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require "daemons"
require "mailman"

pid_dir ||= Rails.root.join("tmp/pids")
Dir.mkdir(pid_dir) unless File.exists?(pid_dir)

Daemons.run_proc("mailman_server", :dir => pid_dir, :dir_mode => :normal) do
  begin
    Mailman.config.logger = Logger.new(Rails.root.join("log/mailman.log"))
    Mailman.config.pop3 = { ... }
    Mailman.config.poll_interval = 60
    Mailman.config.ignore_stdin = true

    Mailman::Application.run do
      to(/.........../) do
        ActiveRecord::Base.verify_active_connections!
        # Your logic here
      end
    end
  rescue Net::POPAuthenticationError
    retry # Error is temporary - simply keep retrying it
  rescue => exception
    # The Mailman process has thrown an error and stopped.
    Airbrake.notify(exception) # Report it
    retry                      # Restart it
  end
end

Hope this helps.

@devjj
Copy link

devjj commented Aug 13, 2014

We're getting ready to deploy mailman in production and we're using upstart to launch it and keep it running. You can run just about any ruby daemon - including mailman - with this strategy. Here's a decent writeup: http://www.alexreisner.com/code/upstart

@goravbhootra
Copy link

ActiveRecord::Base.verify_active_connections! - this is deprecated in Rails 4.

@Mic92
Copy link
Contributor

Mic92 commented Dec 21, 2014

Does this still happens with this commit? 814b31d

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants