Tuesday, October 8, 2013

Marrying SOGo and Gentoo: part 1

Long time no see! Since I've been away I've been fiddling with many many things (personal projects, life, etc.). One of my latest adventures was trying to make SOGo work on Gentoo. But first, a little bit of background:

My personal pain

6 years ago I was building my very first email server. It was not much but it is still working, albeit with a few modifications. I've kept postfix but replaced courier with dovecot for the IMAP part, and replaced MySQL with OpenLDAP for the authentication part. Back then one of the missing things was a calendaring solution to work on top of it. Keep in mind this was 2007.

There was no good solution available, given the self-imposed features that the system had to have in order to satisfy my needs:

  1. It had to be FLOSS.
  2. It had to work seamlessly with and reuse my current setup (no starting from scratch).
  3. It had not to use Java.
  4. It had to look like it was made after 1995.
#1 left most commercial solutions out and #2 left things like Kolab out. Meanwhile, #3 left Zimbra and OpenXchange out and #4 left Horde out.

Note: I did try to install Kolab one time in a VM. Let's just say the end result was not pretty at all.

Back in that day I found things like DAVical which at first glance seemed to work (basically it was DAV thru HTTP on a PHP webapp). Sadly, the state of PIM solutions at that time was not good (KDE4 was either coming out or had just come out, and GNOME had the ever-depressing Evolution). After several tries to make it work with my partner, we eventually gave up.

A sign of hope

A few months ago a colleague pointed me to SOGo, a solution which seemed to fullfil my criteria (it was FLOSS, it was not Java, it looked REALLY nice and it integrated seamlessly with an existing SMTP/IMAP/authentication backend). I decided to try it out...

... sadly, the ebuilds I found in the gnustep overlay were quite outdated. The last stable one was 1.2.6 (SOGo is now at version 2.0.7) and the live ones which point to their monotone server did not work (it seems their server falls down from time to time). I had to compile it by hand, for which SOGo provides some simple instructions. After editing SOGo's configuration file, which is also heavily documented (quite a bit hard to get the hang of GNUstep, but once you do it's simple enough), I had created a user which did not have a home directory. That kind of messed up starting SOGo.

I dug a bit more and created the needed directories by hand and fixed the permissions (remember: no initscript or anything):

# mkdir /var/spool/sogo
# chown sogo:sogo /var/spool/sogo
# mkdir /home/sogo
# chown sogo:sogo /home/sogo
# mkdir /var/log/sogo
# chown sogo:sogo /var/log/sogo
# mkdir /var/run/sogo
# chown sogo:sogo /var/run/sogo
Also, I found a nice Nginx sample configuration file which I used to proxy SOGo thru my web server (SOGo runs on port 20000 by default and is designed to work behind a web server). After enabling memcache (both the initscript and the Nginx module), I prayed and tested it...

... and it works beautifully. Next steps are making proper initscripts and conf.d files and after that proper ebuilds for SOGo and its main library, SOPE.

Stay tuned.