Frictionless Meteor development and deployment with SourceLair and Modulus
SourceLair is an in-browser development environment that lets developers build their applications inside their browsers anywhere, without downloading, installing or configuring software anywhere.
SourceLair supports development of Meteor apps out of the box and lets you deploy them to Modulus frictionlessly from right inside your browser.
Let’s see how!
To get started first you need to create a Modulus account at https://my.modulus.io/register.
Create a SourceLair project for Meteor and Modulus
Then you have to create a development environment at SourceLair to work with Meteor and Modulus.To do this visit https://lair.io/modulus/meteor and following the instructions. Completing this process you will get the following automatically:
- A Node.js project on SourceLair
- A MongoDB add-on attached to our project
- The Modulus CLI installed in our project
- Meteor installed in our project
Now you are ready to develop your Meteor app on SourceLair and connect your account with Modulus.
Log into Modulus
The next thing you have to do is log into our Modulus account by using the Modulus CLI. To do this go to your SourceLair terminal, run the following command
and then enter your Modulus credentials.
Next you will have to create and configure a Modulus project with a MongoDB database and a MongoDB user, in order to be able to deploy our Meteor app with easiness.
Create and configure project
First create a project called app using the Meteor runtime in a 512MB servo by running the following command:
modulus project create -r Meteor -s 512 app
Now, you have to set the ROOT_URL environment variable of our project to the project URL provided by Modulus, which is required by Meteor in production. To do this list your projects by running the following command in your terminal and copy the URL of the app project:
modulus project list
You can set the ROOT_URL environment variable by running the following command in the terminal:
modulus env set -p app ROOT_URL http://yourprojecturl.onmodulus.net
Create and configure MongoDB database
Create and connect your MongoDB database on Modulus by running the following command in your terminal (you will have to select a region for your database):
modulus addons add mongo:base
Now that you created and configured your project and database, you are ready to start working on your Meteor app and deploy it to Modulus!
Create your Meteor app
To create your Meteor run the following command in your terminal:
meteor create app
Attention! It’s really important to create our application inside the “app” directory. This will ensure that our meteor app will behave consistently between SourceLair and Modulus.
Let’s see if our Meteor app works right now! To do this you will have to:
- Start the Meteor server: Open the Command Palette (Cmd + Shift + P on your Mac or Ctrl + Shift + P on Windows or Linux), type start server and hit Enter to run the Server: Start server command. SourceLair will automatically detect how to run your Meteor app and do it immediately.
- View our app: Open the Command Palette, type public url and hit Enter to run the Server: Open Public URL command.
Then you should see something like the following screenshot in the new tab opened in your browser:
Deploy your Meteor app
All you have to do to deploy your Meteor app to Modulus now is run the following command in your terminal:
npm run modulus:deploy
This will just cd into the app directory and then run the modulus deploy command in there.
And you are ready! Open your Modulus app URL in your browser to see your deployed Meteor app on Modulus.
You have successfully managed to set up a frictionless development and deployment process with SourceLair and Modulus, all in your browser, without downloading or installing any software!