Search code examples
centos7mesosmarathon

Deploy docker container if health check fails


I'm working with Marathon/Mesosphere and have enabled health checks for my app which is working fine, Marathon shows health check as Green for my app. Now that health check works, I want to use this feature further to deploy new container of my app if health check fails (say for every 10 consecutive failed health checks deploy a new container).

How can I do that?


Solution

  • I don't think you even need marathon-autoscale to do this. This should work outside the box - you may configure a healthcheck that will kill a running Marathon task after 10 consecutive healthcheck failures and start a new one.

    Something simple would look like that:

    "healthChecks": [
      {
        "protocol": "HTTP",
        "path": "/health",
        "gracePeriodSeconds": 120,
        "intervalSeconds": 60,
        "portIndex": 0,
        "timeoutSeconds": 30,
        "maxConsecutiveFailures": 10
      }
    ]