Skip to content

Commit

Permalink
Add example of how to configure php for el9 based systems
Browse files Browse the repository at this point in the history
Drop centos stream 8, ubuntu 18.04 and Debian 10

Signed-off-by: Mike van Goor <[email protected]>
  • Loading branch information
mvangoor committed Jul 31, 2024
1 parent e05c008 commit 55d1cd8
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 30 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ jobs:
- almalinux-8
- almalinux-9
- amazonlinux-2023
- centos-stream-8
- centos-stream-9
- debian-10
- debian-11
- debian-12
- fedora-latest
- opensuse-leap-15
- rockylinux-8
- rockylinux-9
- ubuntu-1804
- ubuntu-2004
- ubuntu-2204
suite:
Expand All @@ -54,17 +51,6 @@ jobs:
# TODO: disabled due to https://github.com/chef/chef/pull/13691
- os: opensuse-leap-15
suite: mod-wsgi
# mod_php is considered old. PHP-FPM is the new hotness.
- os: amazonlinux-2023
suite: mod-php
- os: almalinux-9
suite: mod-php
- os: centos-stream-9
suite: mod-php
- os: fedora-latest
suite: mod-php
- os: rockylinux-9
suite: mod-php
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the apache2 cookbook.

## Unreleased

- Add example of how to configure php fpm pool config for rhel9 and derivatives

## 9.3.3 - *2024-07-15*

Standardise files with files in sous-chefs/repo-management
Expand Down
10 changes: 5 additions & 5 deletions documentation/resource_apache2_mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ This will use a template resource to write the module's configuration file in th

## Properties

| Name | Type | Default | Description |
| ------------ | ------ | --------------------------- | ---------------------------------------------------------------------- |
| `template` | String | | Name of the template |
| `root_group` | String | `node['root_group']` | Set to override the platforms default root group for the template file |
| `template_cookbook` | String | `apache2` | Cookbook containing the template file
| Name | Type | Default | Description |
| ------------------- | ------ | --------------------------- | ---------------------------------------------------------------------- |
| `template` | String | | Name of the template |
| `root_group` | String | `node['root_group']` | Set to override the platforms default root group for the template file |
| `template_cookbook` | String | `apache2` | Cookbook containing the template file |

## Examples

Expand Down
7 changes: 0 additions & 7 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ suites:
- name: mod_php
run_list:
- recipe[test::php]
excludes:
- almalinux-9
- amazonlinux-2023
- centos-stream-9
- fedora-latest
- oraclelinux-9
- rockylinux-9
- name: mod_wsgi
run_list:
- recipe[test::wsgi]
Expand Down
4 changes: 2 additions & 2 deletions spec/resources/mod_php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

it do
is_expected.to enable_apache2_module('php').with(
identifier: 'php7_module',
mod_name: 'libphp7.4.so'
identifier: 'php_module',
mod_name: 'libphp8.1.so'
)
end
end
Expand Down
1 change: 1 addition & 0 deletions test/cookbooks/test/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
depends 'apache2'
depends 'apt'
# depends 'yum-ius'
depends 'php'
32 changes: 30 additions & 2 deletions test/cookbooks/test/recipes/php.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
# This needs to go first at it places files in /etc/httpd/conf.d
php_fpm_pool 'nagios' do
user default_apache_user
group default_apache_group
listen_user default_apache_user
listen_group default_apache_group
not_if { apache_mod_php_supported? }
end

apache2_install 'default' do
mpm 'prefork'
notifies :restart, 'apache2_service[default]'
end

apache2_mod_php '' do
notifies :reload, 'apache2_service[default]'
if apache_mod_php_supported?
apache2_mod_php '' do
notifies :reload, 'apache2_service[default]'
end
else
apache2_module 'proxy' do
notifies :reload, 'apache2_service[default]'
end
apache2_module 'proxy_fcgi' do
notifies :reload, 'apache2_service[default]'
end
apache2_mod_proxy 'proxy' do
notifies :reload, 'apache2_service[default]'
end
apache2_conf 'custom_php_pool' do
template_cookbook 'test'
options(
apache_php_handler: "proxy:unix:#{php_fpm_socket}|fcgi://localhost"
)
notifies :reload, 'apache2_service[default]'
end
end

file "#{default_docroot_dir}/info.php" do
Expand Down
3 changes: 3 additions & 0 deletions test/cookbooks/test/templates/custom_php_pool.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler "<%= @apache_php_handler %>"
</FilesMatch>

0 comments on commit 55d1cd8

Please sign in to comment.