Posted about 7 years ago. Visible to the public. Repeats.

Capistrano: How to find out which version of your application is currently live

When deploying, Capistrano will put a REVISION file into your application's release directory. It contains the hash of the commit which was deployed.

You can just SSH to a server and do this:

Copy
cat /var/www/my-project/REVISION cf8734ece3938fc67262ad5e0d4336f820689307

If you are deploying to multiple machines, you'd want to run that command on each server.

This Capistrano task will run it on all your project's servers that have the :app role:

Copy
desc 'Show deployed revision' deploy.task :revision, :roles => :app do run "cat #{current_path}/REVISION" end

Output of the task looks like this:

Copy
* 10:26:15 == Currently executing `deploy:revision' * executing "cat /var/www/my-project/current/REVISION" servers: ["web1.example.com", "web2.example.com"] [web1.example.com] executing command ** [out :: web1.example.com] cf8734ece3938fc67262ad5e0d4336f820689307 [web2.example.com] executing command ** [out :: web2.example.com] cf8734ece3938fc67262ad5e0d4336f820689307

FYI: Capistrano also logs each deployment. We have a separate card on finding out user/branch/commit/timestamp for past deployments.

By refactoring problematic code and creating automated tests, makandra can vastly improve the maintainability of your Rails application.

Owner of this card:

Avatar
Arne Hartherz
Last edit:
about 1 month ago
by Arne Hartherz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more