This document describes how to create a private PaaS service using tsuru. It contains instructions on how to build tsuru and some of its components from source.
This document assumes that tsuru is being installed on a Ubuntu machine. You can use equivalent packages for beanstalkd, git, MongoDB and other tsuru dependencies. Please make sure you satisfy minimal version requirements.
There’s also a contributed Vagrant box, that setups a PaaS using Chef. You can check this out: https://github.com/hfeeki/vagrant-tsuru.
The Tsuru PaaS is composed by multiple components:
And these components have their own dependencies, like:
The steps below will guide you throught the install process on Ubuntu Server 12.04.
If you try to build tsuru server on most Linux systems, you should have few problems and if there are problems, we are able to help you. Just ask on #tsuru channel on irc.freenode.net.
Tsuru server is a lightweight framework and can be run in a single small machine along with all the deps.
3.1 MongoDB
Tsuru needs MongoDB stable, distributed by 10gen. It’s pretty easy to get it running on Ubuntu
3.2 Juju
Tsuru uses juju to orchestrates your “apps”. To install juju follow the juju install guide. Please make sure that you configure Juju properly. Then run:
$ juju bootstrap
Juju Charms define how platforms will be installed. You may take a look at juju charms collection or use the charms provided by tsuru
Put it somewhere and define the setting juju:charms-path in the configuration file:
$ git clone git://github.com/globocom/charms.git /home/me/charms
$ cat /etc/tsuru/tsuru.conf
# ...
juju:
charms-path: /home/me/charms
3.3 Beanstalkd
Tsuru uses Beanstalkd as a work queue. Install the latest version, by doing this:
$ sudo apt-get install -y beanstalkd
3.4 Gandalf
Tsuru uses Gandalf to manage git repositories, to get it installed follow this steps
You can use apt-get to install Gandalf using Tsuru’s ppa:
$ sudo apt-add-repository ppa:tsuru/ppa -y
$ sudo apt-get update
$ sudo apt-get install tsuru-server
Then you will need to edit the file /etc/default/tsuru-server and enable the API and the colletor:
TSR_API_ENABLED=yes
TSR_COLLECTOR_ENABLED=yes
Make sure you edit the configuration file (see Configuring tsuru) and then start API and collector using upstart:
$ sudo start tsuru-server-api
$ sudo start tsuru-server-collector
You can download pre-built binaries of tsuru and collector. There are binaries available only for Linux 64 bits, so make sure that uname -m prints x86_64:
$ uname -m
x86_64
Then download and install the tsr binary:
$ curl -sL https://s3.amazonaws.com/tsuru/dist-server/tsr-master.tar.gz | sudo tar -xz -C /usr/bin
These commands will install tsr in /usr/bin (you will need to be a sudoer and provide your password). You may install this command in your PATH.
To build tsuru from source you will need to install the following packages
$ sudo apt-get install -y golang-go git mercurial bzr gcc
Add the following lines to your ~/.bashrc:
$ export GOPATH=/home/ubuntu/.go
$ export PATH=${GOPATH}/bin:${PATH}
Then execute:
$ source ~/.bashrc
$ go get github.com/globocom/tsuru/tsr
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:
$ [sudo] mkdir /etc/tsuru
$ [sudo] curl -sL https://raw.github.com/globocom/tsuru/master/etc/tsuru.conf -o /etc/tsuru/tsuru.conf
Make sure you define the required settings (database connection, authentication configuration, AWS credentials, etc.) before running tsuru.
Now that you have tsr properly installed, and you configured tsuru, you’re three steps away from running it.
$ sudo service mongodb start
$ sudo service beanstalkd start
$ tsr api &
$ tsr collector &
One can see the logs in:
$ tail -f /var/log/syslog
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.