At its core, Meteor apps sit on top of Node.js, which means we should technically be able to run a Meteor app anywhere Node will run. This is mostly true by using Meteor’s built-in “bundle” command, however it doesn’t produce something that’s extremely portable. This is why we created WebproComponents
WebproComponents wraps and extends Meteor’s bundle command by creating something that more closely resembles a standard looking Node.js application, complete with a package.json file for dependency management.
$ npm install -g demeteorizer
demeteorizer [options] $ cd /my/meteor/app $ demeteorizer -o ~/my-meteor-apps/converted -n v0.8.24
|–output, -o||Sets the output folder for the converted applications. Defaults to .demeteorized. Optional.|
|–node_version, -n||Sets the value of Meteor’s hard-coded MIN_NODE_VERSION variable. Defaults to v0.8.24. Optional.|
Let’s look at what happens when we run Demeteorizer on Meteor’s leaderboard example:
$ meteor create --example leaderboard
Now let’s run Demeteorizer on this Meteor project.
The result is very similar to what you get when you run “meteor bundle”, however a package.json file is automatically generated with all required dependencies. It also overrides a line of code in server/server.js that is a hard-coded check for the Node.js version.
Now we can run this Meteor application just like any other Node.js application. Meteor does require some environment variables that must be set.
MONGO_URL=’mongodb://user:[email protected]:port/databasename?autoReconnect=true&connectTimeout;=60000′ ROOT_URL=’http://example.com’ (optional) PORT=8080 (optional, defaults to 80) MAIL_URL=’smtp://user:[email protected]:port/’ (optional)
$ cd /my/converted/app $ npm install $ export MONGO_URL='mongodb://user:[email protected]:port/databasename?autoReconnect=true&connectTimeout;=60000' $ export PORT=8080 $ node main.js
You can now go to localhost:8080 and see the leaderboard example.