How-tos

Databases on tap with Compose on Bluemix

Share this post:

Compose logo

Did you know that Compose databases are now available from the Bluemix catalog? That’s Compose for MongoDB, PostgreSQL, Redis, Elasticsearch, RethinkDB and RabbitMQ, all production ready for your applications now. You can also get access to Compose’s beta offerings like etcd in a similarly simple fashion.

Each database deployment from Compose is built with a multiple node, high availability configuration using the same technology Compose uses on other platforms. That means your databases are monitored, backed up and managed automatically.

How do you get a Compose database on Bluemix? Just select, create and bind the Compose database of your choice to your application. You’ll find the VCAP_SERVICES data of your application is automatically updated with the information you need to connect to your new database.

To make it even simpler, we’ve created sample apps for Node.js for all the current Compose databases, ready for you to download and use. Each app will get you up and running and connected to your Compose for Bluemix deployment.

Choosing a Compose Bluemix service

Each database has its own speciality. If you’re after a general purpose, widely used NoSQL JSON document database, start your database planning with Compose for MongoDB. If you need a fast, in-memory cache or application shared state then Compose for Redis should figure in your stack. If searching and scoring large amounts of free text is core to your application, then Compose for Elasticsearch is your go-to-database. When you want a powerful structured relational database, Compose for PostgreSQL will fulfill your needs with its rich SQL support. Compose for RethinkDB can fill out your application stack with its real-time changefeeds for client applications. Messaging within your platform can be addressed by Compose for RabbitMQ and its reliable broker technology. Finally, at least for now, Compose for etcd brings a reliable key/value store for configuration and other shared data.

All of these databases are available from the Bluemix catalog and can run alongside each other so you can select the best combination for your applications.

Getting started

Let’s look at what’s involved in getting a MongoDB database up and running. The first port of call is the Bluemix Catalog, where you’ll find the Compose databases in the “Data & Analytics” section. You can follow this link to quickly search for the Compose databases. You should see this list:

Bluemix catalog search for Compose services

Remember to log in or sign up with Bluemix at this point so you can deploy a Compose database. Once you have done that, click Compose for MongoDB to see the catalog details for MongoDB:

Compose for MongoDB

Now you can enter the service name and credentials name your application will use:

mongodb-credentials

Compose databases autoscale, so at this point you’ll be provisioning a database with 1GB of storage and 102MB of RAM per database node in the cluster. As the cluster is replicated, that’s effectively 1GB of data storage. As the data grows, so will the storage available and, likewise, the RAM available to each database node.

Clicking the Create button starts the process of provisioning this database service for you. When complete, it’ll appear like any other Bluemix service, in the dashboard. We haven’t yet bound the database to any application, but once we do, the credentials for the database would be passed to that application through VCAP_ENV.

It’s then a matter for the application to retrieve them. The credentials for Compose for MongoDB are listed in the documentation for the service, and the Compose for MongoDB sample shows how to use the values in an application. To see our sample apps for the other databases, just search for “compose-” there to display all the current examples.

Connecting to the database

The MongoDB example shows how to locate a database service by type by searching for “Compose for MongoDB” in the service information and then using the credentials found in that location to create the connection to the server. The example breaks this process down step by step starting in server.js, with detailed comments.

For an even quicker start, clone and deploy the example and bind the MongoDB database instance previously created to the example. The steps to perform that are in the README file for the example.

Technical Writer for Compose

More How-tos stories
April 30, 2019

Introducing IBM Analytics Engine v1.2 and Announcing the Deprecation of IBM Analytics Engine v1.0

We are excited to inform you about the new version of IBM Analytics Engine v1.2 that will be available starting May 15, 2019. Along with this release, Analytics Engine v1.0 will be retired.

Continue reading

April 23, 2019

Announcing the Deprecation of the Watson Machine Learning JSON Token Authentication Service

We’d like to inform you about the deprecation of the Watson Machine Learning JSON Token Authentication service. This method of authentication will be retired on May 30, 2019.

Continue reading

April 16, 2019

Announcing the Deprecation of the Decision Optimization Beta Service

The End of Beta date for the Decision Optimization service is May 17, 2019. The End of Beta Support date is June 20, 2019.

Continue reading