Tsuru PaaS on Google Cloud Platform
Tsuru is an Open-Source Multi-Provisioner Platform as a Service created by Globo.com, with more than 4 years orchestrating and running docker in production.
Tsuru comes with its own orchestrator, but you can add both Swarm and Kubernetes clusters, in a hybrid cloud with multi orchestrators scenario.
In this article, we will show how to run Tsuru on Google Cloud Platform (GCP), and in the next articles how to run Swarm and Kubernetes on Google Cloud and add them as clusters in Tsuru.
Starting with Google Cloud Platform
Google Cloud Platform have a lot of API's for Cloud Computing. To run Tsuru we will use Google Compute Engine, that provides an API to create and manage virtual machines.
Free-Trial Account
Google Cloud gives you 1 year with $300 in credit to play. Create your account (if you don't have yet) at: https://cloud.google.com/free/
Project
Go to https://console.cloud.google.com/ and create a new project.
Google Compute Engine API
Go to https://console.developers.google.com/apis/api/compute_component and activate the Google Compute Engine API
Google Cloud SDK
Download Google Cloud SDK at http://cloud.google.com/sdk and install in your machine.
Initialize
Now that you have the SDK installed, initialize it, log-in at your account and select the project-id you have created before. (if you only have one, it will be selected for you)
$ gcloud init
If you already have gcloud initialized, you can just set it to use the new project:
$ gcloud config set project tsuru-test
And don't forget to set the default login:
$ gcloud auth application-default login
Starting with Tsuru
Tsuru client
Follow the instructions to install tsuru-client: https://docs.tsuru.io/stable/using/install-client.html.
You can also install Tsuru bash (or zsh) completion script.
$ mv misc/bash-completion ~/.tsuru-completion.bash$ echo "if [ -f '$HOME/.tsuru-completion.bash' ]; then source '$HOME/.tsuru-completion.bash'; fi" >> ~/.profile$ source ~/.profile
Tsuru Installer
Create a yaml file with the following content, replace the value of google-project key with the project-id you created before.
Tsuru Installer uses docker-machine package, so you can use any supported flags. You can see more about google driver for docker-machine at https://docs.docker.com/machine/drivers/gce
Now call Tsuru installer passing the file config to install Tsuru on GCP.
$ tsuru install-create -c tsuru-gce.ymlRunning pre-install checks...
Running pre-create checks...
(tsuru-gce-1) Check that the project exists
(tsuru-gce-1) Check if the instance already exists
Creating machine...
...
--- Installation Overview ---
Core Hosts:
+---------------+-------+---------+
| IP | State | Manager |
+---------------+-------+---------+
| 146.148.36.59 | ready | true |
+---------------+-------+---------+Core Components:
+----------------+-------+----------+
| Component | Ports | Replicas |
+----------------+-------+----------+
| tsuru_registry | 5000 | 1 |
+----------------+-------+----------+
| tsuru_redis | | 1 |
+----------------+-------+----------+
| tsuru_planb | 80 | 1 |
+----------------+-------+----------+
| tsuru_mongo | | 1 |
+----------------+-------+----------+
| tsuru_tsuru | 8080 | 1 |
+----------------+-------+----------+
Configured default user:
Username: admin@example.com
Password: ********
...
Now you have Tsuru installed on GCP and the client already configured to use it.
$ tsuru target-list
* tsuru-gce (http://146.148.36.59:8080)$ tsuru node-list
+-------------------------+---------+--------+----------------------
| Address | IaaS ID | Status | Metadata
+-------------------------+---------+--------+----------------------
| https://10.128.0.2:2376 | | ready | LastSuccess=2017-05- | | | | 12T18:58:28Z
| | | | pool=theonepool
+-------------------------+---------+--------+----------------------$ tsuru app-list
+-----------------+-------------------------+-----------------------
| Application | Units State Summary | Address
+-----------------+-------------------------+-----------------------
| tsuru-dashboard | 1 of 1 units in-service | tsuru-dashboard. | | | 146.148.36.59.nip.io
+-----------------+-------------------------+-----------------------
Before you access tsuru-dashboard, you need to open the port 80 in GCP Firewall.
$ gcloud compute firewall-rules create tsuru-apps \
--allow tcp:80 \
--source-ranges 0.0.0.0/0 \
--target-tags tsuru \
--project [project-id]
Now go and access tsuru-dashboard address at your browser.
You can learn how to install platforms and create apps accessing Tsuru documentation: https://docs.tsuru.io/stable/using/quickstart.html
Next…
Now you have a fresh Tsuru running with the default orchestrator docker-cluster. In next article, you will learn how to run a Swarm Cluster on Google Cloud Platform and add the cluster to Tsuru.
For more information about Tsuru, check out the docs.