When I’m at events and conferences I’m always asked how much does Couchbase charge for hosting. The simple answer is that Couchbase is
a software company and not a hosting company, but that doesn’t mean that you can’t host Couchbase through some other service. There are Couchbase
images available on services including Amazon Web Services (AWS), Azure, Joyent, and many others.

In particular, we’re going to look at hosting Couchbase Server on Joyent’s Triton platform with Docker.

A Background on Joyent and Triton

If you’re unfamiliar with Joyent, it is a software and services company that specializes in performance driven public and private cloud
computing. Using Joyent’s Triton service, you can “…securely deploy and operate containers with bare metal speed on
container-native infrastructure”. Some of the advantages of running Docker containers on Triton include:

  • Your containers run on bare metal, eliminating hardware level virtualization overhead. In other words you will experience
    significantly improved performace.
  • Each container has its own IP address which makes it easier to network between containers.
  • You can resize your Docker containers with no down time.

The Requirements

Being that we’re going to get a Couchbase Server cluster up and running on Joyent’s Triton, there will be a few requirements in the process:

  • Docker 1.8
  • A Joyent Account
  • An SSH Private Key

You can probably get away with using a different version of Docker, but I’m using 1.8. It is up to you how adventurous you want to be.

Using Couchbase with Docker Containers

At this point, if you haven’t already installed the Docker Toolbox, now is a
good time. It will contain all the tools necessary for using Docker on our local computer.

Now the Docker Toolbox contains a tool called Kitematic, offering GUI support for Docker. We won’t be using that tool. Instead we are going
to do everything from the Terminal (Mac and Linux) or Command Prompt (Windows).

Note that for now we are going to use Docker locally only, just to become familiar with Couchbase and Docker. Later in this guide we’ll be
connecting to Joyent’s Triton service.

Download and Start a Couchbase Server Container

From the Docker Terminal application, run the following command:

The above command will download the latest official Couchbase Server Docker image, give the container a name on our system, and start it.
You can test that it was successful by visiting in your browser. Note
that is whatever your Docker Terminal told you when you started it.

Start a Second Couchbase Server Container

Go ahead and start up a second local Couchbase Server instance with Docker. This time you want to do the following:

Notice this time we changed the container name and increased the host port to 8092 instead of 8091. This
is to prevent port conflicts.

Stop and Remove Both Couchbase Server Containers

We no longer need these locally running Couchbase Server Docker containers. To remove them, we must first figure out their unique
container value like so:

The result will look something like this:

With the unique container values you can then run:

Both local containers should now be removed.

Connecting Docker to the Triton Cloud API

Up until now, everything Docker and Couchbase was local to your machine. Now we’re going to connect our Docker client to the Joyent
Cloud API so we can make use of Triton. The steps we’re going to follow can be found in
the official Joyent documentation, but can also be seen in this guide.

Start by obtaining the Joyent helper script like so:

If you don’t have or can’t use curl download the file manually. With the script downloaded, you want to now execute it,
passing in a particular set of parameters:

The CLOUDAPI_URL can be one of the following, per the documentation:

  • https://us-east-1.api.joyent.com
  • https://us-sw-1.api.joyent.com
  • https://eu-ams-1.api.joyent.com

The ACCOUNT_NAME is the username you use to sign into the Joyent dashboard. Like mentioned earlier, you’ll need an SSH
private key to plug into PRIVATE_KEY_FILE.

When you run the script, it may ask you to enter your private key password a few times. Just follow the instructions and do as it says. At
the end, it will supply you with something that looks like the following:

You’ll want to run those export statements, but don’t forget to change my nraboy to that of whatever
it generated for you. These export statements are important because once you run them, Docker will then use Joyent for managing
containers instead of your local machine.

Run Couchbase Server Containers on Joyent

Remember those local Docker commands we ran earlier? Let’s run them again with a minor modification:

We shouldn’t need to define port mapping on our own when it comes to Joyent. This is because Joyent gives us an IP for every container we
create. On our local machine we only have one IP and ports become an issue. Just make use of the -P flag and you
should be good.

If you sign into your Joyent dashboard you should see the node and its IP address. If you don’t want to obtain the information via
the Joyent dashboard, you can always do this via the Docker Terminal because everything it does is on the remote side now:

Remember of course to switch out the unique container id with those returned from docker ps.

Configure Your First Couchbase Node

Using one of the IP addresses returned from the docker inspect command, enter it in your web browser with port
8091 appended. Something like will do it.

Walk through the steps for configuring the Couchbase cluster. Remember the IP and administrator credentials as they’ll be needed when
adding new nodes to your cluster.

Add More Nodes to Your Couchbase Triton Cluster

Time to add another Couchbase Server container to Triton so we can cluster our Couchbase nodes. From the Docker Terminal run:

Like we discussed earlier, get the IP of this container and boot it up in your web browser on port 8091.

Instead of choosing to create a new Couchbase cluster, choose to join one and enter the information of the other server. When complete,
rebalance the server and you’re good to go!

Remove Containers from Your Cluster

Being that Couchbase is pretty scalable, you’ll probably find yourself needing to remove nodes every once in a while. To do this, you’ll
need to first gracefully remove the Couchbase node from your cluster via the Couchbase administrative dashboard. The removal will include
a rebalance of all of your existing nodes.

With the node safely removed from the cluster, you can now remove its container from Joyent’s Triton service. In your Docker Terminal proceed
with the same steps we followed when we removed a container locally:

Remember of course to swap out the unique container ids with those returned from docker ps.


We just saw how to make use of Joyent’s Triton service to host Docker containers with Couchbase Server. Using Joyent will give you incredible
performance with its bare-metal infrustructure and excellent security.

The topic of security was out of the scope for this particular article, but it may be revisited in a future post.

To compliment this article, Joyent is giving Couchbase users a promotional discount on its Triton service. You can sign up for Joyent and
make use of this offer here.


Posted by Nic Raboy, Developer Advocate, Couchbase

Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.

Leave a reply