From e893dff28c849f655b2472a4dd72d0746f9bbd99 Mon Sep 17 00:00:00 2001 From: Jay J Date: Tue, 11 Nov 2014 22:47:33 -0500 Subject: [PATCH 1/4] Allow setting backup nodes --- lib/synapse/haproxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/synapse/haproxy.rb b/lib/synapse/haproxy.rb index 89c50077..f4ed4a37 100644 --- a/lib/synapse/haproxy.rb +++ b/lib/synapse/haproxy.rb @@ -717,7 +717,7 @@ def generate_backend_stanza(watcher, config) config.map {|c| "\t#{c}"}, backends.keys.shuffle.map {|backend_name| backend = backends[backend_name] - b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}" + b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}#{' backup' if backend['backup']}#{' check port ' if backend['httpchk']}#{backend['chkport']}" b = "#{b} cookie #{backend_name}" unless config.include?('mode tcp') b = "#{b} #{watcher.haproxy['server_options']}" b = "#{b} disabled" unless backend['enabled'] From c0c371957ac0a8a089e5cfe848d4d389c3c5ba34 Mon Sep 17 00:00:00 2001 From: Jay J Date: Sun, 23 Nov 2014 17:50:07 -0500 Subject: [PATCH 2/4] Allow haproxy httpchk on a custom port --- lib/synapse/haproxy.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/synapse/haproxy.rb b/lib/synapse/haproxy.rb index f4ed4a37..2cbcfc1c 100644 --- a/lib/synapse/haproxy.rb +++ b/lib/synapse/haproxy.rb @@ -715,8 +715,13 @@ def generate_backend_stanza(watcher, config) stanza = [ "\nbackend #{watcher.name}", config.map {|c| "\t#{c}"}, +<<<<<<< HEAD backends.keys.shuffle.map {|backend_name| backend = backends[backend_name] +======= + watcher.backends.shuffle.map {|backend| + backend_name = construct_name(backend) +>>>>>>> Allow haproxy httpchk on a custom port b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}#{' backup' if backend['backup']}#{' check port ' if backend['httpchk']}#{backend['chkport']}" b = "#{b} cookie #{backend_name}" unless config.include?('mode tcp') b = "#{b} #{watcher.haproxy['server_options']}" From 360a7dc204ce311ca4ce01b703b0e98c7feece06 Mon Sep 17 00:00:00 2001 From: Jay J Date: Sun, 23 Nov 2014 17:55:36 -0500 Subject: [PATCH 3/4] Update README.md add backup servers & httpchk --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 5b9adea2..6d30ffa3 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,9 @@ Each hash in that section has the following options: * `name`: a human-readable name for the default server; must be unique * `host`: the host or IP address of the server * `port`: the port where the service runs on the `host` +* `backup` : boolean, use the server in backup mode +* `httpchk` : boolean, use haproxy httpchk for this server, requires `"option httpchk /"` to be set under haproxy options +* `chkport` : custom port for httpchk The `default_servers` list is used only when service discovery returns no servers. In that case, the service proxy will be created with the servers listed here. From 0662410bd2a180fde194967c8f16d1479f050052 Mon Sep 17 00:00:00 2001 From: Jay J Date: Thu, 27 Aug 2015 15:00:46 -0400 Subject: [PATCH 4/4] Update haproxy.rb --- lib/synapse/haproxy.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/synapse/haproxy.rb b/lib/synapse/haproxy.rb index 2cbcfc1c..f4ed4a37 100644 --- a/lib/synapse/haproxy.rb +++ b/lib/synapse/haproxy.rb @@ -715,13 +715,8 @@ def generate_backend_stanza(watcher, config) stanza = [ "\nbackend #{watcher.name}", config.map {|c| "\t#{c}"}, -<<<<<<< HEAD backends.keys.shuffle.map {|backend_name| backend = backends[backend_name] -======= - watcher.backends.shuffle.map {|backend| - backend_name = construct_name(backend) ->>>>>>> Allow haproxy httpchk on a custom port b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}#{' backup' if backend['backup']}#{' check port ' if backend['httpchk']}#{backend['chkport']}" b = "#{b} cookie #{backend_name}" unless config.include?('mode tcp') b = "#{b} #{watcher.haproxy['server_options']}"