In the last section we omitted the dependencies step of deploy. In tsuru, an
application can have two kinds of dependencies:

Operating system dependencies, represented by packages in the package manager
of the underlying operating system (e.g.: yum and apt-get);

Platform dependencies, represented by packages in the package manager of the
platform/language (in Ruby, bundler).

All apt-get dependencies must be specified in a requirements.apt file,
located in the root of your application, and ruby dependencies must be located
in a file called Gemfile, also in the root of the application. Since we
will use MySQL with Rails, we need to install mysql package using gem,
and this package depends on an apt-get package: libmysqlclient-dev, so
here is how requirements.apt looks like:

As you can see, in the deploy output there is a step described as “Restarting
your app”. In this step, tsuru will restart your app if it’s running, or start
it if it’s not. But how does tsuru start an application? That’s very simple, it
uses a Procfile (a concept stolen from Foreman). In this Procfile, you describe
how your application should be started. Here is how the Procfile should look like:

web: bundle exec rails server -p $PORT -e production

Now we commit the file and push the changes to tsuru Git server, running
another deploy:

It would be boring to manually run rakedb:migrate after every deployment.
So we can configure an automatic hook to always run before or after
the app restarts.

tsuru parses a file called tsuru.yaml and runs restart hooks. As the
extension suggests, this is a YAML file, that contains a list of commands that
should run before and after the restart. Here is our example of tsuru.yaml: