-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add callbacks to deployment events, refresh #176
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice @intjonathan, this looks ready to 🚢
We need to tell our load balancers about these two events. We can provide callbacks that allow us to do so.
Since prepend is a Ruby 2.0 thing, there is probably a better way to get this functionality without sprinkling all the callbacks into deploy.
This should let the callbacks have a chance to execute first and call up to the deploy module at the proper time.
My initial approach used some Ruby 2.0 features. I thought it would be good to ensure backwards compatibility to older Rubies.
It's containers, not images, that start and stop. Also, between stopping and starting containers it can be useful to muck with the environment on a per-host basis, so add a before_starting_container hook.
48f53bf
to
4789be5
Compare
super server, service, timeout | ||
end | ||
|
||
def before_starting_container(server, service) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not certain this actually gets called.
end | ||
|
||
def callbacks | ||
fetch 'callbacks', Hash.new { [] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this fails with:
NoMethodError: undefined method `fetch' for Centurion::DeployCallbacks:Module
/Users/intjonathan/sites/centurion/lib/centurion/deploy_callbacks.rb:38:in `callbacks'
/Users/intjonathan/sites/centurion/lib/centurion/deploy_callbacks.rb:32:in `emit'
/Users/intjonathan/sites/centurion/lib/centurion/deploy_callbacks.rb:11:in `before_starting_container'
/Users/intjonathan/sites/centurion/lib/tasks/deploy.rake:143:in `block (3 levels) in <top (required)>'
/Users/intjonathan/sites/centurion/lib/centurion/deploy_dsl.rb:8:in `call'
/Users/intjonathan/sites/centurion/lib/centurion/deploy_dsl.rb:8:in `block (2 levels) in on_each_docker_host'
I'm not sure how it was supposed to work given the history - @relistan any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the idea had been to keep fetch
and other env methods out of that code entirely and to have the required data passed in instead. I'd need to spend some more time looking at this code to see what the right thing is to do there.
This resolves merge conflicts in #124 in preparation for merge in 1.9.