Kevin Brown
Kevin Brown

Reputation: 12650

Capistrano: save release

I frequently make very small releases to my production server, but often there are some milestones.

I haven't tried anything in particular, I usually just have to revert on my local machine manually and push a new update.

Is there a good way to save a particular release that I could revert to by saying something like "cap revert production -v '1.0'"?

Maybe there's some underlying git understanding I need?

Please advise!

If not, it'd sure be a nice feature...or maybe I just need to improve my development deployment knowledge!

Upvotes: 1

Views: 101

Answers (1)

Frederick Cheung
Frederick Cheung

Reputation: 84134

Create git tags for your releases

git tag v1.0
git push --tags

It is then trivial to redeploy any tag. You might also create branches: a common strategy after you deployed version 1 would be to have main development happen on master, and a 1.x branch where you can backport fixes to (and then create tags 1.0.1, 1.0.2 etc. from that b

With capistrano 3 you then just need to do

cap -S branch=v1.0 deploy

Although the setting is called branch it can be a branch, a tag, a sha etc.

With capistrano 2 it's basically the same. Stick

set :branch, ENV['BRANCH'] || 'master'

in deploy.rb and we then do

cap deploy BRANCH=v1.0

Upvotes: 1

Related Questions