-1

I'm using ansible to set up my docker-swarm.

In my docker swarm I run: Web server, database, and a cache.
My question is: how can I update my database (e.g docker image, etc.) without making the service unavailable?

Should I mirror the existing swarm, and run two identical swarms?
How should I then make sure the update of these is automatic and flawless?

Heihade1
  • 79
  • 3
  • 8
  • 1
    The scenario you're looking for is [Continuous Delivery and Rolling Upgrades](https://docs.ansible.com/ansible/latest/scenario_guides/guide_rolling_upgrade.html#continuous-delivery-and-rolling-upgrades). – Vladimir Botka Apr 01 '19 at 08:53
  • I will still have the same problem?.. Let's forget that I'm using Ansible. The main issue is: **How can I update a database container(s) and it's image in docker swarm without making the service unavailable?** – Heihade1 Apr 01 '19 at 09:38
  • @Heihade1 You can use docker-swarm rolling update process wherein you don't need to stop the db services for all the containers but for few initially – error404 Apr 01 '19 at 09:43
  • The way I explained it was pretty bad... I'm running only one service, let's call it test. Which contains the components described. – Heihade1 Apr 01 '19 at 10:03
  • And integrating this is CI/CD pipeline won't be that different I guess? Push to DockerHub which sends webhook to ansible which updates the swarm? – Heihade1 Apr 01 '19 at 10:04

1 Answers1

1

Docker swarm only permits update services with zero-downtime using parallelism when scale > 1.

You can use parallelism with database, and downtime should me minimum possible, but some seconds are expected.

Check docker swarm rolling update and ansible docker swarm service documentation

Definitely, Blue-Green deployment is not an option for database

Javi
  • 506
  • 3
  • 15