dovecot mdbox

Discussion in 'Developers' Forum' started by ispcomm, Apr 25, 2014.

  1. ispcomm

    ispcomm Member

    I have the need to change the dovecot backing store from the default Maildir format into mdbox (maildir does not really scale well).

    It is easy to modify dovecot's configuration files so that it uses mdbox as its storage, but I would like to contribute back the changes to ispconfig in a way that it is incorporated in the main code.

    What would be the best direction in which I shall move? Shall this be a gui setting or perhaps a setting during setup and/or what ?

    And further, is there an interest for such a mod ?

    ispcomm.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I think this should be a setting under System > server config > mail. We try to let the installer ask as few questions as possible.

    Sounds like a interesting feature. I planned to try this out mysqlf some time ago but never found the time to actually do it.
     
  3. ispcomm

    ispcomm Member

    Hello Till,
    This is good news for me. I'm at a point where multiple servers and shared storage (nfs or similar) don't cut it any more. clustered filesystems require the usage of as little files as possible, hence the need for mdbox.

    I understand your point. It must be an easy setup for the novice, but configurable for the expert too.

    There is one catch with changing the backend store for dovecot and this is the conversion of existing mails from one format to the other.

    This conversion is not 100% safe and needs a little manual work (specially if there are active users on the system). I suggest that this conversion shall be leaved outside of the gui.

    On the other side, if the switch to mdbox is made right after the install of the mail server, there is nothing to convert, hence an easy thing to do.

    On the tecnical details, using mdbox instead of Maildir is as easy as changing the user_query in dovecot-sql.conf as follows:

    Maildir:
    Code:
    user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
    Mdbox:
    Code:
    user_query = SELECT email as user, maildir as home, CONCAT('mdbox:', maildir, '/mdbox') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
    This is the change I did to my servers to allow for mdbox.

    However, as this is an external config (fixed) ispconfig needs to be modified to store the format in the "maildir" column or an extra column shall be added, say "mbox_fmt" with values "mdbox" or "Maildir" and the query shall be something like:

    Code:
    user_query = SELECT email as user, maildir as home, CONCAT(mbox_fmt,':', maildir, '/', mbox_fmt) as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
    I prefer this second solution (which requires a db update) because this makes it easy to convert users one at a time, even when these users are live and using the store.

    You just need to convert the mailboxes one at a time and change the corresponding record in the db (a piece of cake).

    As an extension, the mbox_fmt could be accessible on a per-user basis from the gui. I'm not sure if this is useful or needed (I think not).

    It could however be very useful to be able to specify the mailbox format for the API, so than a mailbox conversion script could take over the conversion.

    I'd love you to share your toughts.

    ispcomm.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I think the option with having a column for the mbox format is a good idea. We do not have to show this info in the mailbox settings to the client, it would only confuse them anyway and they should not be able to change that. We can then use the setting in System > Server config > mail as a kind of default value for new mailboxes. so old onse are never changed, except a admin does this e.g. when he wants to convert them, and new mailboxes are always created in the format that is set in system config.
     
  5. ispcomm

    ispcomm Member

    I'm trying to fork ispconfig on http://git.ispconfig.org/ but it fails with

    Do I need special permissions ?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The permissions should be ok. Let me check that on the server.
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    I just checked the server and forking sems to work. Please delete your fork in gitlab and try to create a new one.
     
  8. ispcomm

    ispcomm Member

    I actually don't have a fork. I go to the project named "ispconfig/ispconfig 3" and click on the "fork" button.

    That is all.

    Do I need to create a project on my own before forking from ispconfig official?
     
  9. ispcomm

    ispcomm Member

    Here are a couple of screenshots (I click on Fork) and I get the error.
     

    Attached Files:

  10. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Could you please try to create any dummy project in gitlab? e. g. Mytestproject
    Then try to fork the ISPConfig project again. If it succeeds you can delete the test project again.
     
  11. ispcomm

    ispcomm Member

    ok, I was able to fork the main project. Let's see how I can help with the mdbox thing.
     

Share This Page