Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Most of the time there's nothing new in the git repo that is deployed to a local directory, but if there are any changes, the node.js application should be restarted to start working with the latest changes. It should not be touched if no new code was pulled.

How to achieve that with chef?

share|improve this question
    
Can't you use the git 'post-update' hook? –  Christophe Drevet Dec 18 '12 at 12:06
add comment

1 Answer

up vote 2 down vote accepted

The git sync action actually triggers notifications if the revision has changed. So add an execute block that runs only on notification, and you're done!

git "/home/code" do
    ...
    action :sync
    notifies :run, "execute[restart-node-app]", :immediately
end

execute "restart-node-app" do
    command "..."
    action :nothing
end
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.