{"action":"created","issue":{"url":"https://api.github.com/repos/joyent/containerpilot/issues/233","repository_url":"https://api.github.com/repos/joyent/containerpilot","labels_url":"https://api.github.com/repos/joyent/containerpilot/issues/233/labels{/name}","comments_url":"https://api.github.com/repos/joyent/containerpilot/issues/233/comments","events_url":"https://api.github.com/repos/joyent/containerpilot/issues/233/events","html_url":"https://github.com/joyent/containerpilot/issues/233","id":184066219,"number":233,"title":"health checks always hit timeout when returning non 0","user":{"login":"commarla","id":4509360,"avatar_url":"https://avatars.githubusercontent.com/u/4509360?v=3","gravatar_id":"","url":"https://api.github.com/users/commarla","html_url":"https://github.com/commarla","followers_url":"https://api.github.com/users/commarla/followers","following_url":"https://api.github.com/users/commarla/following{/other_user}","gists_url":"https://api.github.com/users/commarla/gists{/gist_id}","starred_url":"https://api.github.com/users/commarla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commarla/subscriptions","organizations_url":"https://api.github.com/users/commarla/orgs","repos_url":"https://api.github.com/users/commarla/repos","events_url":"https://api.github.com/users/commarla/events{/privacy}","received_events_url":"https://api.github.com/users/commarla/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-19T20:31:37Z","updated_at":"2016-10-20T08:51:28Z","closed_at":null,"body":"Hi,\r\n\r\nI am using this simple health script \r\n\r\n```\r\n#!/bin/bash\r\n\r\nstate=$(curl -s localhost:4000/v1.24/info|jq -r 'select(.SystemStatus[0][1]==\"primary\")|.SystemStatus[0][1]')\r\n\r\nif [ \"$state\" == \"primary\" ]; then\r\n        echo \"I was elected primary :fu:\"\r\n        exit 0\r\nelse\r\n        echo \"I am a simple replica :'(\"\r\n        exit 255\r\nfi\r\n```\r\n\r\nIt checks if the node is primary or replica in docker swarm cluster and only the primary is registered in consul.\r\n\r\nIt is working fine but I have this strange behavior when the script return 255 \r\n\r\n> 2016/10/19 22:22:00 I am a simple replica :'(\r\n> 2016/10/19 22:22:02 swarm-manager.health timeout after 2s: '[]'\r\n> 2016/10/19 22:22:02 killing command at pid: 1129\r\n> 2016/10/19 22:22:02 error killing command: os: process already finished\r\n> 2016/10/19 22:22:10 I am a simple replica :'(\r\n> 2016/10/19 22:22:12 swarm-manager.health timeout after 2s: '[]'\r\n> 2016/10/19 22:22:12 killing command at pid: 1135\r\n> 2016/10/19 22:22:12 error killing command: os: process already finished\r\n\r\nContainerpilot always hit the timeout.\r\nOn the other side if the return code is 0, I have no log \r\n\r\n> 2016/10/19 22:27:20 I was elected primary :fu:\r\n> 2016/10/19 22:27:30 I was elected primary :fu:\r\n> 2016/10/19 22:27:40 I was elected primary :fu:\r\n\r\nMy containerpilot.json\r\n```\r\n{\r\n  \"consul\": \"{{ .CONSUL_ADDRESS }}\",\r\n  \"logging\": {\r\n    \"level\": \"INFO\",\r\n    \"format\": \"default\",\r\n    \"output\": \"stdout\"\r\n  },\r\n  \"stopTimeout\": 5,\r\n  \"services\": [\r\n    {\r\n      \"name\": \"swarm-manager\",\r\n      \"port\": 4000,\r\n      \"health\": [\r\n        \"/usr/local/bin/health.sh\"\r\n      ],\r\n      \"interfaces\": [\r\n        \"inet\"\r\n      ],\r\n      \"poll\": 10,\r\n      \"ttl\": 30,\r\n      \"timeout\": \"2s\",\r\n      \"tags\": [\"docker\", \"swarm\", \"swarm-manager\"]\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nContainerpilot v2.4.3\r\n\r\n> root@preprod-swarm-manager:/# /usr/local/bin/containerpilot -version\r\n> Version: '2.4.3'\r\n> GitHash: '8b825e2'\r\n\r\nRegards,\r\n\r\nLaurent"},"comment":{"url":"https://api.github.com/repos/joyent/containerpilot/issues/comments/255047313","html_url":"https://github.com/joyent/containerpilot/issues/233#issuecomment-255047313","issue_url":"https://api.github.com/repos/joyent/containerpilot/issues/233","id":255047313,"user":{"login":"commarla","id":4509360,"avatar_url":"https://avatars.githubusercontent.com/u/4509360?v=3","gravatar_id":"","url":"https://api.github.com/users/commarla","html_url":"https://github.com/commarla","followers_url":"https://api.github.com/users/commarla/followers","following_url":"https://api.github.com/users/commarla/following{/other_user}","gists_url":"https://api.github.com/users/commarla/gists{/gist_id}","starred_url":"https://api.github.com/users/commarla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commarla/subscriptions","organizations_url":"https://api.github.com/users/commarla/orgs","repos_url":"https://api.github.com/users/commarla/repos","events_url":"https://api.github.com/users/commarla/events{/privacy}","received_events_url":"https://api.github.com/users/commarla/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T08:51:28Z","updated_at":"2016-10-20T08:51:28Z","body":"Thanks for your answer.\r\n\r\nI am using this to have only one IP returned on DNS query (swarm-manager.service.consul). \r\n\r\nAnd I was not aware than I can request the slave as well so I don't need this at all.\r\n\r\nAnyway I am interested by the enableTagOverride option, is there a way to enable it with CP ?\r\nIf I am able to add tag to consul this option is better as I can use <tag>.swarm-manager.service.consul.\r\n"}}
{"actor":{"display_login":"commarla"}}