Manage your Mongo Databases in RHMAP with Mongo Express

Red Hat Mobile Application Platform (RHMAP) supports an agile approach to developing, integrating, and deploying enterprise mobile applications. Most likely, your mobile apps will include one or more cloud apps which will require persistence support such as a Mongo Database. But managing databases is not always easy, as command line support for this databases is complex and not always available.

To ease this pain, Mongo Express can be used as an database GUI. For the mongo databases in your cloud apps, it is a powerful and intuitive tool which can be used in conjunction or as substitute for the default database browser. The main benefits from using “Mongo Express” instead of “Data Browser” are:

  • Can run complex queries
  • In-depth stats for every view
  • Supports BSON types as TimeStamp() or DBRef()

IMPORTANT: there are some implications when using Mongo Express as a database manager:

  • Mongo Express can only manage the databases in one Cloud App and environment at a time
  • There is no authentication by default when using Mongo Express as explained in this article so take into account all the security issues that this may arise [1]
  • Users running the platform on the RHMAP should upgrade their databases if it was not upgraded before

[1] Check the Annex ‘how to add authentication’ to overcome this issue

Continue reading “Manage your Mongo Databases in RHMAP with Mongo Express”


Join Red Hat Developers, a developer program for you to learn, share, and code faster – and get access to Red Hat software for your development.  The developer program and software are both free!

 

A Mongo Shell Cheat Sheet

There’s a whole host of GUI tools to connect to MongoDB databases and browse, however despite a steeper learning curve, I’ve always found myself more productive using a command line interface (CLI).

Then, there’s that moment when something has gone wrong on the database server, and we need to SSH 4-levels deep in order to debug a problem with a database. Sometimes, there’s no other option available, and this makes familiarity with the CLI invaluable.

I learn best by example, and I’ve kept this cheat sheet of commands I use most often by my desk for many years – there’s always one command I’ve forgotten.

Together with the Red Hat Developer Team, I’ve put together this handy cheat sheet – hopefully, you’ll find it useful too!


@cianclarke is a Software Engineer with Red Hat Mobile. Primarily focused on the mobile-backend-as-a-service space, Cian is responsible for many of Red Hat’s mBaaS developer features.


Join Red Hat Developers, a developer program for you to learn, share, and code faster – and get access to Red Hat software for your development.  The developer program and software are both free!

 

A Lesson in Debugging: Big Projects Have Critical Bugs Too

I recently had an interesting problem which served as a great learning experience. It involves hair-pulling levels of frustration, vicious finger-pointing, and an unexpected ending — not a TV Soap opera episode, just a day in the life of a developer.

It all started with a REST API I had built for a customer proof of concept that started refusing requests after an arbitrary period of time. Nothing was unusual in the codebase of the REST API — it was two simple CRUDL endpoints on equally simple objects.
I’d built similar many times before, and probably will many times again – but yet still, this process kept hanging, refusing requests. The time it took to fail was arbitrary — sometimes immediate, sometimes hours, sometimes days.

Eventually, through some SSH foo we discovered that the count of open file descriptors was growing inside the app’s container. I wrote a simple endpoint to query the number of open file descriptors, and it looked like this:

app.get('/fd', function(req, res){
  var fs = require('fs');

  fs.readdir('/proc/self/fd', function(err, list) {
    if (err) {
      return res.status(500).json(err);
    }
    return res.end(list.length.toString());
  });
});

Indeed, after restarting the process, it was clear that the file descriptor count would grow every few minutes, without stopping. An empty Node.js application didn’t exhibit the same problems, only this app.

Continue reading “A Lesson in Debugging: Big Projects Have Critical Bugs Too”


Join Red Hat Developers, a developer program for you to learn, share, and code faster – and get access to Red Hat software for your development.  The developer program and software are both free!

 

Installing MongoDB on Red Hat Enterprise Linux

 

MongoDB has evolved into one of the most popular open source “NoSQL” databases—so-called because they dispense with the tabular storage schema of relational databases like MySQL and Postgres. NoSQL databases offer a variety of advantages in many cases

The biggest advantage is that MongoDB databases don’t require developers to define schemas before adding data to a database. Instead, they use a flexible document-based model, similar to Python dictionaries or Ruby hashes. With MongoDB, you don’t need to spend time creating tables before you can process your data. That makes the NoSQL approach ideal for situations where you don’t know how much data you have to handle, what form it is in, or how quickly it is going to move around.

There’s a lot more to say about what makes MongoDB, and NoSQL in general, a better fit for some situations. (I could also write a great deal about when not to use NoSQL—and that’s  important, because despite NoSQL’s current trendiness, it’s not better in all contexts.)

But that’s all fodder for a separate blog post. For now, let’s move onto the meat of this post, which is how to install MongoDB on Red Hat Enterprise Linux (RHEL) in order to take advantage of NoSQL databases.

Continue reading “Installing MongoDB on Red Hat Enterprise Linux”


Join Red Hat Developers, a developer program for you to learn, share, and code faster – and get access to Red Hat software for your development.  The developer program and software are both free!

 

Take advantage of your Red Hat Developers membership and download RHEL today at no cost.

Database Docker images – now beta via Software Collections

