Running Meteor Apps in the Browser with Nitrous.io
If I told you you can get a Meteor app up and running in 5 minutes without having to install anything locally, would you be interested?
Nitrous.io is a relatively new service based around a simple concept: giving you access to your own development environment within a browser window, complete with a code editor and a terminal window.
Since Nitrous.io has Meteor support built in, you can get any Meteor app up and running in a fresh environment in less than 5 minutes. To illustrate this, let me walk you through running Microscope on a Nitrous.io box.
Installing Meteor & Meteorite
If you prefer videos, you can also check out this lightning talk by the Nitrous.io folks about how to install Meteor on their service.
First, sign up for the service and create a new box. You’ll get the option to choose your development environment, at which point you should pick Node.js:
Once the box has been provisioned, you’ll be faced with a blank app, so let’s start by installing Meteor. Nitrous.io provides a built-in way to install packages and services thanks to their autoparts feature. So all you need to do is go to the Nitrous.io console and type:
parts install meteor
Next, let’s install Meteorite. This time, you can simply use the regular install command:
npm install -g meteorite
We can then simply
git clone the Microscope repo into our box:
cd workspace git clone https://github.com/DiscoverMeteor/Microscope.git
All that’s left to do is simply to run our Meteor app as usual:
cd Microscope mrt
You can then see your app running live by going to the “preview” menu and selecting the correct port (3000 by default):
If everything worked correctly, you should see a brand new copy of Microscope running straight from Nitrous.io!
So far, we could’ve done pretty much the same thing with a service like Heroku. So let’s showcase what makes Nitrous.io really special. Go back to your Nitrous.io window and open the
header.html file in
workspace/Microscope/client/views/includes, then replace the word “Microscope” by something else (say, “FooBar”) and save:
As expected, once Meteor restarts you’ll see the change appear live in the preview as well:
This makes Nitrous.io an ideal sandbox to try out Meteor without having to install it locally (for example, if you have a Windows machine), and the perfect companion to, say, working through a book (hint, hint).
Accessing a Specific Commit
Speaking of the book, maybe you’re following along and need to access a specific commit (say, the first one)? No worries, just type:
git checkout chapter2-1
chapter2-1 is the tag corresponding to the commit you want to access. You can get a list of all commits over at GitHub.
Now that running Meteor is as simple as creating a new account and typing in a few commands, you don’t have any excuse not to get started!
Of course, I recommend giving Discover Meteor a try, but if you’d like a smaller project you can also check out my tutorial on building a Meteor app in 45 minutes.
Some people have reported encountering a Mongo Error 100 complaining about permission issues. If that’s the case, deleting the
mongod.lock file should fix the problem. Just type:
rm -R .meteor/local/db/mongod.lock
(If you enjoyed this post, feel free to upvote/comment over at Hacker News)