Build your own PaaS with tsuru and Docker

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

This document assumes that tsuru is being installed on a Ubuntu 12.04 LTS 64-bit machine.

Before install

Before install, let’s install curl and python-software-properties, that are used to install extra repositories.

sudo apt-get update
sudo apt-get install curl python-software-properties -qqy

Adding repositories

sudo apt-key adv --keyserver hkp:// --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
echo "deb docker main" | sudo tee /etc/apt/sources.list.d/docker.list

sudo apt-add-repository ppa:tsuru/lvm2 -y
sudo apt-add-repository ppa:tsuru/ppa -y

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
echo "deb dist 10gen" | sudo tee /etc/apt/sources.list.d/mongodb.list

sudo apt-get update

Installing MongoDB

sudo apt-get install mongodb-10gen -qqy

Installing beanstalkd

sudo apt-get install beanstalkd -qqy
cat > /tmp/default-beanstalkd <<EOF
sudo mv /tmp/default-beanstalkd /etc/default/beanstalkd
sudo service beanstalkd start

Installing redis

sudo apt-get install redis-server -qqy

Installing hipache

sudo apt-get install node-hipache -qqy
sudo start hipache

Installing docker

sudo apt-get install lxc-docker -qqy
echo export DOCKER_OPTS=\"-H\" | sudo tee -a /etc/default/docker
echo export DOCKER_HOST= >> ~/.bashrc
sudo stop docker
sudo start docker

Installing gandalf

sudo apt-get install gandalf-server -qqy
sudo mkdir -p $hook_dir
sudo curl -o ${hook_dir}/post-receive
sudo chmod +x ${hook_dir}/post-receive
sudo chown -R git:git /home/git/bare-template
# make sure you write the public IP of the machine in the "host" parameter
# in the /etc/gandalf.conf file

sudo start gandalf-server
sudo start git-daemon

Installing tsuru API server

sudo apt-get install tsuru-server -qqy

sudo curl -o /etc/tsuru/tsuru.conf
# make sure you replace all occurrences of {{{HOST_IP}}} with the machine's
# public IP in the /etc/tsuru/tsuru.conf file
sudo sed -i -e 's/=no/=yes/' /etc/default/tsuru-server
sudo start tsuru-ssh-agent
sudo start tsuru-server-api
sudo start tsuru-server-collector

Installing platforms

curl | mongo tsuru

And then install your preferred platform from basebuilder. For example, Python:

docker build --no-cache -t tsuru/python

Replace Python with the desired platform (check basebuilder for a list of available platforms).

Using tsuru client

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: Install and configure a MySQL service.

DNS server

You can integrate any DNS server with tsuru. Here you can find an example of using bind as a DNS forwarder, integrated with tsuru.