{"action":"created","comment":{"url":"https://api.github.com/repos/brooklyncentral/clocker/pulls/comments/85306954","pull_request_review_id":6029173,"id":85306954,"diff_hunk":"@@ -172,3 +172,49 @@ brooklyn.catalog:\n           launch.command: |\n             haproxy -f haproxy.conf -f servers.conf -c &&\n               haproxy -D -f haproxy.conf -f servers.conf -sf $(cat ${PID_FILE})\n+\n+        brooklyn.initializers:\n+        - type: org.apache.brooklyn.core.effector.ssh.SshCommandEffector\n+          brooklyn.config:\n+            name: configureHaproxy\n+            description: |\n+              Generate HAProxy configuration from endpoint list\n+            shell.env:\n+              HAPROXY_PROTOCOL: $brooklyn:config(\"haproxy.protocol\")\n+              HAPROXY_ENDPOINTS: $brooklyn:attributeWhenReady(\"haproxy.endpoints\")\n+            command: |\n+              (\n+              flock -o 9\n+              cat > ${RUN_DIR}/servers.conf <<-EOF\n+              backend servers\n+              EOF\n+              if [ \"${HAPROXY_PROTOCOL}\" == \"http\" ]; then\n+              cat >> ${RUN_DIR}/servers.conf <<-EOF\n+                mode http\n+                option httpchk\n+              EOF\n+              fi\n+              cat >> ${RUN_DIR}/servers.conf <<-EOF\n+                balance roundrobin\n+              EOF\n+              for endpoint in $(echo ${HAPROXY_ENDPOINTS} | tr ',' ' ') ; do\n+                echo \"  server manager$((++n)) ${endpoint} maxconn 32 ssl \\","path":"common/src/main/resources/common/common.bom","position":39,"original_position":39,"commit_id":"ffa1070f08d3302aea6a1385723b65746e53f890","original_commit_id":"ffa1070f08d3302aea6a1385723b65746e53f890","user":{"login":"googlielmo","id":1446383,"avatar_url":"https://avatars.githubusercontent.com/u/1446383?v=3","gravatar_id":"","url":"https://api.github.com/users/googlielmo","html_url":"https://github.com/googlielmo","followers_url":"https://api.github.com/users/googlielmo/followers","following_url":"https://api.github.com/users/googlielmo/following{/other_user}","gists_url":"https://api.github.com/users/googlielmo/gists{/gist_id}","starred_url":"https://api.github.com/users/googlielmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlielmo/subscriptions","organizations_url":"https://api.github.com/users/googlielmo/orgs","repos_url":"https://api.github.com/users/googlielmo/repos","events_url":"https://api.github.com/users/googlielmo/events{/privacy}","received_events_url":"https://api.github.com/users/googlielmo/received_events","type":"User","site_admin":false},"body":"hmm right @grkvlt, I missed that in the refactoring.\r\nHow would you tackle this one? a config key to specify options such as `check` or `maxconn 32 ssl`? Or is it deducible from `HAPROXY_PROTOCOL`?\r\nI still think it's worth generalising this entity, but only if feasible.","created_at":"2016-10-27T10:14:01Z","updated_at":"2016-10-27T10:14:01Z","html_url":"https://github.com/brooklyncentral/clocker/pull/365#discussion_r85306954","pull_request_url":"https://api.github.com/repos/brooklyncentral/clocker/pulls/365","_links":{"self":{"href":"https://api.github.com/repos/brooklyncentral/clocker/pulls/comments/85306954"},"html":{"href":"https://github.com/brooklyncentral/clocker/pull/365#discussion_r85306954"},"pull_request":{"href":"https://api.github.com/repos/brooklyncentral/clocker/pulls/365"}}},"pull_request":{"url":"https://api.github.com/repos/brooklyncentral/clocker/pulls/365","id":90208972,"html_url":"https://github.com/brooklyncentral/clocker/pull/365","diff_url":"https://github.com/brooklyncentral/clocker/pull/365.diff","patch_url":"https://github.com/brooklyncentral/clocker/pull/365.patch","issue_url":"https://api.github.com/repos/brooklyncentral/clocker/issues/365","number":365,"state":"open","locked":false,"title":"Fix race condition in configureSwarm effector","user":{"login":"googlielmo","id":1446383,"avatar_url":"https://avatars.githubusercontent.com/u/1446383?v=3","gravatar_id":"","url":"https://api.github.com/users/googlielmo","html_url":"https://github.com/googlielmo","followers_url":"https://api.github.com/users/googlielmo/followers","following_url":"https://api.github.com/users/googlielmo/following{/other_user}","gists_url":"https://api.github.com/users/googlielmo/gists{/gist_id}","starred_url":"https://api.github.com/users/googlielmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlielmo/subscriptions","organizations_url":"https://api.github.com/users/googlielmo/orgs","repos_url":"https://api.github.com/users/googlielmo/repos","events_url":"https://api.github.com/users/googlielmo/events{/privacy}","received_events_url":"https://api.github.com/users/googlielmo/received_events","type":"User","site_admin":false},"body":" - guard critical section with flock\r\n\r\nFixes https://cloudsoft.jira.com/browse/CCS-106\r\n\r\nThe `swarm-manager-load-balancer` sometimes returns an empty response.\r\nThis is due to the fact that several instances of `haproxy` are running, so the request may be routed to an instance with an invalid config.\r\n\r\nThere is a race condition in the `configureSwarm` effector that is called to re-configure `haproxy` every time there is a change in the swarm node list.\r\n\r\nIf the effector is invoked simultaneously, e.g. when starting up two nodes, it may result in duplicate instances, as new `haproxy` instances are started with an option to kill and replace the old process, but as they don't know about each other, they both live on.\r\n\r\n(A different problem may happen if two effector invocations enter the critical section in the wrong order, but this is not resolvable within the effector itself.)","created_at":"2016-10-20T14:13:14Z","updated_at":"2016-10-27T10:14:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0dc8d08dcb9b90d3199c2ae19329fa1cad40953a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/brooklyncentral/clocker/pulls/365/commits","review_comments_url":"https://api.github.com/repos/brooklyncentral/clocker/pulls/365/comments","review_comment_url":"https://api.github.com/repos/brooklyncentral/clocker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/brooklyncentral/clocker/issues/365/comments","statuses_url":"https://api.github.com/repos/brooklyncentral/clocker/statuses/ffa1070f08d3302aea6a1385723b65746e53f890","head":{"label":"googlielmo:fix/configure-swarm-race-condition","ref":"fix/configure-swarm-race-condition","sha":"ffa1070f08d3302aea6a1385723b65746e53f890","user":{"login":"googlielmo","id":1446383,"avatar_url":"https://avatars.githubusercontent.com/u/1446383?v=3","gravatar_id":"","url":"https://api.github.com/users/googlielmo","html_url":"https://github.com/googlielmo","followers_url":"https://api.github.com/users/googlielmo/followers","following_url":"https://api.github.com/users/googlielmo/following{/other_user}","gists_url":"https://api.github.com/users/googlielmo/gists{/gist_id}","starred_url":"https://api.github.com/users/googlielmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlielmo/subscriptions","organizations_url":"https://api.github.com/users/googlielmo/orgs","repos_url":"https://api.github.com/users/googlielmo/repos","events_url":"https://api.github.com/users/googlielmo/events{/privacy}","received_events_url":"https://api.github.com/users/googlielmo/received_events","type":"User","site_admin":false},"repo":{"id":43440950,"name":"clocker","full_name":"googlielmo/clocker","owner":{"login":"googlielmo","id":1446383,"avatar_url":"https://avatars.githubusercontent.com/u/1446383?v=3","gravatar_id":"","url":"https://api.github.com/users/googlielmo","html_url":"https://github.com/googlielmo","followers_url":"https://api.github.com/users/googlielmo/followers","following_url":"https://api.github.com/users/googlielmo/following{/other_user}","gists_url":"https://api.github.com/users/googlielmo/gists{/gist_id}","starred_url":"https://api.github.com/users/googlielmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlielmo/subscriptions","organizations_url":"https://api.github.com/users/googlielmo/orgs","repos_url":"https://api.github.com/users/googlielmo/repos","events_url":"https://api.github.com/users/googlielmo/events{/privacy}","received_events_url":"https://api.github.com/users/googlielmo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/googlielmo/clocker","description":"Brooklyn managed Docker containers","fork":true,"url":"https://api.github.com/repos/googlielmo/clocker","forks_url":"https://api.github.com/repos/googlielmo/clocker/forks","keys_url":"https://api.github.com/repos/googlielmo/clocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlielmo/clocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlielmo/clocker/teams","hooks_url":"https://api.github.com/repos/googlielmo/clocker/hooks","issue_events_url":"https://api.github.com/repos/googlielmo/clocker/issues/events{/number}","events_url":"https://api.github.com/repos/googlielmo/clocker/events","assignees_url":"https://api.github.com/repos/googlielmo/clocker/assignees{/user}","branches_url":"https://api.github.com/repos/googlielmo/clocker/branches{/branch}","tags_url":"https://api.github.com/repos/googlielmo/clocker/tags","blobs_url":"https://api.github.com/repos/googlielmo/clocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlielmo/clocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlielmo/clocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlielmo/clocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlielmo/clocker/statuses/{sha}","languages_url":"https://api.github.com/repos/googlielmo/clocker/languages","stargazers_url":"https://api.github.com/repos/googlielmo/clocker/stargazers","contributors_url":"https://api.github.com/repos/googlielmo/clocker/contributors","subscribers_url":"https://api.github.com/repos/googlielmo/clocker/subscribers","subscription_url":"https://api.github.com/repos/googlielmo/clocker/subscription","commits_url":"https://api.github.com/repos/googlielmo/clocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlielmo/clocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlielmo/clocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlielmo/clocker/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlielmo/clocker/contents/{+path}","compare_url":"https://api.github.com/repos/googlielmo/clocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlielmo/clocker/merges","archive_url":"https://api.github.com/repos/googlielmo/clocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlielmo/clocker/downloads","issues_url":"https://api.github.com/repos/googlielmo/clocker/issues{/number}","pulls_url":"https://api.github.com/repos/googlielmo/clocker/pulls{/number}","milestones_url":"https://api.github.com/repos/googlielmo/clocker/milestones{/number}","notifications_url":"https://api.github.com/repos/googlielmo/clocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlielmo/clocker/labels{/name}","releases_url":"https://api.github.com/repos/googlielmo/clocker/releases{/id}","deployments_url":"https://api.github.com/repos/googlielmo/clocker/deployments","created_at":"2015-09-30T15:26:06Z","updated_at":"2016-10-17T10:23:08Z","pushed_at":"2016-10-27T08:59:48Z","git_url":"git://github.com/googlielmo/clocker.git","ssh_url":"git@github.com:googlielmo/clocker.git","clone_url":"https://github.com/googlielmo/clocker.git","svn_url":"https://github.com/googlielmo/clocker","homepage":null,"size":6535,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"brooklyncentral:master","ref":"master","sha":"3451df4051ad1a3b5a079ffbe92d826e9e3ff94b","user":{"login":"brooklyncentral","id":1587357,"avatar_url":"https://avatars.githubusercontent.com/u/1587357?v=3","gravatar_id":"","url":"https://api.github.com/users/brooklyncentral","html_url":"https://github.com/brooklyncentral","followers_url":"https://api.github.com/users/brooklyncentral/followers","following_url":"https://api.github.com/users/brooklyncentral/following{/other_user}","gists_url":"https://api.github.com/users/brooklyncentral/gists{/gist_id}","starred_url":"https://api.github.com/users/brooklyncentral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brooklyncentral/subscriptions","organizations_url":"https://api.github.com/users/brooklyncentral/orgs","repos_url":"https://api.github.com/users/brooklyncentral/repos","events_url":"https://api.github.com/users/brooklyncentral/events{/privacy}","received_events_url":"https://api.github.com/users/brooklyncentral/received_events","type":"Organization","site_admin":false},"repo":{"id":17784299,"name":"clocker","full_name":"brooklyncentral/clocker","owner":{"login":"brooklyncentral","id":1587357,"avatar_url":"https://avatars.githubusercontent.com/u/1587357?v=3","gravatar_id":"","url":"https://api.github.com/users/brooklyncentral","html_url":"https://github.com/brooklyncentral","followers_url":"https://api.github.com/users/brooklyncentral/followers","following_url":"https://api.github.com/users/brooklyncentral/following{/other_user}","gists_url":"https://api.github.com/users/brooklyncentral/gists{/gist_id}","starred_url":"https://api.github.com/users/brooklyncentral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brooklyncentral/subscriptions","organizations_url":"https://api.github.com/users/brooklyncentral/orgs","repos_url":"https://api.github.com/users/brooklyncentral/repos","events_url":"https://api.github.com/users/brooklyncentral/events{/privacy}","received_events_url":"https://api.github.com/users/brooklyncentral/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/brooklyncentral/clocker","description":"Brooklyn managed Docker containers","fork":false,"url":"https://api.github.com/repos/brooklyncentral/clocker","forks_url":"https://api.github.com/repos/brooklyncentral/clocker/forks","keys_url":"https://api.github.com/repos/brooklyncentral/clocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brooklyncentral/clocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brooklyncentral/clocker/teams","hooks_url":"https://api.github.com/repos/brooklyncentral/clocker/hooks","issue_events_url":"https://api.github.com/repos/brooklyncentral/clocker/issues/events{/number}","events_url":"https://api.github.com/repos/brooklyncentral/clocker/events","assignees_url":"https://api.github.com/repos/brooklyncentral/clocker/assignees{/user}","branches_url":"https://api.github.com/repos/brooklyncentral/clocker/branches{/branch}","tags_url":"https://api.github.com/repos/brooklyncentral/clocker/tags","blobs_url":"https://api.github.com/repos/brooklyncentral/clocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brooklyncentral/clocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brooklyncentral/clocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/brooklyncentral/clocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brooklyncentral/clocker/statuses/{sha}","languages_url":"https://api.github.com/repos/brooklyncentral/clocker/languages","stargazers_url":"https://api.github.com/repos/brooklyncentral/clocker/stargazers","contributors_url":"https://api.github.com/repos/brooklyncentral/clocker/contributors","subscribers_url":"https://api.github.com/repos/brooklyncentral/clocker/subscribers","subscription_url":"https://api.github.com/repos/brooklyncentral/clocker/subscription","commits_url":"https://api.github.com/repos/brooklyncentral/clocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/brooklyncentral/clocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/brooklyncentral/clocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/brooklyncentral/clocker/issues/comments{/number}","contents_url":"https://api.github.com/repos/brooklyncentral/clocker/contents/{+path}","compare_url":"https://api.github.com/repos/brooklyncentral/clocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brooklyncentral/clocker/merges","archive_url":"https://api.github.com/repos/brooklyncentral/clocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brooklyncentral/clocker/downloads","issues_url":"https://api.github.com/repos/brooklyncentral/clocker/issues{/number}","pulls_url":"https://api.github.com/repos/brooklyncentral/clocker/pulls{/number}","milestones_url":"https://api.github.com/repos/brooklyncentral/clocker/milestones{/number}","notifications_url":"https://api.github.com/repos/brooklyncentral/clocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brooklyncentral/clocker/labels{/name}","releases_url":"https://api.github.com/repos/brooklyncentral/clocker/releases{/id}","deployments_url":"https://api.github.com/repos/brooklyncentral/clocker/deployments","created_at":"2014-03-15T20:03:57Z","updated_at":"2016-10-26T21:13:28Z","pushed_at":"2016-10-27T09:57:25Z","git_url":"git://github.com/brooklyncentral/clocker.git","ssh_url":"git@github.com:brooklyncentral/clocker.git","clone_url":"https://github.com/brooklyncentral/clocker.git","svn_url":"https://github.com/brooklyncentral/clocker","homepage":null,"size":8769,"stargazers_count":406,"watchers_count":406,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":64,"mirror_url":null,"open_issues_count":55,"forks":64,"open_issues":55,"watchers":406,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/brooklyncentral/clocker/pulls/365"},"html":{"href":"https://github.com/brooklyncentral/clocker/pull/365"},"issue":{"href":"https://api.github.com/repos/brooklyncentral/clocker/issues/365"},"comments":{"href":"https://api.github.com/repos/brooklyncentral/clocker/issues/365/comments"},"review_comments":{"href":"https://api.github.com/repos/brooklyncentral/clocker/pulls/365/comments"},"review_comment":{"href":"https://api.github.com/repos/brooklyncentral/clocker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/brooklyncentral/clocker/pulls/365/commits"},"statuses":{"href":"https://api.github.com/repos/brooklyncentral/clocker/statuses/ffa1070f08d3302aea6a1385723b65746e53f890"}}}}
{"actor":{"display_login":"googlielmo"}}