Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Add callbacks to deployment events, refresh#176

Closed
intjonathan wants to merge 20 commits into
masterfrom
MarkBorcherding-before-after-callbacks
Closed

Add callbacks to deployment events, refresh#176
intjonathan wants to merge 20 commits into
masterfrom
MarkBorcherding-before-after-callbacks

Conversation

@intjonathan

Copy link
Copy Markdown
Contributor

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

@relistan relistan left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

CLAassistant commented Mar 3, 2020

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@idleyoungman

Copy link
Copy Markdown
Member

We're archiving the project, so I'm closing all open PRs:
#208

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants