Currently I am trying/learning development with Meteor framework. My first impressions are great! Some things were never that easy as they are with Meteor, it’s super fast, made with simplicity as core philosophy… I will write about Meteor in a separate post, when I learn enough of it and try it with some real world projects.
At this point of time I want to bookmark here platform that enables hosting of Meteor apps – Modulus.io. Modulus is a PaaS (Platform as a Service) for hosting Node.js based apps with full support for Meteor apps. This post is slightly modified tutorial from Modulus’ help section.
Modulus provides direct deployment of Meteor applications through the use of the Modulus Modulus command line interface. This guide will demonstrate how to properly deploy your Meteor application to the Modulus platform.
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.
$ modulus project create [?] Enter a project name: My Meteor Project
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. Deploy Your Meteor Application
Deploy the Meteor application using the Modulus command line.
$ cd /path/to/app $ modulus deploy
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.
4. 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. Replace the user:pass with the correct user credentials.
$ modulus env set MONGO_URL \ "mongodb://user:email@example.com: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.
$ 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
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