Puppet Class: php::fpm

Inherits:
php::params
Defined in:
manifests/fpm.pp

Overview

Parameters:

  • confbase (Any) (defaults to: $php::params::confbase_fpm)
  • php_loglevel (Any) (defaults to: 'notice')
  • fpm_loglevel (Any) (defaults to: 'notice')
  • user (Any) (defaults to: $php::params::user)
  • group (Any) (defaults to: $php::params::group)
  • expose_php (Any) (defaults to: false)
  • max_execution_time (Any) (defaults to: '5')
  • memory_limit (Any) (defaults to: '10M')
  • upload_max_filesize (Any) (defaults to: '100M')
  • post_max_size (Any) (defaults to: '110M')
  • timezone (Any) (defaults to: 'Europe/Andorra')
  • allow_url_fopen (Any) (defaults to: false)
  • allow_url_include (Any) (defaults to: false)
  • customini (Any) (defaults to: undef)
  • max_input_vars (Any) (defaults to: '1000')
  • short_open_tag (Any) (defaults to: false)
  • serialize_precision (Any) (defaults to: '17')
  • max_input_time (Any) (defaults to: '60')
  • error_log (Any) (defaults to: $php::params::fpm_error_log_default)
  • session_save_path (Any) (defaults to: $php::params::session_save_path_default)
  • session_gc_probability (Any) (defaults to: '0')
  • use_php_package_prefix_ius (Any) (defaults to: undef)
  • magic_quotes_gpc (Any) (defaults to: undef)
  • magic_quotes_runtime (Any) (defaults to: undef)
  • magic_quotes_sybase (Any) (defaults to: undef)
  • process_max (Any) (defaults to: '0')
  • process_priority (Any) (defaults to: '-19')
  • pidfile (Any) (defaults to: $php::params::fpm_pid)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'manifests/fpm.pp', line 1

class php::fpm (
                  $confbase                   = $php::params::confbase_fpm,
                  #PHP
                  $php_loglevel               = 'notice',
                  $fpm_loglevel               = 'notice',
                  $user                       = $php::params::user,
                  $group                      = $php::params::group,
                  $expose_php                 = false,
                  $max_execution_time         = '5',
                  $memory_limit               = '10M',
                  $upload_max_filesize        = '100M',
                  $post_max_size              = '110M',
                  $timezone                   = 'Europe/Andorra',
                  $allow_url_fopen            = false,
                  $allow_url_include          = false,
                  $customini                  = undef,
                  $max_input_vars             = '1000',
                  $short_open_tag             = false,
                  $serialize_precision        = '17',
                  $max_input_time             = '60',
                  $error_log                  = $php::params::fpm_error_log_default,
                  $session_save_path          = $php::params::session_save_path_default,
                  $session_gc_probability     = '0',
                  $use_php_package_prefix_ius = undef,
                  $magic_quotes_gpc           = undef,
                  $magic_quotes_runtime       = undef,
                  $magic_quotes_sybase        = undef,
                  #FPM
                  $process_max                = '0',
                  $process_priority           = '-19',
                  $pidfile                    = $php::params::fpm_pid,
                ) inherits php::params {

  include ::php

  if($php::use_php_package_prefix_ius==undef)
  {
    $actual_phpfpmpackage=$php::params::phpfpmpackage
  }
  else
  {
    $actual_phpfpmpackage = regsubst($php::params::phpfpmpackage, '^php[0-9.]*', $php::use_php_package_prefix_ius)
  }

  package { $actual_phpfpmpackage:
    ensure  => 'installed',
    require => Class['::php'],
  }

  file { "${confbase}/php-fpm.conf":
    ensure  => 'present',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => template("${module_name}/phpfpmconf.erb"),
    notify  => Service[$php::params::fpm_service_name],
    require => Package[$actual_phpfpmpackage],
  }

  if($customini!=undef)
  {
    file { "${confbase}/${php::params::phpini_fpm}":
      ensure => $customini,
      force  => true,
      notify => Service[$php::params::fpm_service_name],
    }
  }
  else
  {
    file { "${confbase}/${php::params::phpini_fpm}":
      ensure  => 'present',
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => template("${module_name}/phpini.erb"),
      notify  => Service[$php::params::fpm_service_name],
      require => Package[$actual_phpfpmpackage],
    }
  }

  file { "${php::params::confbase_fpm}/${php::params::fpm_pooldir}":
    ensure  => 'directory',
    owner   => 'root',
    group   => 'root',
    mode    => '0755',
    recurse => true,
    purge   => true,
  }

  # [root@centos7 etc]# cat /usr/lib/systemd/system/php-fpm.service
  # [Unit]
  # Description=The PHP FastCGI Process Manager
  # After=syslog.target network.target
  #
  # [Service]
  # Type=notify
  # PIDFile=/run/php-fpm/php-fpm.pid
  # EnvironmentFile=/etc/sysconfig/php-fpm
  # ExecStart=/usr/sbin/php-fpm --nodaemonize
  # ExecReload=/bin/kill -USR2 $MAINPID
  # PrivateTmp=true
  #
  # [Install]
  # WantedBy=multi-user.target
  if($php::params::custom_systemd)
  {

    # Type=notify
    # PIDFile=/run/php-fpm/php-fpm.pid
    # ExecStart=/usr/sbin/php-fpm --nodaemonize
    # ExecReload=/bin/kill -USR2 $MAINPID
    # PrivateTmp=true

    systemd::service { $php::params::fpm_service_name:
      description       => 'The PHP FastCGI Process Manager',
      after_units       => [ 'syslog.target network.target' ],
      type              => 'notify',
      environment_files => [ '-/etc/sysconfig/php-fpm' ],
      execstart         => "/usr/sbin/php-fpm --nodaemonize -c ${confbase}/${php::params::phpini_fpm}",
      execreload        => '/bin/kill -USR2 $MAINPID',
      private_tmp       => true,
      restart_sec       => '2',
      pid_file          => '/run/php-fpm/php-fpm.pid',
    }
  }

  service { $php::params::fpm_service_name:
    ensure  => 'running',
    enable  => true,
    require => [ Class['::systemd'], File[ [ "${confbase}/php-fpm.conf", "${confbase}/${php::params::phpini_fpm}" ] ] ],
  }
}