I have a https nginx server run as docker swarm service. After updating the certificates, how could I ask nginx to reload them?
docker service update --force
seems to restart the service so clients would be interrupted?
And there is no docker service run
that I can run nginx -s reload
.
What should I do to reload nginx without restarting it?
If you want zero downtime then here is one apparoach:
Scale nginx service to 2 then update nginx service. While updating the service, it will do one by one by default. So that user won't be seeing any downtime.
You can control this in docker-compose.yaml file.
services:
nginx:
image: REPO:TAG
deploy:
replicas: 2
update_config:
parallelism: 1
delay: 10s
restart_policy:
condition: on-failure
'parallelism: 1' will update the container one by one.