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

Add callbacks to deployment events, refresh #176

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

intjonathan
Copy link
Contributor

This resolves merge conflicts in #124 in preparation for merge in 1.9.

Copy link
Collaborator

@relistan relistan left a 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 🚢

relistan
relistan previously approved these changes Jan 25, 2017
MarkBorcherding and others added 18 commits March 22, 2017 09:35
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.
@intjonathan intjonathan force-pushed the MarkBorcherding-before-after-callbacks branch from 48f53bf to 4789be5 Compare March 22, 2017 16:37
super server, service, timeout
end

def before_starting_container(server, service)
Copy link
Contributor Author

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 { [] }
Copy link
Contributor Author

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?

Copy link
Collaborator

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.

@CLAassistant
Copy link

CLAassistant commented Mar 3, 2020

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

4 participants