“As a part of the Red Hat Software Collections offering, Red Hat provides a number of container images, which are based on the corresponding Software Collections. These include application, daemon, and database images. The provided images, currently available in the Beta version” (for more information see https://access.redhat.com/articles/1752723)

Red Hat Software Collections allows you to run newer versions of software on a stable Red Hat Enterprise Linux. These new images combine this feature with the benefits of containers.

In this post I would like to show you how to run database server from RHSCL in one command.

Continue reading “Database Docker images – now beta via Software Collections”


Join Red Hat Developers, a developer program for you to learn, share, and code faster – and get access to Red Hat software for your development.  The developer program and software are both free!

 

Red Hat Software Collections 2.0 Docker images, Beta release

I’m very happy to announce that Docker images based on collections from Red Hat Software Collections (RHSCL) 2.0 are in beta testing.  The images are available from the Red Hat Container Registry, and we’ve got the set of collections for language, databases and web servers covered – a complete list is below.

If you’ve not tried out the Docker package from RHEL7 Extras, you need to enable the Extras channel, install the docker page, and start the docker service; an extended guide for RHEL Docker is available here.  Once you are set up, pulling the RHSCL Docker images is very simple… for example, you can fetch the Python 3.4 image as follows:

Continue reading “Red Hat Software Collections 2.0 Docker images, Beta release”


Join Red Hat Developers, a developer program for you to learn, share, and code faster – and get access to Red Hat software for your development.  The developer program and software are both free!

 

Take advantage of your Red Hat Developers membership and download RHEL today at no cost.

Red Hat Software Collections 2 – now generally available

Excellent news – Red Hat has announced the general availability of Red Hat Software Collections 2.softwarecollections-logo-colorful

You’ll see considerable additions to support multiple language versions. For example, it includes updates to “Python 2.7, continues to support Python 3.3 and also adds Python 3.4 – providing a fully-supported language library and blending developer agility with production stability.”

Continue reading “Red Hat Software Collections 2 – now generally available”

Software Collections 2.0 now in BETA – new and shiny

softwarecollections-logo-colorfulIt seems like just a few months ago when we introduced Red Hat Software Collections 1.0 (RHSCL), followed by 1.1 and 1.2 will lots of additions and updates.

Today, Red Hat has announced Red Hat Software Collections 2.0 with a truck load of important languages, tools, databases and web servers – including the addition of a new component:  Passenger.  Here’s the list:

  • Python 3.4the latest stable, major release of Python 3 and includes a number of additional utilities and database connectors for MySQL
  • PHP 5.6 – featuring numerous improvements, additions and a streamlined upgrade path for migrating from past versions
  • Perl 5.20 – a recent stable release of Perl shipped with a set of additional utilities, scripts, and database connectors for MySQL and PostgreSQL
  • Ruby 2.2 – and, in its own collection, Rails 4.1 give users the ability to access and install an updated version of Ruby without necessarily having to install an updated version of Rails.
  • MySQL5.6 – inclusive of enhancements to InnoDB for higher transactional throughput, partitioning improvements for querying and managing huge tables, and better performance monitoring
  • MariaDB 10 – a recent stable release of this easy-to-adopt database alternative to MySQL
  • PostgreSQL 9.4 – featuring the new JSONB datatype, increased scalability with Logical Decoding, the foundation for new replication tools such as Bi-Directional Replication, and several additional enhancements that contribute to improved performance
  • MongoDB 2.6 – a high-performance, cross-platform document database features comprehensive core server enhancements, enhanced scalability and index intersection
  • NEW TO RHSCL: Passenger 4.0 – a modern web and application server for Ruby, Passenger 4.0 has been optimized for performance, memory usage and ease-of-use

Red Hat Software Collections 2.0 Beta also includes many updates and enhancements to existing collections, including:

  • Maven 3.0.5 – a recent stable release of the popular build automation tool for Java projects that describes how software is built and all associated dependencies
  • Python 2.7 – now includes python-wheel, python-pip, and all associated dependencies
  • Thermostat 1.2 – adds event-based profiling, an improved sampler profiler, Maven archetypes and visual improvements to the Swing client and charts
  • nginx 1.6 – a recent stable release of nginx, a high performance, open source HTTP sever and reverse proxy option
  • DevAssistant 0.9.3 – a useful tools for setting up development environments, publishing code and other related tasks, this latest, stable version includes several bug fixes and full backwards compatibility
  • Node.js 0.10.33 – previously only available through an unsupported tech preview, the latest stable release of this modern programming platform is now fully supported

All of the above are part of the majority of Red Hat Enterprise Linux subscriptions.

New to Software Collections?  Read about them on the product pages.

See the entire release here.

 

How to package initscripts and unit files for Software Collections

In previous articles we mentioned tips on how to package collections, but we never wrote about initscripts, which are one reason why daemons are harder to package as a collection.

I’ve picked a short(er) initscript to show what has to be modified if you want to run your initscript in a collection. Below is the diff between the mongodb initscript and collection version of the mongodb initscript. Currently, logfiles, pidfiles and configuration files are stored mostly as in the example below, but it depends on the packager. One needs to check where daemon, configuration etc. has been installed and change the initscript accordingly. This example shows generic changes.

Continue reading “How to package initscripts and unit files for Software Collections”