Nate
Nate

Reputation: 1750

What is the best practice for Docker CD/CI workflow?

I am pretty new to docker worlflow, and I am wondering what is the best practice to do for docker CD/CI workflow...most of the articles out right now seems to not really talk about the "deployment" part of docker, only the registration.

What I want to do:

  1. Make some code changes
  2. Push to Git
  3. Jenkins Unit Test/EE test
  4. Jenkins builds docker image
  5. Store docker image in registry
  6. Run docker image on a server.

In order to achieve Steps 1-5, I have the below stack.

User pushes to gitlab -> Gitlab webhook notifies jenkins -> jenkins builds the project -> Stores the image in the gitlab docker registry.

I am using Rancher for docker image deployment...I really like the distributedness of Rancher. i.e I can specify a docker image to run, and rancher takes care of which server to deploy my container.

Ideally I would like step #6 to be "distributed" (i.e i dont want to ssh into a server and run docker run {imagename}) and have some service be the authority for deployment

is there anything like that currently that will allow me to achieve this?

Upvotes: 0

Views: 839

Answers (2)

Yu You
Yu You

Reputation: 388

As to the last step, given the Rancher as an example (many others provide similar REST APIs as well), you can let Jenkins to invoke the Rancher API to do a service upgrade, provided you need to define your own stack into a Rancher custom service catalog.

I am also looking for lightweight solutions and happy to know alternatives.

Upvotes: 1

Nicolas Barbé
Nicolas Barbé

Reputation: 624

There are so many different approaches to achieve this.

One of the easiest one is to use a configuration management tool to orchestrate the deployment of the new images. Ansible is a good choice, but others like puppet or chef are fine too. Those tools will give you full control on what has to be deployed where. You can easily roll an update without any interruption of traffic as described in this example.

Another approach consists in relying on the cluster itself to automatically deploy services. This approach is usually referred as choreography. Tools like kubernetes or the recent docker swarm with some magics are good choices.

As a side note, the later approach tends to a microservice architecture and seems to be more appealing but is actually more complex to implement. It makes some assumptions on the way the services executed by the cluster are built. The first approach however will fit any kind of software.

Upvotes: 0

Related Questions