Behaviour of healthchecks when using loadbalancer.healthcheck in docker swarm

Hi everyone, I have a question regarding the usage of loadbalancer.healthcheck with traefik.

I'm using traefik in docker-swarm and I'm using

- "traefik.http.routers.my-service.rule=Host(`my-service.mydomain`)"
- "traefik.http.services.my-service.loadbalancer.server.port=8080"
- "traefik.http.services.my-service.loadbalancer.healthcheck.path=/svc/health"
- "traefik.http.services.my-service.loadbalancer.healthcheck.port=9999"
- "traefik.http.services.my-service.loadbalancer.healthcheck.interval=2s"
- "traefik.http.services.my-service.loadbalancer.healthcheck.timeout=3s"

In the case above, when setting the healthcheck path to /svc/health ( my-service.mydomain:9999/svc/health) does traefik just check the http_status code when hitting the endpoint to decide if the service is healthy?

What if the output of /svc/health is more complex (checking if dependencies like queues or dbs are UP/DOWN). Is there a way to define a custom script to use with traefik for the healthchecks?

The main purpose of this question is to achieve zero-downtime deployments and since the interval of docker's healthcheck "interval" is not very convenient (I need different intervals for the initial startup vs the rest of the healthchecks) I'm trying to solve that issue in the traefik level.

Any ideas on that?

Regards,
nullpid

Traefik will consider your servers healthy as long as they return status codes between 2XX and 3XX to the health check requests (carried out every interval ).

For the swarm service multiple replicas and update-parallism can achieve 0 zero downtime upgrades.