{"action":"created","issue":{"url":"https://api.github.com/repos/QubitProducts/bamboo/issues/156","labels_url":"https://api.github.com/repos/QubitProducts/bamboo/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/QubitProducts/bamboo/issues/156/comments","events_url":"https://api.github.com/repos/QubitProducts/bamboo/issues/156/events","html_url":"https://github.com/QubitProducts/bamboo/pull/156","id":102932652,"number":156,"title":"Support graceful shutdown of haproxy","user":{"login":"drewrobb","id":140935,"avatar_url":"https://avatars.githubusercontent.com/u/140935?v=3","gravatar_id":"","url":"https://api.github.com/users/drewrobb","html_url":"https://github.com/drewrobb","followers_url":"https://api.github.com/users/drewrobb/followers","following_url":"https://api.github.com/users/drewrobb/following{/other_user}","gists_url":"https://api.github.com/users/drewrobb/gists{/gist_id}","starred_url":"https://api.github.com/users/drewrobb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewrobb/subscriptions","organizations_url":"https://api.github.com/users/drewrobb/orgs","repos_url":"https://api.github.com/users/drewrobb/repos","events_url":"https://api.github.com/users/drewrobb/events{/privacy}","received_events_url":"https://api.github.com/users/drewrobb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-25T02:05:47Z","updated_at":"2015-08-31T17:29:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/QubitProducts/bamboo/pulls/156","html_url":"https://github.com/QubitProducts/bamboo/pull/156","diff_url":"https://github.com/QubitProducts/bamboo/pull/156.diff","patch_url":"https://github.com/QubitProducts/bamboo/pull/156.patch"},"body":"The purpose of this feature is to allow bamboo to shutdown haproxy gracefully in response to a SIGTERM. In my particular use case we have bamboo running in docker behind an aws ELB. The goal is to generate a health check that can remove bamboo from the ELB before bamboo actually exits, so that we can redeploy bamboo without any requests being lost. My particular way of shutting down bamboo is to run `docker stop` on the container. By default this gives a SIGTERM followed by a SIGKILL 10 seconds later, so a value of GraceSeconds < 10s is reasonable, but the value should be large enought for an upstream balancer to detect that bamboo is unhealthy.  Some changes to the dockerization were necessary so that bamboo would actually get the signal-- child processes of bash or sh need to be run with 'exec'.\r\n\r\nI've been testing this by running the container, then running something like:\r\n\r\n    while true; do curl --connect-timeout 2 --max-time 2 localhost:2000/health  -sL -w \"%{http_code} %{time_total}  \" -o /dev/null; echo $(($(date +%s%N)/1000000)); sleep 0.2; done\r\n\r\nAnd then running `docker stop $(docker ps | grep bamboo | awk '{print $1}')` the http status should change from 200 to 503 for 5 seconds.\r\n\r\nI'm not sure if people would want this on by default, but GraceSeconds is configurable and setting to 0 allows immediate exit. Also, port 2000  is used for health checking. This could be problematic if not running in docker, so maybe my changes to the haproxy_template should be commented out by default.\r\n"},"comment":{"url":"https://api.github.com/repos/QubitProducts/bamboo/issues/comments/136436400","html_url":"https://github.com/QubitProducts/bamboo/pull/156#issuecomment-136436400","issue_url":"https://api.github.com/repos/QubitProducts/bamboo/issues/156","id":136436400,"user":{"login":"timoreimann","id":694826,"avatar_url":"https://avatars.githubusercontent.com/u/694826?v=3","gravatar_id":"","url":"https://api.github.com/users/timoreimann","html_url":"https://github.com/timoreimann","followers_url":"https://api.github.com/users/timoreimann/followers","following_url":"https://api.github.com/users/timoreimann/following{/other_user}","gists_url":"https://api.github.com/users/timoreimann/gists{/gist_id}","starred_url":"https://api.github.com/users/timoreimann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timoreimann/subscriptions","organizations_url":"https://api.github.com/users/timoreimann/orgs","repos_url":"https://api.github.com/users/timoreimann/repos","events_url":"https://api.github.com/users/timoreimann/events{/privacy}","received_events_url":"https://api.github.com/users/timoreimann/received_events","type":"User","site_admin":false},"created_at":"2015-08-31T17:29:56Z","updated_at":"2015-08-31T17:29:56Z","body":"@drewrob:, IIUC, your intention is to facilitate a way to disable Bamboo smoothly for maintenance reasons without any downtime involved. Just wondering whether you could tell ELB to take whatever Bamboo/HAProxy combo you want to run maintenance on out of balancing, thus avoiding any Bamboo-stopping-HAProxy requirements.\n\nI am no way familiar with ELB so let me know if there's a blocker on the AWS end I am missing."}}