0

I am a bit confused. As a part of a course we are supposed to setup a CI and CD solution using Jenkins, Docker and Chef, how the flow is going to be is not specified.

We have been setting up Jenkins, so that for every new git commit it creates a Jenkins slaves that spins up the specific containers needed for a test, then tears down them and reports the result.

So, have been looking around today for information regarding using Chef and Docker for continuous delivery/deployment. The use case that I see is the following, specify in Chef the machine deployment options, how many machines for each server, database and so on. When the Jenkins slave successfully builds and tests the application, it is time to deploy. Remove any old container and build new containers, handle configurations and other necessary management in Chef.

Have been looking around for information of similar use cases and there does not seem to be super much information about it. Have been tinkering with the chef-provision plugin with chef-provision-docker but the information regard to using for example the docker plugin is not super intuitive. Then I stumble across this article (https://coderanger.net/provisioning/) which basically does not recommend new projects to start using the chef-provision plugin.

Is there something I am missing, is this kind of use case not that popular or even just stupid? Are there any other plugins that I have missed or another setup with chef that is more suitable?

Cheers in advance!

mrmjauh
  • 71
  • 1
  • 9

2 Answers2

1

This kind of purely procedural stuff isn't really what Chef is for. You would want to use something integrated directly with Jenkins as a plugin probably. Or if you're talking about cookbook integration tests there are the kitchen-docker and kitchen-dokken drivers which can handle the container management for you.

EDIT: The above was not really what the question was about, new answer.

The tool you're looking for is usually called a resource scheduler or cluster orchestrator. Chef can do this either via chef-provisioning or the docker cookbook. Between those two I would use the latter. But that said, Chef is really not the best tool for this job. There is a whole generation of dedicated schedulers including Mesos+Marathon, Kubernetes, Nomad, and docker-compose+swarm. Of all of those, Nomad is probably the simplest but Kube has a huge community following and is growing quickly. I would consider using Chef for this an intermediary step at best.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • I want pretty much Chef to do the continuous delivery part. Creating new containers with the specific applications. I do know that chef-provision is kind of built for it (https://www.youtube.com/watch?v=LTTejR-5dIU), where it can be a chef-provision driver for the aws, google cloud or docker. I know there might exists some plugin for Jenkins, but Chef is kind of the requirement for the delivery part of the solution. – mrmjauh Feb 23 '17 at 00:53
  • Are you talking about for running tests or for actual production-y work? – coderanger Feb 23 '17 at 01:46
  • I guess production work, tests are run in the jenkins slave. – mrmjauh Feb 23 '17 at 02:04
  • Okay, I guess I got sidetracked by mentions of Jenkins. Let me make a new answer. – coderanger Feb 23 '17 at 02:10
  • Thanks for the answer, I will look into all of them for sure! – mrmjauh Feb 23 '17 at 09:41
0

I would suggest to use container orchestrations platforms like kubernetes, docker swarm or mesos. Personally i would recommend to use kubernetes since it is the leading platform out of the three listed.

chef is a good configuration management tool and using it for provisioning containers would work but it is not the best solution. You would come across issues like managing where the containers should be provisioned and monitoring container status and how to handle their failures. A platform like kubernetes would handle this for you.

this would be useful to get some insigths: https://www.youtube.com/watch?v=24X18e4GVbk

more to read: http://www.devoperandi.com/how-we-do-builds-in-kubernetes/