Your own Self Hosted PaaS (Platform as a Service) Server, Using Tsuru.

What is PaaS?

Platform as a service (PaaS) is a cloud computing model in which a third-party provider delivers hardware and software tools — usually those needed for application development — to users over the internet. A PaaS provider hosts the hardware and software on its own infrastructure. As a result, PaaS frees users from having to install in-house hardware and software to develop or run a new application.

What is Tsuru?

Tsuru is a japanese word for crane, well that’s a literal meaning.Tsuru is an extensible and open source Platform as a Service (PaaS) that makes application deployments faster and easier. With tsuru, you don’t need to think about servers at all. As an application developer, you can:

  • Write apps in the programming language of your choice
  • Back apps with add-on resources such as SQL and NoSQL databases, including memcached, Redis, and many others
  • Manage apps using the tsuru command-line tool
  • Deploy apps using the Git version control system
  • Deployment using docker containers.
  • Option to Rollback to previous state.

Find more

Why Tsuru?

Its a long story about how I came to preferring tsuru, but I’ll explain in brief. I am a devops practicing sysadmin, and even though lots of deployments are automated, there’s still some amount of dependency on the ops team. I was already aware of PaaS providers like OpenShift, Heroku, Platform.sh, etc. They served the purpose of self-service deployment tools for developers very well, but it isn’t worth spending for after the numerous staging environments that we would deploy every day. So I searched for a self-hosted solution and tada! I found tsuru.

It is free, open-source, self-hosted, and provides self — service managment of application deployments to developers. It supports a wide range of platforms like python, php, java, ruby, cordova, nodejs etc. Find full list of supported platforms here. It serves the purpose of a PaaS very well, and its in full control of your organization. Admins can create users, teams, and roles and control the number of applications they can deploy, amount of resources they can use. A user can belong to multiple team, and have access to apps and resources created. Admins can create plans, and configure resource allocation for each plan and many more. Now let’s get to the installation steps.

Installation

Installing tsuru is pretty simple, all you need is a tsuru client binary and a config file for host configurtion which consists of server endpoints and authentication and access methods. I’ll show installtion steps for linux operation systems. I am using two vagrant machines one for core components and other for app deployments.

The primary reason for using separate machines for core and apps is that they use docker api server endpoints to manage core stack and apps, if both endpoints are same it leads to errors. Hope they’d resolve it. You may deploy core on a VM running the same server you are going to run apps.

Download tsuru client

wget https://github.com/tsuru/tsuru-client/releases/download/1.7.1/tsuru_1.7.1_linux_amd64.tar.gz

Extract it and cd into the directory.

tar -xzvf tsuru_1.7.1_linux_amd64.tar.gz && cd tsuru_1.7.1_linux_amd64.tar.gz

Here you’ll find tsuru binary executable, now lets copy it to some place so that i can be globally run from anywhere.

sudo cp tsuru /usr/local/bin

Now type tsuru in your cli and you’ll see list of possible commands you can run.

Now lets create a configuration file.

nano config.yml

Copy and paste this into your config file

hosts:
core:
size: 1
driver:
options:
generic-ip-address: ["machine-1-IP"]
generic-ssh-key: ["~/keys/machine-1"]
apps:
size: 1
driver:
options:
generic-ip-address: ["machine-2-IP"]
generic-ssh-key: ["~/keys/machine-2"]
driver:
name: generic
options:
generic-ssh-port: 22
generic-ssh-user: vagrant

Replace the machine-1–ip with ip of server where you want core components to be installed and machine-2-ip with ip of server where you want apps to be deployed. Change the ssh-port and ssh-user according to your machine’s configuration.

I am using vagrant machines here so if you want your tsuru server to be easily accessible over any computer in network make sure you use bridged interface if you are using VM.

After you’ve created you config.yml , its time to provision servers.

tsuru install create -c config.yml

This command will provision the hosts with all the necessary components will tsuru dashboard.

the -c config.yml parameter tell the installer to use provided config file, or else it will create its own host using Virtualbox and provision it there.

At the end of successful installtion you’ll get an output with admin email and password, copy these somewhere for later use.

It will also add the tsuru api target to the cli and login as admin user.

Now you have a running tsuru paas on your local machine using vagrant.

For further information on how to deploy apps and add services to tsuru follow the official guide here.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dishant Pandya

Dishant Pandya

Curious about Tech and Producing Electronic Music