Files
confdroid_haproxy/doc/file.README.html
2026-09-05 14:43:48 +02:00

266 lines
9.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: README
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="file_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="_index.html">Index</a> &raquo;
<span class="title">File: README</span>
</div>
<div id="search">
<a class="full_list_link" id="puppet_class_list_link"
href="puppet_class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><div id='filecontents'>
<h1 id="label-Readme">Readme</h1>
<p><a href="https://jenkins.confdroid.com/job/confdroid_haproxy/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_haproxy&amp;style=plastic"></a></p>
<ul><li>
<p><a href="#readme">Readme</a></p>
</li><li>
<p><a href="#synopsis">Synopsis</a></p>
</li><li>
<p><a href="#warning">WARNING</a></p>
</li><li>
<p><a href="#features">Features</a></p>
</li><li>
<p><a href="#dependencies">Dependencies</a></p>
</li><li>
<p><a href="#deployment">Deployment</a></p>
</li><li>
<p><a href="#parameters">Parameters</a></p>
</li><li>
<p><a href="#proxy-configuration">Proxy Configuration</a></p>
</li><li>
<p><a href="#tls">TLS</a></p>
</li><li>
<p><a href="#selinux">SELINUX</a></p>
</li><li>
<p><a href="#known-problems">Known Problems</a></p>
</li><li>
<p><a href="#support">Support</a></p>
</li><li>
<p><a href="#tests">Tests</a></p>
</li><li>
<p><a href="#contact-us">Contact Us</a></p>
</li><li>
<p><a href="#disclaimer">Disclaimer</a></p>
</li></ul>
<h2 id="label-Synopsis">Synopsis</h2>
<p><code>HA Proxy</code> is a very powerful and popular open source load balancer to balance incoming requests between multiple instances of web-, application- or database servers etc.</p>
<p><code>confdroid_haproxy</code> automates installation and configuration of <code>HA proxy</code> including self-healing, monitoring and firewall etc.</p>
<h2 id="label-WARNING">WARNING</h2>
<blockquote>
<p><strong>Attention: Never use this puppet module on systems which have been previously configured manually. It is impossible to predict how and what would have been configured, hence previous configurations outside the scope of this module may be overwritten! Automated configurations require a test environment to verify that the module suits the purpose intended by the user, as well as tune the parameters, before deploying into live production</strong></p>
</blockquote>
<h2 id="label-Features">Features</h2>
<p>INSTALLATION</p>
<ul><li>
<p>install rpm binaries</p>
</li></ul>
<p>CONFIGURATION</p>
<ul><li>
<p>manage haproxy user</p>
</li><li>
<p>manage directories (file system permissions, selinux context)</p>
</li><li>
<p>manage files (file system permissions, content, selinux context)</p>
</li><li>
<p>manage proxy instances through a define</p>
</li><li>
<p>front-end options</p>
</li><li>
<p>back-end options</p>
</li><li>
<p>ACL options</p>
</li><li>
<p>adds haproxy logs to rsyslog for remote logging where used</p>
</li><li>
<p>manage fail2ban integration (optional, requires <code>confdroid_fail2ban</code> module)</p>
</li></ul>
<p>SERVICE</p>
<ul><li>
<p>manage haproxy service</p>
</li><li>
<p>restart service after changes in the configuration</p>
</li><li>
<p>stats are enabled on port 8404 with uri /haproxy?stats and strict private mode, set <code>hy_stats_auth</code> to something meaningful.</p>
</li></ul>
<h2 id="label-Dependencies">Dependencies</h2>
<p>All dependencies must be included in the catalogue.</p>
<ul><li>
<p><a href="https://github.com/puppetlabs/puppetlabs-concat">concat</a> for managing file fragments</p>
</li></ul>
<h2 id="label-Deployment">Deployment</h2>
<ul><li>
<p>native Puppet deployment</p>
</li></ul>
<p>via site.pp or nodes.pp</p>
<pre class="code ruby"><code class="ruby">node &#39;example.example.net&#39; {
include confdroid_haproxy
}
</code></pre>
<ul><li>
<p>through Foreman:</p>
</li></ul>
<p>In order to apply parameters through Foreman, <strong>confdroid_haproxy::params</strong>- must be added to the host or host group in question.</p>
<p>See <a href="https://confdroid.com/2017/05/deploying-our-puppet-modules/">more details about class deployment on Confdroid.com</a>.</p>
<h2 id="label-Parameters">Parameters</h2>
<p>The parameters are documented via puppet strings and <a href="/docs/index.html">listed here</a>. Simply open in web browser.</p>
<h2 id="label-Proxy+Configuration">Proxy Configuration</h2>
<p>The proxy instances are configured in /etc/haproxy/haproxy.cfg, which is concatenated from various templates through a define in this puppet module. In order to create proxy instances, you will need an external class, which addresses the define, like so:</p>
<p>ACL rule:</p>
<pre class="code ruby"><code class="ruby">confdroid_haproxy::server::proxy { &#39;testing&#39;:
haproxy_fqdn =&gt; &#39;node.example.net&#39;,
frontend_name =&gt; &#39;test01-frontend&#39;,
frontend_mode =&gt; &#39;http&#39;,
acl_rule =&gt; [&#39;too_fast fe_sess_rate ge 10&#39;,
&#39;network_allowed src 0.0.0.0/0&#39;],
backend_name =&gt; &#39;test01-backend&#39;,
}
</code></pre>
<p>real Proxy for https:</p>
<pre class="code ruby"><code class="ruby">haproxy_cd::server::proxy { &#39;https-in&#39;:
haproxy_fqdn =&gt; &#39;node.example.net&#39;,
frontend_name =&gt; &#39;https-in&#39;,
frontend_mode =&gt; &#39;http&#39;,
fe_bind_mode =&gt; &#39;*:443 ssl crt /etc/haproxy/certs/&#39;,
fe_option =&gt; &#39;forwardfor&#39;,
fe_http_request =&gt; &#39;add-header X-Forwarded-Proto https&#39;,
acl_rule_front =&gt; &#39;host_grafana hdr(host) -i grafana.example.net&#39;,
fe_use_backend =&gt; &#39;grafana_backend if host_grafana&#39;,
backend_configs =&gt; [
{
&#39;backend_name&#39; =&gt; &#39;grafana_backend&#39;,
&#39;be_mode&#39; =&gt; &#39;http&#39;,
&#39;be_balance&#39; =&gt; &#39;roundrobin&#39;,
&#39;be_server_name_array&#39; =&gt; [&#39;node1 10.0.1.1:8080 check&#39;],
}
]
default_backend =&gt; &#39;error_backend&#39;,
</code></pre>
<p>This allows the puppet module to create the sections in the configuration file as required. The haproxy service will be restarted after the changes in the configuration file are made. <code>haproxy_fqdn</code> <strong>must</strong>- contain the fqdn of the haproxy <strong>server</strong>- where this should be configured, otherwise the templates are not being populated. Multiple ACLs need to be added as array, and will create one line each.</p>
<h2 id="label-TLS">TLS</h2>
<p>Haproxy can manage all sorts of proxies including http and https. It also can terminate https requests and send the requests within a private network unencrypted, which is quite common. <strong>This module is NOT managing certificates</strong>, as there are many ways to manage this, including Kubernetes cert-manager, Lets encrypt or other ways.</p>
<h2 id="label-SELINUX">SELINUX</h2>
<p>All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored. If selinux is set to <code>enforce</code> (not controlled within this module), the parameter <code>hy_selinux_allow_stats</code> must also be set to <code>true</code>, else the haproxy service will not start as selinux will not allow it. This is the default setting.</p>
<h2 id="label-Known+Problems">Known Problems</h2>
<h2 id="label-Support">Support</h2>
<ul><li>
<p>OS: Rocky 9</p>
</li><li>
<p>Puppet 8</p>
</li></ul>
<h2 id="label-Tests">Tests</h2>
<ul><li>
<p>Puppet Lint</p>
</li><li>
<p>excluded tests:</p>
<ul><li>
<p><code>--no-variable_scope-check</code>: not applicable as we are inheriting parameters from params class. the lint check does not distinguish between facts and inherited parameters.</p>
</li></ul>
</li><li>
<p>Puppet Parser</p>
</li><li>
<p>ERB Template Parser</p>
</li><li>
<p>Sonar Quality Gate</p>
</li></ul>
<h2 id="label-Contact+Us">Contact Us</h2>
<ul><li>
<p><a href="https://confdroid.com/contact/">contact Us</a></p>
</li><li>
<p><a href="https://feedback.confdroid.com/">Feedback Portal</a></p>
</li></ul>
<h2 id="label-Disclaimer">Disclaimer</h2>
<p>ConfDroid as entity is entirely independent from Puppet. We provide custom configuration modules, written for specific purposes and specific environments. The modules are tested and supported only as documented, and require testing in designated environments (i.e. lab or development environments) for parameter tuning etc. before deploying into production environments.</p>
</div></div>
<div id="footer">
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
</div>
</div>
</body>
</html>