Idea: Deployment API hooks
bettse opened this issue · 8 comments
Some saas analytics platforms, like New Relic, have an API that can be called during deployment of new versions. I think it would be cool if centurion had support for something like this. Maybe just a method that could be overridden to make the API call at start or end of deployment?
Generally 👍 but I am concerned about the 💥 that is Capistrano's callback morass.
Seems like a resque style before_deploy, before_container_stop, before_container_start, after_deploy set would probably get you there.
I've started on this. We need this feature as well to roll nodes in and out of our load balancers.
@MarkBorcherding I think that the code might be simpler if you used existing rake API which lets you add before/after callbacks natively, rather than implementing a callback for every point in deployment lifecycle. I think that the only change necessary would be to split the rolling deploy into multiple tasks and passing state between them.
@kremso I was thinking it would be that easy too when I started, but if you look at the existing rake tasks rolling through the server happens inside one task. You could create a before_everything
and after_everything
, but you can't create one around an individual host.
That's why I'm suggesting to split the rolling_deploy task into multiple smaller tasks. Something like
task :rolling_deploy do
on_each_docker_host do |server|
set :target_server, server
invoke 'deploy:stop'
invoke 'deploy:start_new'
invoke 'deploy:health_check'
invoke 'deploy:cleanup'
end
end
I see. The problems i see is invoke
, assuming you're using the Rake
based Capistrano
, will only run a task once, and execute
doesn't run any prereqs...if I remember correctly.
While the end result, would look cleaner, that change is a bit more invasive than I can manage right now.