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

Posted . Visible to the public.

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

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.

Arne Hartherz
Last edit
Arne Hartherz
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2019-07-29 06:18)