Skip to content

Commit 8a09b36

Browse files
committed
Merge pull request #939 from stumped2/feature/master/mpm_event
Add configurable options for mpm_event
2 parents 7f36d4b + 468647c commit 8a09b36

4 files changed

Lines changed: 72 additions & 17 deletions

File tree

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* [Class: apache::default_mods](#class-apachedefault_mods)
1717
* [Defined Type: apache::mod](#defined-type-apachemod)
1818
* [Classes: apache::mod::*](#classes-apachemodname)
19+
* [Class: apache::mod::event](#class-apachemodevent)
1920
* [Class: apache::mod::info](#class-apachemodinfo)
2021
* [Class: apache::mod::pagespeed](#class-apachemodpagespeed)
2122
* [Class: apache::mod::php](#class-apachemodphp)
@@ -525,7 +526,7 @@ There are many `apache::mod::[name]` classes within this module that can be decl
525526
* `dev`
526527
* `dir`*
527528
* `disk_cache`
528-
* `event`
529+
* `event`(see [`apache::mod::event`](#class-apachemodevent) below)
529530
* `expires`
530531
* `fastcgi`
531532
* `fcgid`
@@ -569,11 +570,26 @@ Modules noted with a * indicate that the module has settings and, thus, a templa
569570

570571
The modules mentioned above, and other Apache modules that have templates, cause template files to be dropped along with the mod install. The module will not work without the template. Any module without a template installs the package but drops no files.
571572

573+
####Class: `apache::mod::event
574+
575+
Installs and manages mpm_event module.
576+
577+
Full Documentation for mpm_event is available from [Apache](https://httpd.apache.org/docs/current/mod/event.html).
578+
579+
To configure the event thread limit:
580+
581+
```puppet
582+
class {'apache::mod::event':
583+
$threadlimit => '128',
584+
}
585+
```
586+
587+
572588
####Class: `apache::mod::info`
573589

574590
Installs and manages mod_info which provides a comprehensive overview of the server configuration.
575591

576-
Full documentation for mod_info is available from [Apache](http://httpd.apache.org/docs/2.2/mod/mod_info.html).
592+
Full documentation for mod_info is available from [Apache](https://httpd.apache.org/docs/current/mod/mod_info.html).
577593

578594
These are the default settings:
579595

manifests/mod/event.pp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
class apache::mod::event (
2-
$startservers = '2',
3-
$maxclients = '150',
4-
$minsparethreads = '25',
5-
$maxsparethreads = '75',
6-
$threadsperchild = '25',
7-
$maxrequestsperchild = '0',
8-
$serverlimit = '25',
9-
$apache_version = $::apache::apache_version,
2+
$startservers = '2',
3+
$maxclients = '150',
4+
$minsparethreads = '25',
5+
$maxsparethreads = '75',
6+
$threadsperchild = '25',
7+
$maxrequestsperchild = '0',
8+
$serverlimit = '25',
9+
$apache_version = $::apache::apache_version,
10+
$threadlimit = '64',
11+
$listenbacklog = '511',
12+
$maxrequestworkers = '256',
13+
$maxconnectionsperchild = '0',
1014
) {
1115
if defined(Class['apache::mod::itk']) {
1216
fail('May not include both apache::mod::event and apache::mod::itk on the same node')

spec/classes/mod/event_spec.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,42 @@
3434
}
3535
end
3636

37+
3738
it { is_expected.to contain_class("apache::params") }
3839
it { is_expected.not_to contain_apache__mod('event') }
3940
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file') }
4041
it { is_expected.to contain_file("/etc/apache2/mods-enabled/event.conf").with_ensure('link') }
4142

43+
context "Test mpm_event params" do
44+
let :params do
45+
{
46+
:serverlimit => '0',
47+
:startservers => '1',
48+
:maxclients => '2',
49+
:minsparethreads => '3',
50+
:maxsparethreads => '4',
51+
:threadsperchild => '5',
52+
:maxrequestsperchild => '6',
53+
:threadlimit => '7',
54+
:listenbacklog => '8',
55+
:maxrequestworkers => '9',
56+
:maxconnectionsperchild => '10',
57+
}
58+
end
59+
60+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*ServerLimit\s*0/) }
61+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*StartServers\s*1/) }
62+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*MaxClients\s*2/) }
63+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*MinSpareThreads\s*3/) }
64+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*MaxSpareThreads\s*4/) }
65+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*ThreadsPerChild\s*5/) }
66+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*MaxRequestsPerChild\s*6/) }
67+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*ThreadLimit\s*7/) }
68+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*ListenBacklog\s*8/) }
69+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*MaxRequestWorkers\s*9/) }
70+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*MaxConnectionsPerChild\s*10/) }
71+
end
72+
4273
context "with Apache version < 2.4" do
4374
let :params do
4475
{

templates/mod/event.conf.erb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<IfModule mpm_event_module>
2-
ServerLimit <%= @serverlimit %>
3-
StartServers <%= @startservers %>
4-
MaxClients <%= @maxclients %>
5-
MinSpareThreads <%= @minsparethreads %>
6-
MaxSpareThreads <%= @maxsparethreads %>
7-
ThreadsPerChild <%= @threadsperchild %>
8-
MaxRequestsPerChild <%= @maxrequestsperchild %>
2+
ServerLimit <%= @serverlimit %>
3+
StartServers <%= @startservers %>
4+
MaxClients <%= @maxclients %>
5+
MinSpareThreads <%= @minsparethreads %>
6+
MaxSpareThreads <%= @maxsparethreads %>
7+
ThreadsPerChild <%= @threadsperchild %>
8+
MaxRequestsPerChild <%= @maxrequestsperchild %>
9+
ThreadLimit <%= @threadlimit %>
10+
ListenBacklog <%= @listenbacklog %>
11+
MaxRequestWorkers <%= @maxrequestworkers %>
12+
MaxConnectionsPerChild <%= @maxconnectionsperchild %>
913
</IfModule>

0 commit comments

Comments
 (0)