Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for el9 based systems (php-fpm pool) #676

Merged
merged 1 commit into from
Jul 30, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This file is used to list changes made in each version of the nagios cookbook.

Standardise files with files in sous-chefs/repo-management

- Add support for el9 based systems
- Centos stream 8 is EOL, switched to Centos stream 9

## 12.0.0 - *2024-07-02*

- Standardise files with files in sous-chefs/repo-management
Expand Down
5 changes: 4 additions & 1 deletion kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ verifier:

platforms:
- name: almalinux-8
- name: centos-stream-8
- name: almalinux-9
- name: centos-stream-9
- name: debian-11
- name: debian-12
- name: fedora-latest
- name: rockylinux-8
- name: rockylinux-9
- name: ubuntu-20.04
- name: ubuntu-22.04
- name: ubuntu-24.04
Expand Down
28 changes: 22 additions & 6 deletions recipes/apache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,21 @@

apache2_module 'cgi'
apache2_module 'rewrite'
apache2_mod_php 'nagios'
if apache_mod_php_supported?
apache2_mod_php 'nagios'
apache_php_handler = 'application/x-httpd-php'
else
apache2_module 'proxy'
apache2_module 'proxy_fcgi'
apache2_mod_proxy 'proxy'
php_fpm_pool 'nagios' do
user default_apache_user
group default_apache_group
listen_user default_apache_user
listen_group default_apache_group
end
apache_php_handler = "proxy:unix:#{php_fpm_socket}|fcgi://localhost"
end

apache2_module 'ssl' if node['nagios']['enable_ssl']

Expand All @@ -44,11 +58,10 @@
https: node['nagios']['enable_ssl'],
ssl_cert_file: node['nagios']['ssl_cert_file'],
ssl_cert_key: node['nagios']['ssl_cert_key'],
apache_log_dir: default_log_dir
apache_log_dir: default_log_dir,
apache_php_handler: apache_php_handler
)
if File.symlink?("#{apache_dir}/sites-enabled/#{node['nagios']['server']['vname']}.conf")
notifies :restart, 'apache2_service[nagios]'
end
notifies :restart, 'apache2_service[nagios]' if File.symlink?("#{apache_dir}/sites-enabled/#{node['nagios']['server']['vname']}.conf")
end

file "#{apache_dir}/conf.d/#{node['nagios']['server']['vname']}.conf" do
Expand Down Expand Up @@ -89,7 +102,10 @@
subscribes :restart, 'apache2_install[nagios]'
subscribes :reload, 'apache2_module[cgi]'
subscribes :reload, 'apache2_module[rewrite]'
subscribes :reload, 'apache2_mod_php[nagios]'
subscribes :reload, 'apache2_mod_php[nagios]' if apache_mod_php_supported?
subscribes :reload, 'apache2_module[proxy]' unless apache_mod_php_supported?
subscribes :reload, 'apache2_module[proxy_fcgi]' unless apache_mod_php_supported?
subscribes :reload, 'apache2_mod_proxy[proxy]' unless apache_mod_php_supported?
subscribes :reload, 'apache2_module[ssl]' if node['nagios']['enable_ssl']
end

Expand Down
2 changes: 1 addition & 1 deletion templates/apache2.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</Directory>

<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler application/x-httpd-php
SetHandler "<%= @apache_php_handler %>"
</FilesMatch>

<% if @https -%>
Expand Down
Loading