Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup nodes + httpchk #100

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/synapse/haproxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on having a haproxy_server_options catch all registration info for backend registrations similar to the watcher's server_options?

So like, instead of haproxy_backup and haproxy_httpchk you just have haproxy_server_options which can contain weights, httpcheck lines, ports, backup status, etc ...

b = "#{b} cookie #{backend_name}" unless config.include?('mode tcp')
b = "#{b} #{watcher.haproxy['server_options']}"
b = "#{b} disabled" unless backend['enabled']
Expand Down