Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

fpm pool example? I'll document #16

Open
flickerfly opened this issue Jun 17, 2013 · 2 comments
Open

fpm pool example? I'll document #16

flickerfly opened this issue Jun 17, 2013 · 2 comments

Comments

@flickerfly
Copy link

If you could throw an example of an fpm pool config in here, I'll gladly take the time to document it and submit a push request to the Readme. I saw the note at the bottom of the Readme that it is wanted and I want it so maybe we can scratch each other's backs.

@cadorn
Copy link

cadorn commented Jul 19, 2013

+1 Its hard to figure out how to setup an fpm pool. A complete example showing a complete puppet file setup would be good vs just the pp config.

@Tombar
Copy link

Tombar commented Jul 29, 2013

Hope this helps a little at least

#Create default log folder
file { '/var/log/php5' :
  ensure => directory,
  owner  => 'phpuser',
  group  => 'root',
  mode   => '0755'
}

user {
  'phpuser' :
    comment => 'User for PHP Code',
    ensure  => present,
    shell   => "/bin/false",
    uid     => '9000',
    gid     => '9000',
}
group {
  'phpgroup':
    ensure => present,
    gid    => '9000',
}

class { '::php::fpm':
  # fpm_conf_content => template('settings/php-fpm.conf.erb'),
  # fpm_ini_content  => template('settings/php.ini.erb'),
  require          => File['/var/log/php5'],
}

php::fpm::pool { 'default':
  listen               => "/var/run/${title}.socket",
  listen_type          => 'socket',
  user                 => 'phpuser',
  group                => 'phpgroup',
  pm                   => 'dynamic',
  pm_max_children      => 20,
  pm_start_servers     => 7,
  pm_min_spare_servers => 5,
  pm_max_spare_servers => 10,
  pm_max_requests      => 1000,
  pm_status_path       => '/fpm-status',
  access_log           => "/var/log/php5/fpm-pool-${title}.access.log",
  access_log_format    => '%R - %u %t "%m %r%Q%q" %s %f - Time: %{mili}d - Mem Kb: %{kilo}M - CPU: %C%% - Pid: %p',
  php_settings         => [
    'php_admin_flag[display_errors] = off',
    'php_admin_flag[log_errors] = on',
    "php_admin_value[error_log] = /var/log/php5/fpm-pool-${title}.error.log",
    "php_admin_value[memory_limit] = ${memory_limit}",
    "php_admin_value[date.timezone] = ${time_zone}"
  ],
  require              => [ User['phpuser'], Group['phpgroup'] ]
}

# Php 5.4 does not suppoprt suhosin anymore, make sure they no longer exist
package { ['php-suhosin', 'php5-suhosin'] :
  ensure => purged
}

# Default php modules for every webserver
php::module { 'curl':
  require => Package['php5-fpm'],
  notify  => Class['php::fpm::service'],
  source  => '/etc/php5/mods-available/curl.ini'
}
php::module { 'gd':
  require => Package['php5-fpm'],
  notify  => Class['php::fpm::service'],
  source  => '/etc/php5/mods-available/gd.ini'
}
php::module { 'mcrypt':
  require => Package['php5-fpm'],
  notify  => Class['php::fpm::service'],
  source  => '/etc/php5/mods-available/mcrypt.ini'
}
php::module { 'mysql':
  require => Package['php5-fpm'],
  notify  => Class['php::fpm::service'],
  source  => '/etc/php5/mods-available/mysql.ini'
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants