2020-12-01 19:42:42 +01:00
|
|
|
[](https://pipelines.confdroid.com/job/cd_haproxy/)|
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
[[_TOC_]]
|
|
|
|
|
|
|
|
|
|
# Synopsis
|
|
|
|
|
|
|
|
|
|
`HA Proxy` is a very powerful and popular open source load balancer to balance
|
|
|
|
|
incoming requests between multiple instances of web-, application- or database
|
|
|
|
|
servers etc.
|
|
|
|
|
|
|
|
|
|
`cd_haproxy` automates installation and configuration of `HA proxy`
|
|
|
|
|
including self-healing, monitoring and firewall etc.
|
|
|
|
|
|
|
|
|
|
# WARNING
|
|
|
|
|
|
|
|
|
|
`**__!!! Attention: Never use this puppet module on systems which have been
|
|
|
|
|
previously configured manually. It is impossible to predict how and what would
|
2021-01-02 20:48:57 +01:00
|
|
|
have been configured, hence previous configurations outside the scope of this
|
2021-01-02 20:17:09 +01:00
|
|
|
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!!! __**`
|
|
|
|
|
|
|
|
|
|
# Features
|
|
|
|
|
|
2018-04-24 15:32:11 +02:00
|
|
|
INSTALLATION
|
2018-12-10 15:56:28 +01:00
|
|
|
* install rpm binaries
|
2018-04-24 15:32:11 +02:00
|
|
|
|
|
|
|
|
CONFIGURATION
|
2018-12-10 15:56:28 +01:00
|
|
|
* manage haproxy user
|
|
|
|
|
* manage directories (file system permissions, selinux context)
|
|
|
|
|
* manage files (file system permissions, content, selinux context)
|
2018-12-30 15:18:37 +01:00
|
|
|
* manage proxy instances through a define
|
2018-12-30 17:17:19 +01:00
|
|
|
* frontend options
|
|
|
|
|
* backend options
|
|
|
|
|
* ACL options
|
|
|
|
|
|
2018-04-24 15:32:11 +02:00
|
|
|
SERVICE
|
2018-12-10 15:56:28 +01:00
|
|
|
* manage haproxy service
|
2018-12-30 15:39:04 +01:00
|
|
|
* restart service after changes in the configuration
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:48:57 +01:00
|
|
|
# [Puppet Documentation](docs/index.html)
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
# Dependencies
|
|
|
|
|
|
2018-04-24 15:32:11 +02:00
|
|
|
All dependencies must be included in the catalogue.
|
|
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
* [cd_resources](https://gitlab.confdroid.com/12WW1160/cd_resources)
|
|
|
|
|
for managing yum base repos
|
|
|
|
|
* [cd_concat](https://gitlab.confdroid.com/12ww1160/cd_concat) or
|
|
|
|
|
[concat](https://github.com/puppetlabs/puppetlabs-concat)
|
|
|
|
|
for managing file fragments
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
# Deployment
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
## native Puppet deployment
|
2018-04-24 15:32:11 +02:00
|
|
|
|
|
|
|
|
via site.pp or nodes.pp
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
node 'example.example.net' {
|
|
|
|
|
include cd_haproxy
|
|
|
|
|
}
|
|
|
|
|
```
|
2021-01-02 20:17:09 +01:00
|
|
|
## through Foreman:
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 21:05:05 +01:00
|
|
|
Add params.pp to the host or hostgroup.
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 21:19:27 +01:00
|
|
|
See [more details about class deployment on confdroid.com]
|
2021-01-02 20:17:09 +01:00
|
|
|
(https://confdroid.com/2017/05/deploying-our-puppet-modules/).
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
# Documentation
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
## Parameters
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
The parameters are defined and described in `params.pp`. The documentation is
|
|
|
|
|
provided via `puppet strings` in HTML format, please see `doc/index.html`
|
|
|
|
|
via web browser.
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
# Proxy Configuration
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
## Via Define
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 21:09:56 +01:00
|
|
|
The proxy instances are configured in `/etc/haproxy/haproxy.cfg`, which is
|
2021-01-02 20:17:09 +01:00
|
|
|
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:
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2018-12-30 15:18:37 +01:00
|
|
|
```
|
|
|
|
|
cd_haproxy::server::proxy { 'testing':
|
2018-12-30 18:31:41 +01:00
|
|
|
haproxy_fqdn => 'node.example.net',
|
2018-12-30 15:18:37 +01:00
|
|
|
frontend_name => 'test01-frontend',
|
2018-12-30 17:12:36 +01:00
|
|
|
frontend_mode => 'http',
|
2018-12-30 17:17:19 +01:00
|
|
|
acl_rule => ['too_fast fe_sess_rate ge 10',
|
2018-12-30 17:12:36 +01:00
|
|
|
'network_allowed src 0.0.0.0/0'],
|
2018-12-30 15:18:37 +01:00
|
|
|
backend_name => 'test01-backend',
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
This class should be placed in an internal configuration repo specific
|
|
|
|
|
to your environment.
|
|
|
|
|
|
|
|
|
|
# SELINUX
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
All files and directories are configured with correct selinux context.
|
|
|
|
|
If selinux is disabled, these contexts are ignored.
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
# Known Problems
|
|
|
|
|
|
|
|
|
|
# Support
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2018-12-10 14:36:54 +01:00
|
|
|
* OS: CentOS 7
|
|
|
|
|
* Puppet 5.x
|
2018-04-24 15:32:11 +02:00
|
|
|
|
|
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
# Tests
|
|
|
|
|
|
2018-04-24 15:32:11 +02:00
|
|
|
* Puppet Lint
|
|
|
|
|
* excluded tests:
|
2021-01-02 20:17:09 +01:00
|
|
|
* `--no-class_inherits_from_params_class-check`:relevant only to
|
|
|
|
|
non-supported outdated puppet versions
|
|
|
|
|
* `--no-variable_scope-check`: not applicable as we are inheriting
|
2021-01-02 21:19:27 +01:00
|
|
|
parameters from the params class. the lint check does not distinguish
|
2021-01-02 20:17:09 +01:00
|
|
|
between facts and inherited parameters.
|
|
|
|
|
* `--no-80chars-check`: it is not always possible to stay within
|
|
|
|
|
80 characters, although typically only occurring on the
|
|
|
|
|
parameter vault `params.pp`.
|
|
|
|
|
* `--no-arrow_alignment-check`: this check leads to actually not having
|
|
|
|
|
easily readable arrow alignments, as this checks `per block`,
|
|
|
|
|
not per class.
|
2018-04-24 15:32:11 +02:00
|
|
|
* Puppet Parser
|
|
|
|
|
* ERB Template Parser
|
2021-01-02 21:22:57 +01:00
|
|
|
* Test for unwanted UTF8 files
|
|
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
|
|
|
|
|
# Contact Us
|
|
|
|
|
|
2018-04-24 15:32:11 +02:00
|
|
|
[contact Us](https://confdroid.com/contact/)
|
|
|
|
|
|
2021-01-02 20:17:09 +01:00
|
|
|
# Disclaimer
|
|
|
|
|
|
|
|
|
|
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.
|