Remove the adjust service action script

Instead makes sure there's no socket conflict by simply prepending the PHP version to the socket name
tags/0.0.1_0.fc26_el5
Daniel Berteaud 7 years ago
parent bd62c565c0
commit c1450e94f7
  1. 8
      createlinks
  2. 37
      root/etc/e-smith/events/actions/adjust-php-fpm-services
  3. 3
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig
  4. 23
      root/etc/e-smith/templates/etc/php-fpm.d/shares.conf/10Shares

@ -7,6 +7,9 @@ foreach my $service (qw(php-fpm php56-php-fpm php70-php-fpm php71-php-fpm)){
service_link_enhanced($service, "K16", "6"); service_link_enhanced($service, "K16", "6");
service_link_enhanced($service, "K16", "0"); service_link_enhanced($service, "K16", "0");
service_link_enhanced($service, "K16", "1"); service_link_enhanced($service, "K16", "1");
foreach my $event qw(webapps-update){
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/$service");
}
} }
foreach my $file qw( /etc/php-fpm.conf foreach my $file qw( /etc/php-fpm.conf
@ -37,8 +40,3 @@ event_link("php-pool-dirs", "share-modify", "90");
event_link("php-pool-dirs", "share-modify-server", "90"); event_link("php-pool-dirs", "share-modify-server", "90");
event_link("php-pool-dirs", "share-delete", "90"); event_link("php-pool-dirs", "share-delete", "90");
event_link("adjust-php-fpm-services", "share-create", "98");
event_link("adjust-php-fpm-services", "share-modify", "98");
event_link("adjust-php-fpm-services", "share-modify-server", "98");
event_link("adjust-php-fpm-services", "share-delete", "98");
event_link("adjust-php-fpm-services", "webapps-update", "98");

@ -1,37 +0,0 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use esmith::ConfigDB;
use esmith::util;
my $c = esmith::ConfigDB->open_ro || die "Couldn't open the configuration database\n";
my @fpms = qw(
php-fpm
php56-php-fpm
php70-php-fpm
php71-php-fpm
);
# We need to ensure every versions are stopped, and only then start them all again
# so if we move a pool from one version to another, we won't have a socket conflict
foreach my $fpm (@fpms){
esmith::util::serviceControl(
NAME => $fpm,
ACTION => 'stop',
BACKGROUND => 'false')
or warn "Unable to stop $fpm\n";
}
foreach my $fpm (@fpms){
my $service = $c->get($fpm);
if ($service && ($service->prop('status') || 'disabled') eq 'enabled'){
esmith::util::serviceControl(
NAME => $fpm,
ACTION => 'start',
BACKGROUND => 'false')
or die "Unable to start $fpm\n";
}
}

@ -36,10 +36,11 @@ _EOF
foreach my $share ($a->get_all_by_prop(type => 'share')){ foreach my $share ($a->get_all_by_prop(type => 'share')){
next if ($share->prop('DynamicContent' || 'disabled') ne 'enabled'); next if ($share->prop('DynamicContent' || 'disabled') ne 'enabled');
my $key = $share->key; my $key = $share->key;
my $ver = $share->prop('PHPVersion') || '';
$OUT .=<<_EOF; $OUT .=<<_EOF;
Action php$key-fastcgi /php-cgi-bin/php$key-wrapper Action php$key-fastcgi /php-cgi-bin/php$key-wrapper
Alias /php-cgi-bin/php$key-wrapper /var/www/php-cgi-bin/php$key-wrapper Alias /php-cgi-bin/php$key-wrapper /var/www/php-cgi-bin/php$key-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php$key-wrapper -socket /var/run/php-fpm/php$key.sock -pass-header Authorization -idle-timeout 120 FastCgiExternalServer /var/www/php-cgi-bin/php$key-wrapper -socket /var/run/php-fpm/php$ver-$key.sock -pass-header Authorization -idle-timeout 120
_EOF _EOF
} }
} }

