Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Deployment API hooks #110

Open
bettse opened this issue Apr 27, 2015 · 8 comments
Open

Idea: Deployment API hooks #110

bettse opened this issue Apr 27, 2015 · 8 comments

Comments

@bettse
Copy link

bettse commented Apr 27, 2015

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?

@relistan
Copy link
Collaborator

Generally 👍 but I am concerned about the 💥 that is Capistrano's callback morass.

@intjonathan
Copy link
Contributor

Seems like a resque style before_deploy, before_container_stop, before_container_start, after_deploy set would probably get you there.

@MarkBorcherding
Copy link
Contributor

I've started on this. We need this feature as well to roll nodes in and out of our load balancers.

@kremso
Copy link
Contributor

kremso commented Jun 8, 2015

@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.

@MarkBorcherding
Copy link
Contributor

@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.

@kremso
Copy link
Contributor

kremso commented Jun 9, 2015

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

@MarkBorcherding
Copy link
Contributor

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.

@kremso
Copy link
Contributor

kremso commented Jun 9, 2015

You're right, but you could change the invoke method to do something like below.

Rake::Task[task].invoke(*args)
Rake::Task[task].reenable
Rake::Task[task].all_prerequisite_tasks.each &:reenable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants