Comments (6)
In general, we've advocated the usage of the provided restart
Proc to act as a way to execute resources that need to react when a new artifact has been deployed. That being said, due to the architecture of the resource, a bunch of extra Chef contexts are created, so the notifies
syntax is probably all out of whack.
Chef 11 has support that they document here under the section labeled "Inline Compile Mode for LWRPs". I'm not sure if supporting this would fix this problem.
I'm still not entirely sure I'm convinced as to whether or not this is something worth fixing, there is so much customizability build into the resource, it's hard to think of a use-case where using the restart
Proc doesn't solve it.
from artifact-cookbook.
One issue I've come across is when you have a configuration file written out in one Proc, you aren't able to notify another service defined in another to restart.
This would be a case where a configuration file was updated during Configure but was not related to an actual deploy.
In my after_deploy Proc I already added the if-block from #68 (although I had to do a slight modification, the not_if example doesn't seem to work)
configure Proc.new {
template "#{shared_path}/my.conf" do
source 'template.conf.erb'
owner 'foo'
group 'foo'
mode '644'
end
}
after_deploy Proc.new {
if current_symlink_changing?
service 'nginx' do
action :restart
end
else
Chef::Log.debug 'Not restarting processes no deployment was done'
end
}
Ideally you would be able to just notify the service 'nginx' to restart in the configure Proc when a value changes. But I would settle for some sort of a temp value similar to "current_symlink_changing" that you could use to pass state between Procs. Although that could get messy real fast if you need to notify different services based on the file updated.
from artifact-cookbook.
Here's a use case for fixing this issue that the restart
proc can't solve:
I have multiple packages that I need to deploy, and if any of them are updated, I need to restart tomcat. I only want to restart tomcat once because there are things that happen during application startup that get very unhappy if they are interrupted, and could potentially put us into a state where we can't start at all. Therefore I have to use notifications so that all those restarts get coalesced. But if the deploy resource always notifies, now I'm restarting tomcat every time chef runs.
from artifact-cookbook.
Thanks, @gregsymons, I can see how that is an issue.
I'd like to come back and take a look at this at some point, though I haven't had the time recently. We are definitely open to pull requests though.
from artifact-cookbook.
I did find a workaround that works:
needs_restart = false
artifacts.each do |artifact|
artifact_deploy "package-#{artifact}" do
...
...
restart Proc.new {
needs_restart = true
}
end
end
ruby_block 'notify-tomcat-restart' do
block {}
notifies :restart, 'service[tomcat]'
only_if { needs_restart }
end
It's a little ugly, but it works. If I get some time I'll see if I can work on a pull request to fix the bug (perhaps after I do the work for #96 😄 )
from artifact-cookbook.
ping any updates here, just saw this https://gist.github.com/fujin/935677bb1303d7ad85db
from artifact-cookbook.
Related Issues (20)
- ChefSpec and unit-testing recipes with artifact-cookbook callbacks. HOT 4
- Dont unzip war/jars HOT 10
- wrong tar command HOT 17
- ability to select nexus_cli gem version HOT 1
- Cookbook does not follow 302 Responses
- use_symlinks option to deploy without symlinks HOT 2
- artifact_file try to verify the checksum when it's not provided in the recipe HOT 4
- Feature Request: add chef-vault support HOT 1
- file:// schema support
- Tag versions of cookbook HOT 1
- pass http headers to Chef::Resource::RemoteFile
- artifact_file with credentials
- Avoid the package extraction HOT 3
- Messy ChefSpec tests with artifacts (previos definition of ... was here) HOT 1
- Still maintained? HOT 5
- artifact_test does not appear to be a valid cookbook. Does it have metadata.rb ? HOT 2
- Latest versions of chef do not include activesupport HOT 1
- uninitialized constant Chef::Resource::ArtifactFile on Chef client 13 HOT 3
- NoMethodError: undefined method `split' for :mid:Symbol on Chef Server 13.7.16
- This cookbook doesn't support newer version of nexus, since Nexus 3 has different endpoint for downloaidng artifacts, seems this cookbook doesnt work for nexus version 3.x HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from artifact-cookbook.