13

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.

mithun_daa
  • 4,334
  • 5
  • 38
  • 50

5 Answers5

20

These days the workspaces are just Ubuntu VMs, so just follow the instructions on installing your favourite database on Ubuntu.

E.g.

  • Postgres: sudo apt-get install postgresql postgresql-contrib
  • MongoDB:

    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

Community
  • 1
  • 1
Jan Jongboom
  • 26,598
  • 9
  • 83
  • 120
  • `mysql-ctrl install ; phpmyadmin-ctrl install` just a note: I don't think they are VMs but bare metal droplets ... try do a `cat /proc/cpuinfo` – WonderLand Jun 07 '16 at 04:39
8

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

Greg
  • 205
  • 3
  • 7
7

Cloud 9 comes easily configurable with either the following databases:-

Remixed123
  • 1,575
  • 4
  • 21
  • 35
0

I'm using Cloud 9, and there's a local mongod on the slice. You need to use a terminal to run it.

Evan P.
  • 979
  • 1
  • 10
  • 17
  • 2
    +1 if you can give us a little more detail on *how* to use through the C9 terminal. Even if its simple, a little more meat in the answer would be nice =) – Kyeotic Jan 15 '13 at 21:04
0

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.