Welcome, Guest Login

Public Cloud Center

Getting Started with Meteor on Xervo

Last Updated: Jan 03, 2017 11:17AM EST

Modulus provides direct deployment of Meteor applications through the use of the Modulus command line interface. This guide will demonstrate how to properly deploy your Meteor application to the Modulus platform.

Note: using the Meteor project type requires that you use Modulus CLI version 6.3.x or above, install the latest version by running $ npm install -g modulus@latest

Note on Meteor updates: 
When Meteor comes out with new updates and you update your project to the latest Meteor version please make sure to test the application on a 'staging project' before deploying to your main project. Sometimes there will be new features in Meteor releases that will require us to update our Modulus CLI or Meteor runtime image.  If you run into an error with a new version of Meteor you are testing out, create an issue on our GitHub Meteor build repository.

1. Create a Project

The first step is to create an empty project. This can be done through the web interface or the Modulus command line.  Your meteor app must be using at least Meteor version 1.3.0 for the meteor runtime to work.  The latest version of Meteor is currently 1.4.x.x

Command Line

$ modulus project create
[?] Enter a project name: My Meteor Project

Web Interface


 

2. Create a Database

Meteor applications require a MongoDB database. Databases can be created through the web interface.

The Databases tab on the User Dashboard allows you to create and view MongoDB databases.

After clicking create, enter a database label and the default user credentials.

Once the database has been created it will display the connection information. This information can be accessed at any time on the database dashboard's administration tab.

3. Make sure you have a package.json file
(Meteor versions 1.4.x.x & later)

 

Make sure to have a package.json in your project directory.  This is different from the packages.json file.  A meteor package.json should look something like this:
Note: the dependencies listed below are just examples of npm modules one might use.

{
  "name": "My Meteor Project 1",
  "private": true,
  "mod-project-name": "MeteorProject1",
  "scripts": {
    "start": "meteor run"
  },
  "dependencies": {
    "zombie": "4.2.1",
    "bcrypt": "0.8.7"
  },
  "engines": {
    "node": "4.4.7"
  }
}


4. Deploy Your Meteor Application

Deploy the Meteor application using the Modulus command line. Make sure to include the node-version flag. (Assuming you are using Meteor 1.4.x.x and make use of Node v4 features.)

$ cd /path/to/app
$ modulus deploy --node-version 4

The Meteor app is not quite ready yet and the logs will show errors. We have to deploy first in order to receive a URL for Meteor's required environment variables.

5. Setup Your Environment Variables

Using the Modulus CLI or web interface enter the MONGO_URL and ROOT_URL environment variables.

Set the MONGO_URL environment variable to the connection string provided when the DB was created.

  • When you enter your MONGO_URL, remember to replace <username>:<password> with your actual username and password specified when you created the database.
$ modulus env set MONGO_URL \
  "mongodb://user:pass@olympia.modulusmongo.net:27017/8Y4fgyd \
  ?autoReconnect=true&connectTimeoutMS=60000"

Set the ROOT_URL environment variable to your project's URL. This is displayed at the top of your project dashboard and in the CLI at the end of the deploy.

Make sure you do not have a trailing slash ' / ' at the end of your ROOT_URL environment variable.

$ modulus env set ROOT_URL http://my-meteor-project-9339.onmodulus.net

These can also be set on the project dashboard's administration tab if desired.

Restart the project to pick up the new environment variables.

$ modulus project restart

Your Meteor project is now running. Visit the *.onmodulus.net URL to confirm. At this point you can follow the custom domain and SSL guides to complete your production ready Meteor application.

Deploying New Code

Now that the environment variables are configured correctly, new versions of the application can be deployed at any time by simply re-running the deploy command.

$ modulus deploy --node-version 4

A Note on OpLog Tailing

With the release of Meteor 0.7.0 a new technique for live updates was introduced that involves inspecting MongoDB's operations log. The Modulus shared MongoDB databases do not currently provide access to the oplog. In order to use oplog tailing with a project hosted on Modulus a dedicated replica set is required. Please contact us for available options and pricing for dedicated MongoDB databases.

Troubleshooting your Meteor App

I'm getting the following when I go to my project URL: 'Unable to Connect to any Application Instances.'
  • This is a message from the load balancer when it does not receive a response from your application. Typically, this either means that your app is running, but is not listening on the right port, or your app is not running correctly. 


1. The first step you should take is to check the project logs.

  • Checking logs can be done from the web dashboard of your project, or the CLI.


2. If you are getting a Mongo auth error then you will want to check your environment variable for MONGO_URL.
Common issues with the MONGO_URL include:

  • incorrect username / password (this can be set from the mongodb web dashboard)
  • having unicode characters in the connection string (or any env var)
  • having '@' or a colon ' : ' in the password or username


3. Your logs show a ROOT_URL issue

  • this is typically due to not having 'http://' before the rest of the project URL.


4. Logs show 'cannot find property 'example' of null'
or 'cannot read property 'example' of undefined'

/mnt/app/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/base.js:246

throw message; 

^

TypeError: Cannot read property 'done' of null

 

  • In this case you will want to check all modules which use mongodb, and make sure they are up to date.
  • In similar cases check your configuration for Meteor.  Check your Meteor settings (file or env var)
5. I am getting an 'assertion error'

 

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main


assert.js:93
  throw new assert.AssertionError({
        ^
AssertionError: "undefined" === "function"
    at wrapPathFunction (/mnt/app/bundle/programs/server/mini-files.js:77:10)
    at Object.<anonymous> (/mnt/app/bundle/programs/server/mini-files.js:108:24)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

 

If you are seeing an error similar to the one shown above, make sure you are deploying using the node-version flag.

$ modulus deploy -p projectName --node-version 4

6. No relevant data is shown in the logs that can help with debugging!
  • Verify the servo size of your project (can be seen in the admin panel of your project dashboard)
  • Check your 'metrics' page of the web dashboard.
  • If you're seeing RAM usage that is high or close (within 50-100MB) of your servo size then you should up your servo size.  The recommended servo size for all meteor projects is a 512MB servo.


Go to top
 

Contact Us

    Our Support Policy
    Submit a Support Request

  • Public Cloud Support Hours
    9am-5pm EST Mon-Fri
    Outside of these hours response times may be up to 24hrs.


    Submit a support ticket by clicking 'status and support' icon on the left side of this page.



help@hellotangible.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en_us/portal/articles/autocomplete