haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.09k stars 661 forks source link

Investigate the use of the codependency for v3.0 to reduce installation size #2080

Closed smfreegard closed 7 years ago

smfreegard commented 7 years ago

Currently - a completely stock installation of Haraka means a node_modules folder of around 88M:

smf@i7desktop:~/test/Haraka$ du -h -s node_modules/ 88M node_modules/

This is mostly because we're having to pull in all the plugins that have been converted to npm modules to maintain compatibility and because all the devDependencies are pulled in when you run npm install with no arguments.

Running npm install --no-optional --no-shrinkwrap --only=production yields a node_modules folder of around 19Mb which is a reduction of ~78%.

This could be further reduced by removing other plugins such as haraka-plugin-access and haraka-plugin-limit which are currently listed as requirements.

lodash (4.9Mb) which is required by async and iconv (9Mb) are the largest remaining modules.

For 3.0 we could look at using the codependency module to gracefully handle this and all of the plugins available can be listed in optionalPeerDependencies instead and the user prompted to install any missing requirements at start-up.

msimerson commented 7 years ago

I'm +1 on moving the remaining plugins from deps to optional immediately. I've been doing that by default for all the newer plugins I've converted to modules.

don't forget

baudehlo commented 7 years ago

Is install size a problem? What's the downside?

On Mon, Sep 4, 2017 at 4:40 PM, Matt Simerson notifications@github.com wrote:

I'm +1 on moving the remaining plugins from deps to optional immediately. I've been doing that by default for all the newer plugins I've converted to modules.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/haraka/Haraka/issues/2080#issuecomment-327025702, or mute the thread https://github.com/notifications/unsubscribe-auth/AAobY4J6Uwm_hSV1CMhqlBxuCtcNVlD5ks5sfGBPgaJpZM4PLz9_ .

smfreegard commented 7 years ago

Is install size a problem? What's the downside?

No - not particularly although 88Mb is rather high though. I'd just like the install to be as small as possible for v3, so only core should be downloaded without any additional plugins or dependencies. Currently all the plugins-as-modules are downloaded regardless as to whether they're wanted or not.

msimerson commented 7 years ago

88MB is the high water mark and a bit of a red herring. A more typical production install is less than half that:

$ npm install --production Haraka && du -d1 -h .
<snip>
 37M    ./node_modules
 37M    .

As you rightfully pointed out, for those who care about 37M being pudgy, there's always --no-optional:

npm install --production --no-optional Haraka && du -d1 -h .
24M ./node_modules
24M .

In my mind, that doesn't rise to the "we should do something about that" level.

baudehlo commented 7 years ago

Yeah our app at $dayjob is 190M and I'm not worried about it.

On Tue, Sep 5, 2017 at 2:59 PM, Matt Simerson notifications@github.com wrote:

88MB is the high water mark and a bit of a red herring. A more typical production install is less than half that:

$ npm install --production Haraka && du -d1 -h .

37M ./node_modules 37M . As you rightfully pointed out, for those who care about 37M being pudgy, there's always --no-optional: npm install --production --no-optional Haraka && du -d1 -h . 24M ./node_modules 24M . In my mind, that doesn't rise to the "we should do something about that" level. — You are receiving this because you commented. Reply to this email directly, view it on GitHub , or mute the thread .
msimerson commented 7 years ago

Discussion seems to be concluded.