Moritz Schepp

Setup ConedaKOR with KORCluster

ConedaKOR is a document database. It’s specialty are graph based structures for the metadata: You are not entering information into tables anymore but you are embedding your knowledge within a flexible network.

In order to facilitate and automate the process of setting up ConedaKOR installations, we developed a set of simple scripts to do the heavy lifting. We currently use this within our own CI infrastructure and UA testing. In this post, I’ll show how the scripts can be used hoping that this will help people to test, showcase or install the software.

After going through the steps below, you’ll be able to quickly set up clusters which can each host many instances of ConedaKOR. In addition to the instances, a cluster contains a mysql server, a mongodb server and an elasticsearch server.

Install ubuntu 14.04

We will use ubuntu during this post but any distribution that runs docker will do. With ubuntu, 14.04 is needed since older versions don’t satisfy docker’s kernel requirement (>= 3.13.0). Debian jessie also brings a recent enough kernel.

Please refer to ubuntu’s excellent setup documentation at https://help.ubuntu.com.

Install docker

On most debian-based distributions, docker can be installed via APT. There is a comprehensive guide on that process at https://docs.docker.com/installation/#installation.

Install git

Install the git version control system. for ubuntu and debian, this can be done by running

apt-get install git-core

as root. Also make sure to be root for the next few steps. Until now, docker can’t be run by normal users.

Instantiate your cluster

We’ll start by cloning the github repository:

cd /opt
git clone https://github.com/coneda/kor_cluster.git

Among other things, that’ll give you an executable shell script to instantiate new clusters and instances within them. Go ahead and give it a try:

kor_cluster/cluster.sh create /opt/my_cluster

The cluster has now been created. This means that a set of configuration files and scripts have been deployed to the given directory. Now, boot it up:

/opt/my_cluster/cluster.sh boot

This should fail with a message that your ssmtp config file is unchanged. The problem is that the ConedaKOR instances rely on sending mail for delivering account information and other notifications. In order to use the instances productively, you will have to fill in a correct SMTP configuration at /opt/my_cluster/ssmtp/ssmtp.conf. For now, just add a comment to get started and boot the cluster.

echo "# just a change" >> /opt/my_cluster/ssmtp/ssmtp.conf
/opt/my_cluster/cluster.sh boot

This will download the docker images for mysql, mongodb and elasticsearch. Although they are very well optimized and consume a relatively small amount of disk space, you will still have to download several MB.

Once the downloads are complete and the docker containers have been started, the cluster is up and running. You can verify that by asking docker:

docker ps -a

Your first instance

Should list all three docker containers as up and running. We can now create our first ConedaKOR installation:

VERSION=v1.8.2 PORT=8080 /opt/my_cluster/cluster.sh new my_instance

This will create another directory at /etc/my_cluster/instances/my_instance. Additionally, the database will be created and set up with the required schema. For a list of available versions, have a look at https://docker.coneda.net/v1/repositories/kor/tags. The port is the one that the instance is going to be exposed with. So now, you can run the instance:

/etc/my_cluster/instances/my_instance/instance.sh start

Again, you can check the outcome with

docker ps -a

Unfortunately, shutting down the server will not cleanly shutdown the docker containers. So to stop everything, run

/opt/my_cluster/instances/my_instance/instance.sh stop
/opt/my_cluster/cluster.sh stop
shutdown -h now

And that’s it!

Wrapping up

I hope you got a good idea of what you can do already with our tools and where we are headed. In a later post, I’ll show how the actual docker images can be created from scratch using debootstrap and the ConedaKOR source code.

By the way, the git repository contains a Vagrantfile. Running

vagrant up

Will setup an ubuntu virtual machine with docker. You can use this as a starting point to play around with clusters. The VM forwards the host port 8080 to the guest port 8001, so if you start an instance within a cluster on that port, you’ll be able to see it with a browser on the host at

http://localhost:8080

Please let me know if you have any questions or suggestions.