When deploying, Capistrano puts a REVISION
file into your application's release directory. It contains the hash of the commit which was deployed.
If you want to know the currently deployed release, simply SSH to a server and view that file.
$ cat /var/www/my-project/current/REVISION
cf8734ece3938fc67262ad5e0d4336f820689307
Capistrano task
When your application is deployed to multiple servers, you probably want to see a result for all of them.
Here is a Capistrano task that checks all servers with the :app
role.
namespace :app do
desc 'Show deployed revision'
task :revision do
on roles :app do |host|
within current_path do
info "#{host}: #{capture :cat, 'REVISION'}"
end
end
end
end
Output looks like this:
$ cap production app:revision
00:00 deploy:revision
app01.example.com: cf8734ece3938fc67262ad5e0d4336f820689307
app02.example.com: cf8734ece3938fc67262ad5e0d4336f820689307
app03.example.com: cf8734ece3938fc67262ad5e0d4336f820689307
Capistrano 2 (legacy)
namespace :app do
desc 'Show deployed revision'
task :revision, roles: :app do
run "cat #{current_path}/REVISION"
end
end
Further resources
Note that Capistrano also logs each deployment. We have a separate card on finding out user/branch/commit/timestamp for past deployments.
You can also tag deploys, so you can see deployed commits in the git log.
Posted by Arne Hartherz to makandra dev (2012-07-23 08:28)