Build your own PaaS with tsuru and Docker on Centos

This document describes how to create a private PaaS service using tsuru and docker on Centos.

This document assumes that tsuru is being installed on a Centos (6.4+) machine. You can use equivalent packages for beanstalkd, git, MongoDB and other tsuru dependencies. Please make sure you satisfy minimal version requirements.

Just follow this steps:

DNS server

You can integrate any DNS server with tsuru. Here: you can find a example of how to install a DNS server integrated with tsuru


To make docker working on a RHEL/Centos distro, you will need to use the EPEL repository, build a kernel with AUFS support, and install all dependencies as following:

# Installing the EPEL respository
$ rpm -iUvh
$ yum update -y

Here you can install our own kernel+lxc+docker or compile them To install our RPM package ready to go:

# Installing the EPEL respository
# rpm -iUvh \ \ \

To Compile, just follow these steps

# Download the kernel + dependencies for docker
$ yum install fedora-packager -y
# you will need to perform these steps bellow with a unprivileged user, ex: su - tsuru
$ git clone
$ cd docker-rhel-rpm
# Remove auto restart of docker, as it will be managed by circus
$ sed -i 's|^%{_sysconfdir}/init/docker.conf||; s/.*source1.*//i' docker/docker.spec

Now, just follow the steps to build the kernel + lxc + docker from here:

# In order to use docker, you will need to allow the ip forward
$ grep ^net.ipv4.ip_forward /etc/sysctl.conf > /dev/null 2>&1 && \
                    sed -i 's/^net.ipv4.ip_forward.*/net.ipv4.ip_forward = 1/' /etc/sysctl.conf  || \
                    echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
$ sysctl -p
# You also need to disable selinux, adding the parameter "selinux=0" in your new kernel 3.10 (/boot/grub/grub.conf)
$ grep selinux=0 /boot/grub/menu.lst
# Turn off your default firewall rules for now
$ service iptables stop
$ chkconfig iptables off

After build, install and reboot the server with the new kernel(it will take some time), you will need to install the tsuru’s dependencies

Tsuru’s Dependencies

Tsuru needs MongoDB stable, distributed by 10genr, Beanstalkd as work queue, git-daemon(necessary for Gandalf) and Redis for hipache pt-ge Install the latest EPEL version, by doing this:

$ yum install mongodb-server beanstalkd git-daemon redis python-pip python-devel gcc gcc-c++ -y
$ service mongod start
$ service beanstalkd start
$ service redis start
$ chkconfig mongod on
$ chkconfig beanstalkd on
$ chkconfig redis on

Tsuru Setup

Tsuru uses Gandalf to manage git repositories, and hipache as router To setup Tsuru, just follow this steps. Obs: It can be used to upgrade this services as needed

$ curl -o
$ source
# Install Tsuru Server(tsr), Gandalf, Hipache and Circus for monitoring
$ install_services


Before running tsuru, you must configure it. By default, tsuru will look for the configuration file in the /etc/tsuru/tsuru.conf path. You can check a sample configuration file and documentation for each tsuru setting in the “Configuring tsuru” page.

You can download the sample configuration file from Github

By default, this configuration will use the tsuru image namespace, so if you try to create an application using python platform, tsuru will search for an image named tsuru/python. You can change this default behavior by changing the docker:repository-namespace config field.

To automatically configure tsuru and all other services, just run the function presented in file, as following

# It will configure tsuru, gandalf, hipache and circus. If you had already done that before, your previously configuration will be lost
$ source #you already did it above
$ configure_services_for_first_time
# start circus
$ initctl start circusd

At that time, circus should be running and started all the tsuru services


Now that you have tsr properly installed, and you configured tsuru Verify api, collector and docker-ssh-agent

$ ps -ef|grep ts[r]

Creating Docker Images

Now it’s time to install the docker images for your neededs platform. You can build your own docker image, or you can use ours own images as following

# Add an alias for docker to make your life easier (add it to your .bash_profile)
$ alias docker='docker -H'
# Build the wanted platform, here we are adding the static platform(webserver)
$ docker build -t tsuru/static
# Now you can see if your image is ready - you should see the tsuru/static as an repository
$ docker images
# If you want all the other platforms, just run the command bellow
$ for image in nodejs php python ruby; do docker build -t tsuru/$image$image/Dockerfile;done
# To see if everything went well - just take a look in the repository column
$ docker images
# Now try to create your apps!

Using tsuru

Congratulations! At this point you should have a working tsuru server running on your machine, follow the tsuru client usage guide to start build your apps.

Adding Services

Here you will find a complete step-by-step example of how to install a mysql service with tsuru: