Guangtong Shen
Guangtong Shen

Reputation: 1422

Why do we need to deploy a meteor app instead of just starting it?

As we all know, we can run a meteor app by just typing meteor in a terminal. By default it will start a server and use port 3000.

So why do I need to deploy it using MUP etc.

I can configure it to use port 80 or use nginx to route to port 80 for the app. So the port is not the point.


Edit: Assume meteor is running on a VPS or cloud server with public IP address, not a personal computer.

Upvotes: 1

Views: 122

Answers (2)

MrE
MrE

Reputation: 20808

MUP does a few extra things you can do yourself:

it 'bundles' the code into a single file, using meteor build bundle the javascript is one file, and css another; it's minified, and obfuscated so it's smaller and faster to load, and less easy to decipher on the client.

some packages are also meant to be removed when running in production. For example meteorToys, the utility toolset to look up collections and much more, is not bundled into the production bundle, as per the instructions in its package. This insures you don't deploy code with security vulnerabilities (Meteor toys basically opens up client side delete / updates etc... if you're not careful)

So, in short, it installs a minimal version of your site, making sure that what's meant for development only doesn't get push to a production environment.

EDIT: On other reason to do this, is that you don't need all the Meteor build tools on your production server; that can add up to a lot of stuff, especially if you keep caches going for a while...

I believe it also takes care of hooking up to a remote MongoDB Instance (at least it used to be the case on the free meteor site) which is more scalable and fault tolerant than running on the same instance as the web server, as well as provision storage etc... if needed.

basically, to deploy a Meteor app yourself manually, you need to:

on your dev box:

  • meteor build bundle your app to a tar file (using the architecture flag corresponding to the OS you will use)

on the server:

  • install node v0.10 (or whatever is the current version of node required by Meteor)

  • you might have to install [email protected] (but I believe this is now part of meteor install already)

  • untar the bundle, get into bundle/programs/server/ and run npm install

  • run the server with node main.js in the bundle folder.

Upvotes: 1

kpie
kpie

Reputation: 11110

The purpose of deploying an application is that you are situating your project on hardware outside of your local machine. For example if you deploy an application on Heroku app you create a repository on heroku's systems and that code based is used to serve your application off of their servers.

If you just start an application on your personal system, you will suffer a lack of network and resource availability as well as under use of computer time at non-peak hours as your system will need to remain attentive for additional users without having alternative tasks. Hosting providers provide resources as needed, and their diverse client base allows their systems to work around the clock on a global scale.

Upvotes: 0

Related Questions