Updating a staging server (from a CI server) in a Vagrant box with Chef

Posted by Tomas Brambora on Server Fault See other posts from Server Fault or by Tomas Brambora
Published on 2012-08-22T15:40:59Z Indexed on 2012/09/23 3:39 UTC
Read the original article Hit count: 509

Filed under:
|

I'm using Vagrant + Chef (chef_client provisioner) to create & provision a staging environment for my server. And I have a Jenkins job set up that is run every time I push to my 'develop' branch.

In the Jenkins job, I would like to update & rebuild the source code of the server in the staging box and restart it.

I have already written the cookbooks that install the dependencies, configure the db etc. But I'm not sure how to run only the update & rebuild & restart stuff from the cookbooks. I understand I could always tear down the whole box and rebuild it, but provisioning the box is a lengthy process so I would like to do that as little as possible.

I split my server cookbook into 3 recipes: dependencies, db_setup and server. What I want to run in the my Jenkins job is the "server" recipe only. But I dont' understand how can I do that... If I specify the run_list on my Chef server, then I lose the ability to provision the whole box from scratch.

Basically, I would like to be able to tell Vagrant from the command line what recipes Chef should run. Is that possible somehow?

Cheers!

© Server Fault or respective owner

Related posts about vagrant

Related posts about chef-server