Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Breaking Changes

* **playbook:apache_solr**: The playbook runs the kernel_settings role and sets `vm.swappiness` to 1, as the Solr Reference Guide recommends, so the kernel no longer swaps out the Java heap while memory is still available. On hosts that do not run kernel_settings yet, this also installs TuneD and applies its sysctl hardening baseline. Set `apache_solr__skip_kernel_settings: true` to leave the kernel settings alone.
* **role:mariadb_server**: MariaDB may open at least 65536 files instead of 32768 (`mariadb_server__service_limit_nofile`), enough for 16 table cache instances, and a lower value no longer takes effect; a higher limit that the MariaDB package or systemd set is kept. The next run restarts MariaDB.
* **role:fail2ban**: On hosts with Apache logs below `/var/log/httpd`, the role enables the Apache jails fail2ban ships (`apache-auth`, `apache-fakegooglebot`, `apache-modsecurity`, `apache-nohome`, `apache-noscript`, `apache-overflows`, `php-url-fopen`), unless `apache_httpd__mod_remoteip_internal_proxy` lists a proxy. On a host behind a reverse proxy that Apache logs as the client, such as LibreNMS behind a proxy, set `fail2ban__jails_apache_enabled: false`, otherwise the jails ban the proxy.
* **role:fail2ban**: The sshd jail also bans clients that connect without trying to log in, such as scanners (filter mode `aggressive`). Set `fail2ban__jail_sshd_mode: 'normal'` to keep the previous behaviour.
Expand Down
17 changes: 17 additions & 0 deletions extensions/molecule/apache_solr/install/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,20 @@
{{ __molecule__apache_solr_logs_result["files"] | map(attribute="path")
| zip(__molecule__apache_solr_logs_result["files"] | map(attribute="mode"))
| map("join", " ") | join(", ") }}

# The playbook hands vm.swappiness to the kernel_settings role, as the Solr
# Reference Guide recommends, so that the kernel keeps the Java heap in RAM.
- name: 'cat /proc/sys/vm/swappiness'
ansible.builtin.slurp:
src: '/proc/sys/vm/swappiness'
register: '__molecule__apache_solr_swappiness_result'

- name: 'Assert vm.swappiness is 1'
ansible.builtin.assert:
that:
- '__molecule__apache_solr_swappiness == "1"'
fail_msg: 'vm.swappiness is {{ __molecule__apache_solr_swappiness }}'
vars:
__molecule__apache_solr_swappiness: '{{
__molecule__apache_solr_swappiness_result["content"] | b64decode | trim
}}'
1 change: 1 addition & 0 deletions playbooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Calls the following roles (in order):

Calls the following roles (in order):

* [kernel_settings](https://github.com/Linuxfabrik/lfops/tree/main/roles/kernel_settings): `apache_solr__skip_kernel_settings`
* [apps](https://github.com/Linuxfabrik/lfops/tree/main/roles/apps)
* [apache_solr](https://github.com/Linuxfabrik/lfops/tree/main/roles/apache_solr)

Expand Down
5 changes: 5 additions & 0 deletions playbooks/apache_solr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

roles:

- role: 'linuxfabrik.lfops.kernel_settings'
kernel_settings__sysctl__dependent_var: '{{ apache_solr__kernel_settings__sysctl__dependent_var | d([]) }}'
when:
- 'not apache_solr__skip_kernel_settings | d(false)'

- role: 'linuxfabrik.lfops.apps'
apps__apps__dependent_var: '{{
apache_solr__apps__apps__dependent_var
Expand Down
1 change: 1 addition & 0 deletions roles/apache_solr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Solr 8 is EOL and only covered where existing installations still run it.
Any [LFOps playbook](https://github.com/Linuxfabrik/lfops/blob/main/playbooks/README.md) that installs this role runs these for you. Optional ones can be disabled via the playbook's skip variables.

* The tools that Solr's start script and the role need, such as `lsof` and `tar`, must be installed (role: [linuxfabrik.lfops.apps](https://github.com/Linuxfabrik/lfops/tree/main/roles/apps)).
* `vm.swappiness` must be set to 1, so that the kernel keeps the Java heap in RAM, as the [Solr Reference Guide](https://solr.apache.org/guide/solr/latest/deployment-guide/taking-solr-to-production.html#avoid-swapping-nix-operating-systems) recommends (role: [linuxfabrik.lfops.kernel_settings](https://github.com/Linuxfabrik/lfops/tree/main/roles/kernel_settings)).


## Tags
Expand Down
7 changes: 7 additions & 0 deletions roles/apache_solr/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ apache_solr__apps__apps__dependent_var:
- name: 'bc'
- name: 'lsof'
- name: 'tar'

# https://solr.apache.org/guide/solr/latest/deployment-guide/taking-solr-to-production.html#avoid-swapping-nix-operating-systems
# the kernel honours vm.swappiness continuously, so solr.service needs no
# z00-after-tuned.conf (see "systemd Drop-ins and Service Ordering" in CONTRIBUTING.md)
apache_solr__kernel_settings__sysctl__dependent_var:
- name: 'vm.swappiness'
value: 1