The Network People Support Forums

Mail::Toaster => Installation Issues => Topic started by: MDay on December 07, 2014, 09:23:42 AM

Title: MT6 - Haraka cannot find serve-static module
Post by: MDay on December 07, 2014, 09:23:42 AM
On installing haraka and following the steps described on https://www.tnpi.net/wiki/MT6_SMTP

When I get to:

[root@smtp /usr/local/haraka]# service haraka startloglevel: LOGINFO
Starting up Haraka version 2.5.1-toaster
[INFO] [-] [core] Loading plugins
[INFO] [-] [core] Loading plugin: process_title
[INFO] [-] [core] Loading plugin: log.syslog
[INFO] [-] [core] Loading plugin: connect.p0f
[INFO] [-] [core] Loading plugin: connect.geoip
[INFO] [-] [core] loaded 6791 Public Suffixes
[INFO] [-] [core] loaded TLD files: 1=442 2=4542 3=283
[INFO] [-] [core] Loading plugin: connect.asn
[INFO] [-] [core] Loading plugin: connect.fcrdns
[INFO] [-] [core] Loading plugin: dnsbl
[INFO] [-] [core] Loading plugin: connect.p0f
[INFO] [-] [core] Loading plugin: helo.checks
[INFO] [-] [core] Loading plugin: tls
[INFO] [-] [tls] loading tls.ini
[INFO] [-] [tls] loading tls_key.pem
[INFO] [-] [tls] loading tls_cert.pem
[INFO] [-] [core] Loading plugin: auth/auth_vpopmaild
[INFO] [-] [auth/auth_vpopmaild] loading auth_vpopmaild.ini
[INFO] [-] [core] Loading plugin: max_unrecognized_commands
[INFO] [-] [core] Loading plugin: mail_from.is_resolvable
[INFO] [-] [core] Loading plugin: spf
[INFO] [-] [core] Loading plugin: rcpt_to.qmail_deliverable
[INFO] [-] [core] Loading plugin: bounce
[INFO] [-] [core] Loading plugin: data.headers
[INFO] [-] [core] Loading plugin: data.uribl
[INFO] [-] [core] Loading plugin: attachment
[INFO] [-] [core] Loading plugin: clamd
[INFO] [-] [clamd] Loading excludes file
[INFO] [-] [core] Loading plugin: spamassassin
[INFO] [-] [spamassassin] loading spamassassin.ini
[INFO] [-] [core] Loading plugin: data.dmarc
[INFO] [-] [core] Loading plugin: dkim_sign
[INFO] [-] [core] Loading plugin: karma
[INFO] [-] [karma] loading karma.ini
[INFO] [-] [core] Loading plugin: queue/smtp_forward
[INFO] [-] [core] Loading plugin: watch/server
[CRIT] [-] [core] Compiling plugin: watch/server failed
[CRIT] [-] [core] Error: Cannot find module 'serve-static'
[CRIT] [-] [core]     at Function.Module._resolveFilename (module.js:338:15)
[CRIT] [-] [core]     at Function.Module._load (module.js:280:25)
[CRIT] [-] [core]     at Module.require (module.js:364:17)
[CRIT] [-] [core]     at require (module.js:380:17)
[CRIT] [-] [core]     at _haraka_require (/usr/local/lib/node_modules/Haraka/plugins.js:125:20)
[CRIT] [-] [core]     at /usr/local/haraka/plugins/watch/server.js:7:21
[CRIT] [-] [core]     at Object.plugins._load_and_compile_plugin (/usr/local/lib/node_modules/Haraka/plugins.js:151:12)
[CRIT] [-] [core]     at plugins.load_plugin (/usr/local/lib/node_modules/Haraka/plugins.js:90:26)
[CRIT] [-] [core]     at Array.map (native)
[CRIT] [-] [core]     at Object.plugins.load_plugins (/usr/local/lib/node_modules/Haraka/plugins.js:83:39)
[NOTICE] [-] [core] Shutting down

I must confess to little/no experience of Node.js but if it's any help I can find a serve-static directory in /usr/local/lib/node_modules/connect/node_modules/ but I don't know how to make Node.js or Haraka aware of it there.

I'm floundering a bit and hoping someone could shed some light. Matt can you explain why the instructions involve downloading with git a version of Haraka from your repository and if something could have changed in the upstream package which breaks what was being achieved there.

I also noticed that in the "Configure Haraka" section the
sed -i .bak -e 's/^listen/;listen/' config/smtp_forward.ini
command is redundant as there are no instances of listen in the smtp_forward.ini

Isn't all this a bit bleeding edge for a production mail server? node's 0.10.33

I appreciate the modularity of Haraka but wouldn't something a bit more stable be preferable?
Title: Re: MT6 - Haraka cannot find serve-static module
Post by: matt on December 10, 2014, 05:40:51 AM
I got the 'toaster' branch of Haraka updated (yesterday). I haven't had time to do a fresh build but it's running it on my server now. That should solve this issue for new installs.

For you, this should solve it:
    cd /usr/local/lib/node_modules/Haraka && npm install serve-static

> Isn't all this a bit bleeding edge for a production mail server? node's 0.10.33

Node is actually quite stable, and it's being used in many, many, many production environments. Bleeding edge and stability aren't functions of the version numbers, they're functions of the code quality and maturity of the project.

Haraka is actually quite stable as well, but it's not nearly as mature as other MTAs (sendmail, qmail, postfix, QPsmtpd).  But it's also much faster and better at filtering. Pick the features that matter most to you and rock on.
Title: Re: MT6 - Haraka cannot find serve-static module
Post by: matt on December 10, 2014, 05:50:53 AM
> Isn't all this a bit bleeding edge for a production mail server?

Another tidbit. I spent a year working on Qpsmtpd, which I liked because of it's flexible architecture, maturity, and code stability. I eventually gave up on my quest to mature it into a "drop in" replacement for qmail-smtpd, as it likely would have taken another year or two. I was running QP on a few mail servers during that time and looking hard for better solutions. Switching to Haraka is what inspired the new MT6 "every-service-in-a-jail" architecture. Now the SMTP daemon is pluggable. Don't like Haraka?  Spin up another jail, run something else in it like QP, or ASSP, or whatever. You'll have to do a little integration work but the SA and Clam scanners are shared and everything else is cleanly separated.

The fact that I can run QP and Haraka in two jails, switching traffic back and forth between them with a firewall rule is, at least to me, a killer feature. (when something better comes along, switching is easier.)
Title: Re: MT6 - Haraka cannot find serve-static module
Post by: MDay on January 05, 2015, 04:39:25 AM
Thanks for the info matt.

I'll have a look into setting it up as you suggest.

I appreciate what you say about maturity and stability, it was just the low version numbers and it failing to install that made me suspicious.

I heartily agree with the philosophy of jails as you describe and the beauty of being able to switch components in and out.

I'll let you how it goes.