Use newer HAProxy server configuration syntax
The previous syntax is not supported by HAProxy 1.6.
@@ -169,7 +169,8 @@ module HAProxy
# name : the name of the server
def self.create_app_config(servers, my_private_ip, listen_port, name)
config = "# Create a load balancer for the #{name} application\n"
- config << "listen #{name} #{my_private_ip}:#{listen_port}\n"
+ config << "listen #{name}\n"
+ config << " bind #{my_private_ip}:#{listen_port}\n"
servers.each do |server|
config << HAProxy.server_config(name, "#{server['ip']}:#{server['port']}") + "\n"
end
@@ -245,7 +246,8 @@ module HAProxy
end
config = "# Create a load balancer for the app #{app_name} \n"
- config << "listen #{full_app_name} #{private_ip}:#{listen_port} \n"
+ config << "listen #{full_app_name}\n"
+ config << " bind #{private_ip}:#{listen_port}\n"
config << servers.join("\n")
config_path = File.join(SITES_ENABLED_PATH,
