0
votes

I was wondering, if I'm deploying a Meteor app to a VM, why can't I just install Meteor on the vm, and run my app with the meteor run command? The deployment section of the docs says to create a tarball bundle and deploy that to a server that has Node and MongoDB, but couldn't I just install Meteor on the server instead? And then setup my DNS entry to listen to port 3000... Why wouldn't this idea work?

2

2 Answers

3
votes

Your idea would work fine. However, I would just suggest that if you are going to use this you might as well run in in a more "production" type of environment. And it is pretty easy to setup.

On a high level here is what you will need:

  1. Need to install Node 0.8.x
  2. Need to install MongoDB
  3. Follow the directions here for deploying. These just got updated for Meteor 0.5.5 so just be aware of that.
  4. Need to install forever node.js package

To make my life easier I created a script to handle starting/stopping my meteor app. It will set everything up to use the full MongoDB:

#!/bin/bash

SUCCESS=0
FAILURE=1

if [ $# -ne 1 ]
then
  echo "Usage: start|stop|restart"
  exit $FAILURE
fi

case "$1" in
    start )
        export MONGO_URL=mongodb://localhost:27017/<name of the database>
        export PORT=3000
        export ROOT_URL=http://yourhostname.com:3000
        forever start bundle/main.js 
        ;;

    stop )
        forever stop bundle/main.js
        ;;

    restart )
        forever restart bundle/main.js
        ;;

esac
0
votes

You could run your deployment within the VM on just regular installed Meteor.

Think of it like running a rails app with the built-in development server. Tough in terms of Meteor, the bundled version should be no different from a development version. The bundle you create ensures that all the necessary dependencies are bundled with it as well.

A quote from the meteor docs about meteor bundle:

This command will generate a fully-contained Node.js application in the form of a tarball. To run this application, you need to provide Node.js 0.8 and a MongoDB server. You can then run the application by invoking node, specifying the HTTP port for the application to listen on, and the MongoDB endpoint. If you don't already have a MongoDB server, we can recommend our friends at MongoHQ.

$ PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js

Other packages may require other environment variables (for example, the email package requires a MAIL_URL environment variable).

Well i never changed the underlying database to a dedicated MongoDB server with the development version, but i think that should be possible by just setting the mentioned environment variables.

P.S.:

You wrote:

And then setup my DNS entry to listen to port 3000...

You'll have a hard time setting a port with a DNS entry...