annotate modules/website/manifests/php.pp @ 482:d83de9b3a62b default tip

Update hiera.yaml within Puppet config Forgot that we manage it from here. Now has content to match new packages
author IBBoard <dev@ibboard.co.uk>
date Fri, 30 Aug 2024 16:10:36 +0100
parents 2c3e745be8d2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 class website::php(
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 $suffix = '',
320
99e3ca448d55 Fix Remi PHP on CentOS 8
IBBoard <dev@ibboard.co.uk>
parents: 246
diff changeset
3 $module = undef,
69
565b788f7ac1 Allow for specifying extra PHP packages (e.g. to enable Posix)
IBBoard <dev@ibboard.co.uk>
parents: 17
diff changeset
4 $extras = [],
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 ) {
402
76d18a918e7f Switch to more parameters
IBBoard <dev@ibboard.co.uk>
parents: 400
diff changeset
6 include ::apache::params
480
2c3e745be8d2 Update server defs and own modules to match
IBBoard <dev@ibboard.co.uk>
parents: 462
diff changeset
7 $pcre_jit = 1
419
0c627ff3a7c3 Fix PHP setup on CentOS
IBBoard <dev@ibboard.co.uk>
parents: 402
diff changeset
8
480
2c3e745be8d2 Update server defs and own modules to match
IBBoard <dev@ibboard.co.uk>
parents: 462
diff changeset
9 if $facts["os"]["name"] == 'Ubuntu' {
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
10 # Ubuntu doesn't prefix its ini files as created here
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
11 # and has a different way of handling ordering
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
12 $ini_prefix_10 = ''
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
13 $ini_prefix_20 = ''
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
14 }
480
2c3e745be8d2 Update server defs and own modules to match
IBBoard <dev@ibboard.co.uk>
parents: 462
diff changeset
15 else {
2c3e745be8d2 Update server defs and own modules to match
IBBoard <dev@ibboard.co.uk>
parents: 462
diff changeset
16 fail("Unsupported OS: ${facts['os']['name']}")
2c3e745be8d2 Update server defs and own modules to match
IBBoard <dev@ibboard.co.uk>
parents: 462
diff changeset
17 }
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
18
419
0c627ff3a7c3 Fix PHP setup on CentOS
IBBoard <dev@ibboard.co.uk>
parents: 402
diff changeset
19 file { '/run/php/':
0c627ff3a7c3 Fix PHP setup on CentOS
IBBoard <dev@ibboard.co.uk>
parents: 402
diff changeset
20 ensure => directory,
0c627ff3a7c3 Fix PHP setup on CentOS
IBBoard <dev@ibboard.co.uk>
parents: 402
diff changeset
21 } ->
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
22 class { '::php':
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
23 ensure => present,
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
24 manage_repos => false,
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
25 fpm => true,
419
0c627ff3a7c3 Fix PHP setup on CentOS
IBBoard <dev@ibboard.co.uk>
parents: 402
diff changeset
26 fpm_service_enable => true,
0c627ff3a7c3 Fix PHP setup on CentOS
IBBoard <dev@ibboard.co.uk>
parents: 402
diff changeset
27 fpm_service_ensure => 'running',
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
28 fpm_pools => {
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
29 'www' => {
427
3744cd0807cb Move PHP socket to /run/
IBBoard <dev@ibboard.co.uk>
parents: 425
diff changeset
30 'listen' => '/run/php-fpm.sock',
402
76d18a918e7f Switch to more parameters
IBBoard <dev@ibboard.co.uk>
parents: 400
diff changeset
31 'listen_owner' => $::apache::params::user,
76d18a918e7f Switch to more parameters
IBBoard <dev@ibboard.co.uk>
parents: 400
diff changeset
32 'listen_group' => $::apache::params::group,
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
33 'slowlog' => '/var/log/php-fpm/www-slow.log',
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
34 'security_limit_extensions' => ['.php', '.html'],
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
35 'php_admin_value' => {
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
36 'memory_limit' => '256M',
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
37 },
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
38 'php_value' => {
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
39 # 'session.save_path' => '/var/lib/php/session' # Ubuntu uses plural, CentOS uses singular
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
40 },
462
2f2ecf1f0215 Reduce PHP FPM overheads
IBBoard <dev@ibboard.co.uk>
parents: 454
diff changeset
41 'pm_start_servers' => 5,
2f2ecf1f0215 Reduce PHP FPM overheads
IBBoard <dev@ibboard.co.uk>
parents: 454
diff changeset
42 'pm_min_spare_servers' => 5,
2f2ecf1f0215 Reduce PHP FPM overheads
IBBoard <dev@ibboard.co.uk>
parents: 454
diff changeset
43 'pm_max_spare_servers' => 10,
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
44 },
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
45 },
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
46 dev => false,
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
47 composer => false,
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
48 pear => false,
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
49 settings => {
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
50 'PHP/default_charset' => 'UTF-8',
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
51 'PHP/pcre.jit' => $pcre_jit,
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
52 # Space isn't scarce these days - increase default sizes
480
2c3e745be8d2 Update server defs and own modules to match
IBBoard <dev@ibboard.co.uk>
parents: 462
diff changeset
53 # The new module is typed, so we need ints instead of "16M"
2c3e745be8d2 Update server defs and own modules to match
IBBoard <dev@ibboard.co.uk>
parents: 462
diff changeset
54 'PHP/upload_max_filesize' => 16777216,
2c3e745be8d2 Update server defs and own modules to match
IBBoard <dev@ibboard.co.uk>
parents: 462
diff changeset
55 'PHP/post_max_size' => 16777216,
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
56 'Data/date.timezone' => 'UTC',
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
57 },
436
6293839019d0 Adjust PHP settings for NextCloud
IBBoard <dev@ibboard.co.uk>
parents: 433
diff changeset
58 cli_settings => {
6293839019d0 Adjust PHP settings for NextCloud
IBBoard <dev@ibboard.co.uk>
parents: 433
diff changeset
59 'apc.enable_cli' => 1 ,
6293839019d0 Adjust PHP settings for NextCloud
IBBoard <dev@ibboard.co.uk>
parents: 433
diff changeset
60 },
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
61 extensions => {
425
b91e948e8645 Add another PHP module to fix webmail
IBBoard <dev@ibboard.co.uk>
parents: 422
diff changeset
62 ctype => {
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
63 ini_prefix => $ini_prefix_20,
425
b91e948e8645 Add another PHP module to fix webmail
IBBoard <dev@ibboard.co.uk>
parents: 422
diff changeset
64 },
422
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
65 gd => {
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
66 ini_prefix => $ini_prefix_20,
422
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
67 },
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
68 iconv => {
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
69 ini_prefix => $ini_prefix_20,
422
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
70 },
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
71 mbstring => {
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
72 ini_prefix => $ini_prefix_20,
422
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
73 },
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
74 opcache => {
444
83fbddb56de1 Increase PHP limits
IBBoard <dev@ibboard.co.uk>
parents: 436
diff changeset
75 ensure => present,
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
76 ini_prefix => $ini_prefix_10,
422
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
77 zend => true,
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
78 settings => {
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
79 'opcache.enable' => 1,
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
80 'opcache.enable_cli' => 1,
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
81 'opcache.interned_strings_buffer' => 32,
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
82 'opcache.max_accelerated_files' => 15000,
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
83 'opcache.max_wasted_percentage' => 3,
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
84 'opcache.memory_consumption' => 256,
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
85 'opcache.save_comments' => 1,
436
6293839019d0 Adjust PHP settings for NextCloud
IBBoard <dev@ibboard.co.uk>
parents: 433
diff changeset
86 'opcache.revalidate_freq' => 60,
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
87 'opcache.huge_code_pages' => 0,
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
88 }
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
89 },
422
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
90 xml => {
454
d0e7979c7e8c Update PHP configs for Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 444
diff changeset
91 ini_prefix => $ini_prefix_20,
422
8421eb25c329 Fix PHP extension loading
IBBoard <dev@ibboard.co.uk>
parents: 419
diff changeset
92 },
399
2c6065b5be5e Switch to config-based PHP extensions
IBBoard <dev@ibboard.co.uk>
parents: 390
diff changeset
93 } + $extras,
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
94 }
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
95 apache::custom_config { "php.conf":
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
96 ensure => present,
433
e7491c126d95 Set filename on php.conf
IBBoard <dev@ibboard.co.uk>
parents: 427
diff changeset
97 source => "puppet:///modules/website/php.conf",
e7491c126d95 Set filename on php.conf
IBBoard <dev@ibboard.co.uk>
parents: 427
diff changeset
98 filename => "php.conf",
390
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
99 }
df5ad1612af7 Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents: 357
diff changeset
100 class { ['apache::mod::proxy', 'apache::mod::proxy_fcgi']:}
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
101 }