I'm interested in switching from Capistrano to Chef, but am having a few issues putting all the pieces together.
I've followed http://wiki.opscode.com/display/chef/Quick+Start and am able to start EC2 instances with knife
. As far as code deployment, it looks as though I want to be doing what's in http://wiki.opscode.com/display/chef/Deploy+Resource, the only problem is, nowhere on that page does it mention in what directory/file the deploy /to/path
code block should go.
Another issue I'm having is understanding how to deploy code changes after the server has been set up. Perhaps I'm just used to my current workflow (git push && cap deploy
), but the best I can tell is that after I commit my changes I'm supposed to ssh into the server and run sudo chef-client
? something about that feels wrong. Is there no cap equivalent, i.e. chef deploy
?
Finally (and perhaps this is a bit more difficult), I'm looking to deploy multiple rails apps to a single server. It seems prudent to keep some sort of chef config file in the repo of each app describing the particulars of its deployment, but I'm uncertain how that would then interact with the chef-repo / hosted server. Would each app be a role? And from my understanding of the way things work, I'm also a little uneasy with the idea that 'chef-client' would be trying to deploy all applications when run. With git push && cap deploy
I'm certain of what I'm deploying. Whereas some of the other application repos might not be in a deployable state. Would there be a way to deploy just a single app in this set up?
So knife is actually capable of doing capistrano-esque tasks - specifically, running a command across multiple servers.
To deploy your app to all of your app servers, assuming you followed the opscode rails application cookbook path, you could just do the following:
knife ssh role:t<appserver-role> chef-client -xroot -P<pass>
That will run chef-client as root on all of your app servers. It uses chef search API to find all the nodes with that role and run that command on them.
It's pretty powerful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With