Skip to main content

Application upgrades with zero downtime

In certain cases it is desirable to upgrade applications and have zero, or at least minimize, application downtime.

To achieve zero downtime we require multiple replicas and strongly recommend to have multiple hosts.

Rolling upgrades

If your applications has multiple replicas, you can use simple rolling upgrades, where one service instance at a time will be upgraded.

demo app spec
name: my-application
version: "8"
services:
- name: svc
mode: replicated
replicas: 3
share-pid-namespace: false
containers:
- name: alpine
container-log-size: 100 MB
container-log-archive: false
image: registry-1.docker.io/alpine
cmd:
- sh
- -c
- sleep infinite
on-mounted-file-change:
restart: true
on-mutable-variable-change: restart-service-instance
upgrade-from:
- version-regexp: .*
method: per-service
services:
- name: svc
instances-in-parallel: 1
healthy-time: 1m

The upgrade-from tells the system how many services can be upgraded in parallel and the healthy time (of the new containers) before upgrading the next one.