Client usage

After installing the tsuru client, you must set the target with the tsuru server URL, something like:

Setting a target

$ tsuru target-add default https://cloud.tsuru.io
$ tsuru target-set default

Authentication

After that, all you need is to create a user and authenticate to start creating apps and pushing code to them. Use create-user and login:

$ tsuru user-create youremail@gmail.com
$ tsuru login youremail@gmail.com

Apps

Associating your user to a team

You need to be member of a team to create an app. To create a new team, use create-team:

$ tsuru team-create teamname

Creating an app

To create an app, use app-create:

$ tsuru app-create myblog <platform>

This will return your app’s remote url, you should add it to your git repository:

$ git remote add tsuru git@tsuru.myhost.com:myblog.git

Listing your apps

When your app is ready, you can push to it. To check whether it is ready or not, you can use app-list:

$ tsuru app-list

This will return something like:

+-------------+-------------------------+-------------------------------------------+
| Application | Units State Summary     | Ip                                        |
+-------------+-------------------------+-------------------------------------------+
| myblog      | 1 of 1 units in-service | myblog-838381.us-east-1-elb.amazonaws.com |
+-------------+-------------------------+-------------------------------------------+

Showing app info

You can also use the app-info command to view information of an app. Including the status of the app:

$ tsuru app-info

This will return something like:

Application: myblog
Platform: gunicorn
Repository: git@githost.com:myblog.git
Teams: team1, team2
Units:
+----------+---------+
| Unit     | State   |
+----------+---------+
| myblog/0 | started |
| myblog/1 | started |
+----------+---------+

tsuru uses information from git configuration to guess the name of the app, for more details, see “Guessing app names” section of tsuru command documentation.

Public Keys

You can try to push now, but you’ll get a permission error, because you haven’t pushed your key yet.

$ tsuru key-add

This will search for a id_rsa.pub file in ~/.ssh/, if you don’t have a generated key yet, you should generate one before running this command.

If you have a public key in other format (for example, DSA), you can also give the public key file to key-add:

$ tsuru key-add $HOME/.ssh/id_dsa.pub

After your key is added, you can push your application to your cloud:

$ git push tsuru master

Running commands

After that, you can check your app’s url in the browser and see your app there. You’ll probably need to run migrations or other deploy related commands. To run a single command, you should use the command run:

$ tsuru run "python manage.py syncdb && python manage.py migrate"

Further instructions

For a complete reference, check the documentation for tsuru command: http://godoc.org/github.com/tsuru/tsuru-client/tsuru.