Read more

Capistrano: Finding out who deployed which revision of your application and when

Arne Hartherz
July 29, 2019Software engineer at makandra GmbH

Capistrano automatically logs each (successful) deployment into a file on your application servers.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

It is located at the root of your server's project folder, i.e. the parent of releases and current, like so:

/var/www/your-project$ ls
current
log
releases
repo
revisions.log  <---  here
shared

Each line in that file contains the deployed branch, commit, release ID, and username (was read from the deploying user's machine):

$ tail -n3 revisions.log 
Branch master (at da45511bea63002ac2ff002d1692e09d0dd7cb88) deployed as release 20190716082309 by alice
Branch master (at dc9c812d847f1322913149a4a5648d933b6aa73a) deployed as release 20190722141405 by bob
Branch master (at 4bb4e2c23a3ed3c7e9c972a8416e109391461af0) deployed as release 20190722144129 by bob

Note that release IDs by default are a formatted deployment timestamp (yyyymmddHHMMSS), so as a bonus you will usually know when that release was deployed.
If your release IDs are different, you can try reading the directory's modification timestamp:

$ stat -c %y releases/0023
2019-07-22 16:43:11.877664481 +0200

FYI: If you are only interested in the currently deployed revision, we also have a card on this. It also contains a Capistrano task that can be called from developer machines.

Posted by Arne Hartherz to makandra dev (2019-07-29 08:18)