Reputation: 4384
Does Cloud 9 support any databases? Can my app talk to a database? MongoDB, Sqlite... anything? If so, how do i set it up? I am willing to work with any database. I just want to persist some of my info into a database.
Upvotes: 13
Views: 11090
Reputation: 27323
These days the workspaces are just Ubuntu VMs, so just follow the instructions on installing your favourite database on Ubuntu.
E.g.
sudo apt-get install postgresql postgresql-contrib
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-org
Sqlite: sudo apt-get install sqlite3 libsqlite3-dev
Upvotes: 20
Reputation:
MongoDB is installed by default when you create a new workspace on Cloud9. What usually works for me is to open a second terminal window and start mongodb.
Type ./mongod to start mongodb.
Leave that terminal running and now you can interact with mongo via the primary terminal.
To get started you would type mongo $IP. Now you're ready to go. MongoDB shell version: ..* will echo to the screen and tell you that it's connecting to: 127...*/test
When you do this you will notice that the terminal session where you started mongo will say something like connection accepted from 127...* #1 (1 connection now open)
See the mongodb site for a list of commands - I assume you know what you're doing.
The terminal is Cloud9 is a fully functioning terminal so you can even seed your db with data from an external js file. There is lots of documentation online that explains how to do this but basically you can create js file and add a db.collectionname.save({"name":"value"}); entry for every document you want to add.
In the terminal you can load up this file by doing something like this: mongo $IP/test data.js. I assume you put the file in the workspace root.
Upvotes: 0
Reputation: 1585
Cloud 9 comes easily configurable with either the following databases:-
Upvotes: 7
Reputation: 205
Cloud9 now allows you to run MongoDB from within Cloud9. Here are instructions on how to set it up in your workspace:
https://docs.c9.io/setting_up_mongodb.html
Upvotes: 8
Reputation: 989
I'm using Cloud 9, and there's a local mongod on the slice. You need to use a terminal to run it.
Upvotes: 0