Continuously deploying a trigger after deploying a new build

I'm new to chef and I've tried every possible google search word, but I can't seem to find any doc / blog on how to run continuous deployment with chef. Server chef and client chef are configured; but I can't figure out how to start the deployment. How to make chef-client run specific steps / cookbooks when a new build is available.

The use case is very simple: I have teamcity as a continuous integration tool, as soon as there is a merge on a branch, teamcity creates an archive and uploads it to the central build repo. Now I want to use chef to download this build from the central repo, stop the previous running build, and deploy the new build. But how to get the chef clients to download a new build and how to trigger a specific cookbook for that use handling. (I don't want to run the security cookbooks to run every time I run the deployment)

Any help would be appreciated.


source to share

1 answer

I would use deploy the collection of artifacts . You would need to write a wrapper around it to handle any special cases for your application (it's very flexible for this kind of customization) and update the attribute that denotes the version of your application. You have several options for updating an attribute.

Environment Attributes

If you start the chef-client service that runs the chef periodically, you can simply change your CI chef environment with a knife. Each new CI release will result in a call to the server chief to update the environment to use the new version of your application. The next run of chef-client will change this version and update your application.

Passing JSON

You can launch your CI client interface directly on the required nodes and pass the node file with the -j flag to jQuery. In this case, your CI will transmit the new version directly.

Other attribute locations

Following the same scheme as environment attributes, you can use a knife to update node or role attributes. They all merge together when chef-client is running, so either one will work.



All Articles