开发者

With Capistrano, how to rollback to a specific release?

开发者 https://www.devze.com 2023-01-29 11:42 出处:网络
With Capistrano, how to rollback to a specific release? My server\'s folder has a /release folder, ho开发者_开发问答w can I rollback to a specific one?

With Capistrano, how to rollback to a specific release?

My server's folder has a /release folder, ho开发者_开发问答w can I rollback to a specific one?

Is it possible for me to get a list of releases on my computer locally?

I'm using GIT and this didn't work:

cap deploy -s revision:HASH


Update The answer was written in the times of capistrano version 2. With the current capistrano version 3 you can achieve the same by using

cap production deploy:rollback ROLLBACK_RELEASE=2010123

Please refer to the Capistrano documentation for further details.

Thanks to @codenoob for pointing this out!


Old version

The following should work:

cap deploy:rollback -s previous_release=/path/to/release/on/server


Example:

Lets say you have deployed your app to /srv/some_app and you have the following releases/directory structure:

|- srv
   |- some_app
      |- shared
      |- current -> /srv/some_app/releases/2012123
      |- releases
         |- 2010123
         |- 2011123
         |- 2012123

If you now want to go back from the current (2012123) release to the 2010123 one, you would use

cap deploy:rollback -s previous_release=/srv/some_app/releases/2010123


Another option is

$ cap deploy:rollback ROLLBACK_RELEASE=20160614133327

from http://capistranorb.com/documentation/getting-started/rollbacks/#


Capistrano names the release directories by date/time.

From the capistrano shell, you can connect to all the machines you are deploying to, and examine them from there:

$ cap shell
# Show them - it might be a long list
cap> ls  /mnt/html/deployed/releases/
 ** [out :: hostname.example.com] 20110521130031
# how many releases on each machine?
cap> ls  /mnt/html/deployed/releases/ |wc -l
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号