@ -4,8 +4,10 @@ use esmith::AccountsDB;
my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database"; my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database";
foreach my $share ($a->get_all_by_prop(type => 'share')){ foreach my $share ($a->get_all_by_prop(type => 'share')){
my $pool_name = $share->key;
next if (($share->prop('DynamicContent') || 'disabled') ne 'enabled'); next if (($share->prop('DynamicContent') || 'disabled') ne 'enabled');
my $version = $share->prop('PHPVersion') || '';
my $key = $share->key;
my $pool_name = 'php' . $version . '-' . $key;
my $memory_limit = $share->prop('PHPMemoryLimit') || '128M'; my $memory_limit = $share->prop('PHPMemoryLimit') || '128M';
my $max_execution_time = $share->prop('PHPMaxExecutionTime') || '30'; my $max_execution_time = $share->prop('PHPMaxExecutionTime') || '30';
my $max_input_time = $share->prop('PHPMaxInputTime') || '60'; my $max_input_time = $share->prop('PHPMaxInputTime') || '60';
@ -13,8 +15,8 @@ foreach my $share ($a->get_all_by_prop(type => 'share')){
my $post_max_size = $share->prop('PHPPostMaxSize') || '10M'; my $post_max_size = $share->prop('PHPPostMaxSize') || '10M';
my $upload_max_filesize = $share->prop('PHPUploadMaxFilesize') || '10M'; my $upload_max_filesize = $share->prop('PHPUploadMaxFilesize') || '10M';
my $file_upload = $share->prop('PHPFileUpload') || 'enabled'; my $file_upload = $share->prop('PHPFileUpload') || 'enabled';
my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $pool_name . my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $key .
':/var/lib/php/' . $pool_name; ':/var/lib/php/' . $key;
my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' . my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' .
'symlink,exec,dl,shell_exec,' . 'symlink,exec,dl,shell_exec,' .
'passthru,phpinfo,' . 'passthru,phpinfo,' .
@ -23,9 +25,8 @@ foreach my $share ($a->get_all_by_prop(type => 'share')){
$file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off'; $file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off'; $allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$disabled_functions = join(', ', split /[,;:]/, $disabled_functions); $disabled_functions = join(', ', split /[,;:]/, $disabled_functions);
my $version = $share->prop('PHPVersion') || 'default';
$OUT .=<<"_EOF" if ($version eq $PHP_VERSION or ($PHP_VERSION eq '' && $version eq 'default')); $OUT .=<<"_EOF" if ($version eq $PHP_VERSION);
[$pool_name] [$pool_name]
user = www user = www
@ -41,12 +42,12 @@ pm.min_spare_servers = 3
pm.max_spare_servers = 4 pm.max_spare_servers = 4
pm.max_requests = 5000 pm.max_requests = 5000
request_terminate_timeout = 30 request_terminate_timeout = 30
slowlog = /var/log/php/$pool_name/slow.log slowlog = /var/log/php/$key/slow.log
php_admin_value[session.save_path] = /var/lib/php/$pool_name/session php_admin_value[session.save_path] = /var/lib/php/$key/session
php_admin_value[soap.wsdl_cache_dir] = /var/lib/php/$pool_name/wsdlcache php_admin_value[soap.wsdl_cache_dir] = /var/lib/php/$key/wsdlcache
php_admin_value[opcache.file_cache] = /var/lib/php/$pool_name/opcache php_admin_value[opcache.file_cache] = /var/lib/php/$key/opcache
php_admin_value[upload_tmp_dir] = /var/lib/php/$pool_name/tmp php_admin_value[upload_tmp_dir] = /var/lib/php/$key/tmp
php_admin_value[error_log] = /var/log/php/$pool_name/error.log php_admin_value[error_log] = /var/log/php/$key/error.log
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName } php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
php_admin_flag[display_errors] = off php_admin_flag[display_errors] = off
php_admin_flag[log_errors] = on php_admin_flag[log_errors] = on

Loading…
Cancel
Save