Home » DevOps » Deploy your Node/Couchbase application to the cloud with Clever Cloud

About Tugdual Grall

Tugdual Grall, an open source advocate and a passionate developer, is a Chief Technical Evangelist EMEA at MapR. He currently works with the European developer communities to ease MapR, Hadoop, and NoSQL adoption. Before joining MapR, Tug was Technical Evangelist at MongoDB and Couchbase. Tug has also worked as CTO at eXo Platform and JavaEE product manager, and software engineer at Oracle. Tugdual is Co-Founder of the Nantes JUG (Java User Group) that holds since 2008 monthly meeting about Java ecosystem. Tugdual also writes a blog available at http://tgrall.github.io/

Deploy your Node/Couchbase application to the cloud with Clever Cloud


Clever Cloud is the first PaaS to provide Couchbase as a service allowing developers to run applications in a fully managed environment. This article shows how to deploy an existing application to Clever Cloud.

I am using a very simple Node application that I have documented in a previous article: “Easy application development with Couchbase, Angular and Node”.


Clever Cloud provides support for various databases MySQL, PostgreSQL, but also and this is most important for me Couchbase. No only Clever Cloud allows you to use database services but also you can deploy and host your application that could be developed in the language/technology of your choice : Java, Node, Scala, Python, PHP, … and all this in a secure, scalable and managed environment.

Setting up your Clever Cloud environment

Create your account

  1. Go to the Clever Cloud site : http://www.clever-cloud.com/
  2. Click on “Login” link and follow the steps to create your account.
  3. After few seconds you will received an email and be redirected to the Clever Cloud Console.

Create a Couchbase instance

The Clever Cloud Console allows you to create your Couchbase Bucket in few clicks:

  1. Cick on “Services” in the left menu
  2. Click on “Add a Service” in the left menu
  3. clever-cloud-add-couchbase

  4. Click on “Couchbase” button.
  5. Select the size of the RAM quota for your bucket

    Screen Shot 2013-05-30 at 9.19.59 AM

    The size of the RAM Quota for your bucket will have an impact on performance but also on the pricing.

  6. Click “Add this Service”

You are done, you should receive an email with all the information to access your newly created bucket.

The mail from Clever Cloud contains the following information:

db_host = xxxxxxxx.couchbase.clvrcld.netLocation of the database, this is where the endpoint is located.
db_name = yyyyyyyyName of the Couchbase bucket
db_username = xxxxxxxxNot used in Couchbase context
db_password = zzzzzzzzPassword to connect to the Couchbase Bucket

So you are now ready to use your bucket.

Note: In the current version of the Clever Cloud Couchbase Service you do not have access to a management console. If you want to get some information about the database or create views you need to do it from you application code.

Connect your Application to Couchbase@Clever-Cloud

The first step is to get some code, so let’s clone the “Couchbase Ideas Sample Application”, and install the dependencies, using the following commands:

git clone -b 03-vote-with-value https://github.com/tgrall/couchbase-node-ideas.git

cd couchbase-node-ideas

git branch mybranch

git checkout mybranch

npm install

Open the app.js and edit the connection info to point your application to the Couchbase instance and modify the HTTP port of your application to 8080 – this is a mandatory step documented here :

dbConfiguration = {
 "hosts": ["xxxxxxxxxxx.couchbase.clvrcld.net:8091"],
 "bucket": "xxxxxxxxxxx",
 "user": "xxxxxxxxxx",
 "password": "yyyyyyyyyyyyyyyyyyyyyyyyy"


  appServer = app.listen(8080, function() {
 console.log("Express server listening on port %d in %s mode", appServer.address().port, app.settings.env);

Launch your application using

node app.js

Go to http://localhost:8080. Your application is now using Couchbase on the cloud powered by Clever Cloud. Let’s now deploy the application itself on Clever Cloud

Deploy your application on Clever Cloud

The easiest way to deploy an application to Clever Cloud is using git. The first thing to do is to add your SSH public key into Clever Cloud Console. If you do not have any SSH yet, follow the steps described on Github : “Generating SSH Keys”.

Add your SSH key

Note: As you can guess this should be done only once

Open the id_rsa.pub file with a text editor. This is your SSH key. Select all and copy to your clipboard.

  1. Go to the Clever Cloud Console
  2. Click on “Profile” entry in the left menu
  3. Click on “SSH Keys”
  4. Click on “Add a SSH Key”
  5. Enter a name (anything you want) and paste your key
  6. Click “Add” button

You are now ready to deploy applications to Clever Cloud. The next thing to do, is to create a new node application in Clever Cloud.

Create your Application

  1. Click “Add an app” in the Application menu in the top menu.
  2. Give a name and description to this application
  3. Select the Instance type, in this case “Node.js”
  4. Configure your instances, you can keep the default values for now, click “Next”
  5. Check the configuration, and click “Create”

Your application is created, you are redirected to the generic information page, where you can find a Git URL that we will use to deploy the application.

You can navigate into the entries in the left menu to see more information about your application. In addition to the Information page, you can look at the following entries:

  1. “Domain Names” to configure the URL to access your application
  2. “Logs” to view the application logs

Deploy the Application

So we are almost there!

The deployment to Clever Cloud is done using a Git push command, so you need to add the deployment URL as a remote repository to your application, using the following command:

git remote add clever git+ssh://git@push.clever-cloud.com/app_[your_app_id].git

git commit -a -m “Couchbase on Clever Cloud connection”

git push clever mybranch:master

Once you have added the application as remote repository you can commit and push your application.

The last command pushes the application  to Clever Cloud. It is important to note that Clever Cloud will always deploy the application on the “master” branch on the remote repository. The notation mybranch:master is used to mention it. If you work locally on your master branch just use “master”.

You can now go to the Clever Cloud console and look in the log and click on the URL in the “Domain Names” section to test your application. You should be able to see your application, that is running on the Clever Cloud PaaS. When you update your application, you just need to do a  git push and git commit.


In this tutorial you have learned how to:

  • Create your Clever Cloud account
  • Create a Couchbase instance
  • Create and deploye a Node.js application

Feel free to test this yourself, with Node or other technology, as you can see it is quite easy to setup.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....


Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions


Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments