如何在失败时回滚 capistrano 任务?
在我的 Capistrano deploy.rb 中,我有几个守护进程,例如 Delayed_jobs 和 fetcher,根据它们在部署过程中的位置启动和停止。
如果部署失败,此方法会产生问题,因为守护进程无法得到正确管理(即生成两个进程而不是一个,或者进程被关闭而没有重新启动,直到下一次部署为止)。
有没有办法像回滚代码一样防止这种情况发生?通常如何通过 Capistrano 完成守护进程的部署?
In my Capistrano deploy.rb, I have a couple of daemons like delayed_jobs and fetcher, starting and stopping depending on where they are in the deployment process.
This method would create problems if a deployment fails, because the daemons wouldn't be managed properly (ie. two processes spawned instead of one, or processes were shutdown without restarting itself until the next deployment).
Is there anyway to prevent this from happening like a rollback code? How is deployment of daemons normally done over capistrano?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Capistrano 允许您定义 on_rollback 每个任务的挂钩。您还可以将任务分组到事务< /a> 如果其中一个任务失败,则回滚所有任务。有关更多详细信息,请参阅 Capistrano wiki。
Capistrano allows you to define an on_rollback hook for each task. You can also group tasks in a Transaction to rollback all tasks if one of them fails. See the Capistrano wiki for more details.