Merge "Allow to parameterize haproxy options"
This commit is contained in:
@@ -20,6 +20,51 @@ class cgit::lb (
|
|||||||
$balancer_member_http_ports = ['8080',],
|
$balancer_member_http_ports = ['8080',],
|
||||||
$balancer_member_https_ports = ['4443',],
|
$balancer_member_https_ports = ['4443',],
|
||||||
$balancer_member_git_ports = ['29418',],
|
$balancer_member_git_ports = ['29418',],
|
||||||
|
$global_options = {
|
||||||
|
'log' => '127.0.0.1 local0',
|
||||||
|
'chroot' => '/var/lib/haproxy',
|
||||||
|
'pidfile' => '/var/run/haproxy.pid',
|
||||||
|
'maxconn' => '4000',
|
||||||
|
'user' => 'haproxy',
|
||||||
|
'group' => 'haproxy',
|
||||||
|
'daemon' => '',
|
||||||
|
'stats' => 'socket /var/lib/haproxy/stats user root group root mode 0600 level admin'
|
||||||
|
},
|
||||||
|
$defaults_options = {
|
||||||
|
'log' => 'global',
|
||||||
|
'stats' => 'enable',
|
||||||
|
'option' => 'redispatch',
|
||||||
|
'retries' => '3',
|
||||||
|
'timeout' => [
|
||||||
|
'http-request 10s',
|
||||||
|
'queue 1m',
|
||||||
|
'connect 10s',
|
||||||
|
'client 2m',
|
||||||
|
'server 2m',
|
||||||
|
'check 10s',
|
||||||
|
],
|
||||||
|
'maxconn' => '8000',
|
||||||
|
},
|
||||||
|
$http_options = {
|
||||||
|
'balance' => 'leastconn',
|
||||||
|
'option' => [
|
||||||
|
'tcplog',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
$https_options = {
|
||||||
|
'balance' => 'leastconn',
|
||||||
|
'option' => [
|
||||||
|
'tcplog',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
$git_options = {
|
||||||
|
'maxconn' => '256',
|
||||||
|
'backlog' => '256',
|
||||||
|
'balance' => 'leastconn',
|
||||||
|
'option' => [
|
||||||
|
'tcplog',
|
||||||
|
],
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
|
|
||||||
package { 'socat':
|
package { 'socat':
|
||||||
@@ -31,17 +76,9 @@ class cgit::lb (
|
|||||||
}
|
}
|
||||||
|
|
||||||
class { '::haproxy':
|
class { '::haproxy':
|
||||||
enable => true,
|
enable => true,
|
||||||
global_options => {
|
global_options => $global_options,
|
||||||
'log' => '127.0.0.1 local0',
|
defaults_options => $defaults_options,
|
||||||
'chroot' => '/var/lib/haproxy',
|
|
||||||
'pidfile' => '/var/run/haproxy.pid',
|
|
||||||
'maxconn' => '4000',
|
|
||||||
'user' => 'haproxy',
|
|
||||||
'group' => 'haproxy',
|
|
||||||
'daemon' => '',
|
|
||||||
'stats' => 'socket /var/lib/haproxy/stats user root group root mode 0600 level admin'
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# The three listen defines here are what the world will hit.
|
# The three listen defines here are what the world will hit.
|
||||||
@@ -52,38 +89,21 @@ class cgit::lb (
|
|||||||
ports => ['80'],
|
ports => ['80'],
|
||||||
mode => 'tcp',
|
mode => 'tcp',
|
||||||
collect_exported => false,
|
collect_exported => false,
|
||||||
options => {
|
options => $http_options,
|
||||||
'balance' => 'source',
|
|
||||||
'option' => [
|
|
||||||
'tcplog',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
haproxy::listen { 'balance_git_https':
|
haproxy::listen { 'balance_git_https':
|
||||||
ipaddress => $haproxy_addresses,
|
ipaddress => $haproxy_addresses,
|
||||||
ports => ['443'],
|
ports => ['443'],
|
||||||
mode => 'tcp',
|
mode => 'tcp',
|
||||||
collect_exported => false,
|
collect_exported => false,
|
||||||
options => {
|
options => $https_options,
|
||||||
'balance' => 'source',
|
|
||||||
'option' => [
|
|
||||||
'tcplog',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
haproxy::listen { 'balance_git_daemon':
|
haproxy::listen { 'balance_git_daemon':
|
||||||
ipaddress => $haproxy_addresses,
|
ipaddress => $haproxy_addresses,
|
||||||
ports => ['9418'],
|
ports => ['9418'],
|
||||||
mode => 'tcp',
|
mode => 'tcp',
|
||||||
collect_exported => false,
|
collect_exported => false,
|
||||||
options => {
|
options => $git_options,
|
||||||
'maxconn' => '32',
|
|
||||||
'backlog' => '64',
|
|
||||||
'balance' => 'source',
|
|
||||||
'option' => [
|
|
||||||
'tcplog',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
haproxy::balancermember { 'balance_git_http_member':
|
haproxy::balancermember { 'balance_git_http_member':
|
||||||
listening_service => 'balance_git_http',
|
listening_service => 'balance_git_http',
|
||||||
|
|||||||
Reference in New Issue
Block a user