Tag: mongodb

MongoDB, the popular open source NoSQL database, has been in the news a lot recently—and not for reasons that are good for MongoDB admins. Early this year, reports began appearing of MongoDB databases being “taken hostage” by attackers who delete all of the data stored inside the databases, then demand ransoms to restore it.

Security is always important, no matter which type of database you’re using. But the recent spate of MongoDB attacks makes it especially crucial to secure any MongoDB databases that you may use as part of your container stack.

This article explains what you need to know to keep MongoDB secure when it is running as a container. We’ll go over how to close the vulnerability behind the recent ransomware attacks using a MongoDB container while the container is running—as well as how to modify a MongoDB Dockerfile to change the default behavior permanently. Read more

One of the key features of the Kubernetes integration in Rancher is the application catalog that Rancher provides. Rancher provides the ability to create Kubernetes templates that give users the ability to launch sophisticated multi-node applications with the click of a button.

Rancher also adds the support of Application Services to Kubernetes, which leverage the use of Rancher’s meta-data services, DNS, and Load Balancers. All of this comes with a consistent and easy to use UI. In this post, I am going to show an example of creating a Kubernetes catalog template that can be integrated later in complex stacks. This example will be a MongoDB replicaset. In the past I’ve shown how to create a MongoDB replicaset using Docker Compose, which works in environments using cattle and Docker Swarm as orchesrators.

MongoDB replicaset

MongoDB replicaset is a group of MongoDB processes that maintain the same data set. This provides high availability and redundancy between your replication nodes. Each MongoDB replicaset consists of one primary node and several secondary nodes.

Note: this image is from the official documentation of MongoDB.

The primary node in MongoDB receives all the write operations. The secondary nodes can handle the read operations. The primary records all the changes in operation logs, or “oplogs,” which will be replicated to each secondary node and then apply to the operations. If the primary is unavailable, an eligible secondary will hold an election to elect itself the new primary. For more information about MongoDB replicaset, please refer the official documentation. Read more

Recently Rancher introduced the Rancher catalog, an awesome feature that enables Rancher users to one-click deploy common applications and complex services from catalog templates on your infrastructure, and Rancher will take care of creating and orchestrating the Docker containers for you.

Rancher catalog offers a wide variety of applications in its out of the box catalog, including glusterfs or elasticsearch, as well as supporting private catalogs. Today I am going to introduce a new catalog template I developed for deploying a MongoDB replicaset, and show you how I built it. Read more

In the first part of this post, I created a full Node.js application stack using MongoDB as the application’s database and Nginx as a load balancer that distributed incoming requests to two Node.js application servers. I created the environment on Rancher and using Docker containers.

In this post I will go through setting up Rancher authentication with GitHub, and creating a webhook with GitHub for automatic deployments.

So last week I finally got out from my “tech” comfort zone, and tried to set up a Node.js application which uses a MongoDB database, and to add an extra layer of fun I used Rancher to set up the whole application stack using Docker containers.

I designed a small application with Node, its only function is to calculate the number of hits on the website, you can find the code at Github.

The setup was to add an Nginx container as a load balancer at the front-end to serve two back-end Node application containers, and then have the two Node servers connect to a MongoDB database container. In this setup I will use 5 machines from Digital Ocean, 4 to build the application stack with the highest availability, and the 5th as a Rancher server.