The folks at cloud9 decided not to directly support Meteor.js anymore, but I can understand the decision– Meteor is a synch to set up in a node.js environment anyway. I use C9 a LOT for work, so I’m just noting the basic, “hard way” of setting up the actual environment, and, more importantly– moving database files from Meteor Mongo on my laptop to the C9 environment. I realize the idea of the service is to develop on it, as a “one-stop shop” for writing and running code. I don’t always use it that way.
I’m not covering the nuts and bolts of setting up an instance on C9, as that is extremely easy, and should present no problems. I’ve found that by using a github repo, my life is infinitely easier, so that’s the way I do it as a matter of course now. Set up C9 to have access to your github account, and then select the repo you want an instance of to work on. For the type of slice, obviously node.js is the one to pick.
Once it’s created (quite fast), the next order of business is installing Meteor:
curl https://install.meteor.com/ | sh
after which, if you have any other housekeeping installs and such, you can do them.
Next, I install MongoDB. Yes, it comes with Meteor, but I specifically want the
mongorestore command to be available on C9. At the time of this writing, C9 is using the 14.x version of Ubuntu. the full article here is well written, and gives more background. I’ll summarize the steps I follow:
Paste this into the command line:
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
After hitting [RETURN], follow it up by typing this command:
sudo apt-get update
Next, enter the following:
sudo apt-get install -y mongodb-org
That is all that is needed.
On my laptop, I also have MongoDB installed. From a terminal opened into the directory of my running Meteor app, enter the following:
mongodump -h localhost:3001 --db meteor
It creates a
dump/ folder, that contains a
meteor/ folder. I just add this to my repo, so that when I pull the github repo from C9, I can have any changes I may have made to my development database.
Next, in the C9 terminal, start Meteor from within your project’s folder:
meteor --port $IP:$PORT
We need it running, so it’s (now empty) version of mongo also runs. Look in the
.meteor/local/db directory. There’s a file called,
METEOR-PORT. Conveniently enough, this gives the port that meteor’s MongoDB instance is running on. In the command that’s coming below, you would substitute whatever port number you find in that file, for example,
Open a fresh terminal from inside your meteor project on C9. Enter the following:
mongorestore -h localhost:[METEOR-PORT] --db meteor dump/meteor/
NOTE that I used the folder’s created on my system by following the
mongodump command above. This restores your development database, from your home computer– to C9’s Meteor Mongo. After giving it a few minutes to update, your app should be working with the same data-set you have outside the cloud.