Thursday, March 27, 2014

MongoDB available in Bitnami Cloud Hosting

We are happy to announce that we have recently added support for MongoDB in our Bitnami Cloud Hosting platform. Our latest Ubuntu 12.04 base image includes the MongoDB 2.4.9 version. Other Bitnami base stack components have also been upgraded. The complete changelog is available in our wiki page.

If you want to launch a MongoDB machine in Bitnami Cloud Hosting, you will need to select it in the "Development Options" section as shown at the screenshot below.

You can now launch the machine. Once the machine is up and running, you are able to connect there via SSH and access your MongoDB instance.

For security reasons we do not make the MongoDB service available remotely by default. It is only available for local web apps. You can find more information about MongoDB and remote access in our documentation:

Please note that "installdir", the name often used in our documentation, stands for the Bitnami stack location directory, and it is the '/opt/bitnami' directory in case of Bitnami Cloud Hosting machines. It means that the MongoDB files are located in the /opt/bitnami/mongodb directory.

When you select MongoDB in the development options, we also include the RockMongo web application in your Bitnami Cloud Hosting machines by default. This application is for MongoDB the same what phpMyAdmin is for MySQL, and makes it easy to manage your MongoDB instance using the GUI web console. For security reasons, you need to create an encrypted SSH tunnel to be able to access it remotely, and we explain in detail how to do it in this wiki article.

One interesting use case is how to access your MongoDB database remotely. Sometimes you want to develop your application locally and have access to your remote MongoDB. We do not make MongoDB available remotely by default in Bitnami Cloud Hosting. The MongoDB is running on port 27017 but it is attached to the 127.0.0.1 interface so you can only access it from localhost, inside of the cloud machine. If you want to connect to MongoDB from the external machine, first you will need to change the MongoDB config file /opt/bitnami/mongodb/mongodb.conf

and comment out the bind_ip line as shown below

/opt/bitnami/mongodb/mongodb.conf

# bind_ip = 127.0.0.1

port = 27017

Restart the MongoDB service executing the following command to apply the config changes:

$ sudo /opt/bitnami/ctlscript.sh restart mongodb

Finally, you need to open the port 27017. We highly recommend to limit an access to the port only to your IP address, as it has been shown below. Please also learn more at this page:

Once it is done, you can connect to your MongoDB from your local machine: