Mina is our tool of choice when it comes to automating our deployment. It might not be the best tool out there, but it is enough to get us started. Single server or multi server, we love Mina.
In most of uses cases if something fail in production we just need to rollback to one or two version before to it. But recently we had a case in which we had to revert to version order than the previous 5 version (5 is default no of versions stored). The quick thing that we did at that point is copy of master called temp-master branch and changed master to the version that we wanted and had the new master deployed.
We didn’t like that solution much, so we decided to look for a cleaner solution. Looking at the source code of the git task inside mina, we found that mina had an option to deploy a particular git commit. The config was
set :commit, HASH (Thee cheers to the contributors to mina for having that).
Now that made our life easier for the future. We just added the following line to our deploy.rb
set :commit, ENV['COMMIT']
so now we can deploy a particular hash by passing that hash as an environment variable.
mina deploy COMMIT=thegitcommithash
note: If no hash is passed (eg:
mina deploy), it would just deploy the master.