arboleya / electrify

Package your Meteor apps with Electron, and butter
MIT License
247 stars 52 forks source link

Plugins: Disable Mongo? #15

Closed msolters closed 9 years ago

msolters commented 9 years ago

I am very interested by the output associated with "plugins" when starting or bundling an electrified app. Is it possible in the Electrify.app.package() step, to specify not to include MongoDB at all?

For instance, I have an application that never reads or writes to any kind of collection. There are no users. Therefore, I see no reason to bundle Mongo with a deployed .exe or .app.

Additionally, I'm not sure if this could somehow improve load time, but I'd very much like to try. Is there any mechanism in your build process that could enable this?

arboleya commented 9 years ago

Hi, it's not possible.

MongoDB also starts very fast, I don't think it'd be too relevant. Unless you have some benchmark through different machines that shows otherwise.

Anyway, there's another point that is the size of the final app. If we remove the mongo and mongod binaries, the final app size will likely drop by 50mb.

The two plugins you find inside the lib/plugins folder are my first basic draft for a plugin API, so there's not much functionality yet. However I haven't thought about removing MongoDB.

Are you deploying your app already without MongoDB? Meteor doesn't complain about it? You use a null MONGO_URL or something? I've never did it before.

msolters commented 9 years ago

Thanks for the feedback. I will try to build some deployed versions that remove Mongo and see what I can get up and running. My problem is that these electrified apps seem to take quite a long time to start up. For instance, I have an i7 machine w/ 32GB of RAM -- and it takes 10-15 seconds for a simple leaderboard app to start, during which time Electron just has a blank white page.

arboleya commented 9 years ago

Wow @msolters, 10-15 seconds seems a lot. Mine takes 1 or 2 seconds max with 2.5 GHz Intel Core i7 and 16 GB 1600 MHz DDR3. I need to check this.

About the white page that is rendered right away before everything is up and running, it's possible for you to configure a splash screen.

I haven't tested it but it'll look similar to this:

// .electrify/splash.html

var app       = require('app');
var browser   = require('browser-window');

var electrify = require('electrify')(__dirname, {});

var splash    = null;
var window    = null;

app.on('ready', function() {
  splash = new browser({
    // >>> your configs here
  });
  splash.loadUrl('./splash.html'); // >>> create the ".electrify/splash.html" file

  electrify.start(function(meteor_root_url) {
   splash.close(); // >>> or .destroy(), check what works for you
    window = new browser({
      width: 1200, height: 900,
      'node-integration': false
    });
    window.loadUrl(meteor_root_url);
  });

});

app.on('window-all-closed', function() {
  app.quit();
});

app.on('will-quit', function() {
  electrify.stop();
});
arboleya commented 9 years ago

@msolters Have you seen any speed improvement during the startup of your app?

I've just released a new version some minutes ago, please update and check if got better for you.

As for the option to completely strip mongo away, I think it's not crucial at this time, nor it is something straightforward / documented.

I've found something here, but seems a little tricky: http://stackoverflow.com/questions/18545905/meteor-without-mongo

So I'm closing this for now, hope your build is starting faster than last time your posted.

msolters commented 9 years ago

I haven't had much time to focus on this. I'll let you know if there is a marked improvement next time I get to implementing it.