From b7e2a723691bc92c701bc5c55a19d1ab874d7647 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Sat, 5 Sep 2020 23:43:28 +0200 Subject: [PATCH] Add missing changes for mediawiki upgrades --- Berksfile | 10 +- Berksfile.lock | 17 +- cookbooks/composer/README.md | 2 +- cookbooks/composer/attributes/default.rb | 3 +- cookbooks/composer/metadata.json | 23 +- cookbooks/composer/metadata.rb | 5 +- .../composer/providers/install_global.rb | 3 - cookbooks/composer/providers/project.rb | 3 - cookbooks/composer/recipes/install.rb | 4 +- cookbooks/composer/recipes/self_update.rb | 8 +- .../composer/resources/install_global.rb | 5 - cookbooks/composer/resources/project.rb | 5 - cookbooks/mediawiki/metadata.json | 3 +- cookbooks/mediawiki/metadata.rb | 1 - cookbooks/mediawiki/recipes/nginx.rb | 21 +- cookbooks/mysql/.foodcritic | 1 - cookbooks/mysql/CHANGELOG.md | 318 +++-- cookbooks/mysql/CONTRIBUTING.md | 4 +- cookbooks/mysql/README.md | 83 +- cookbooks/mysql/libraries/helpers.rb | 73 +- cookbooks/mysql/libraries/matchers.rb | 71 -- cookbooks/mysql/libraries/mysql_base.rb | 3 - .../mysql_client_installation_package.rb | 5 +- cookbooks/mysql/libraries/mysql_config.rb | 3 +- .../mysql_server_installation_package.rb | 5 +- cookbooks/mysql/libraries/mysql_service.rb | 5 +- .../mysql/libraries/mysql_service_base.rb | 41 +- .../mysql_service_manager_systemd.rb | 5 +- .../mysql_service_manager_sysvinit.rb | 1 + .../mysql_service_manager_upstart.rb | 1 + cookbooks/mysql/metadata.json | 2 +- .../apparmor/usr.sbin.mysqld-instance.erb | 1 + .../default/apparmor/usr.sbin.mysqld.erb | 47 - .../default/systemd/mysqld.service.erb | 9 +- cookbooks/php-fpm/.foodcritic | 1 - cookbooks/php-fpm/README.md | 142 --- cookbooks/php-fpm/attributes/default.rb | 71 -- cookbooks/php-fpm/definitions/php_fpm_pool.rb | 65 - cookbooks/php-fpm/metadata.json | 1 - cookbooks/php-fpm/recipes/configure.rb | 43 - cookbooks/php-fpm/recipes/default.rb | 22 - cookbooks/php-fpm/recipes/install.rb | 59 - cookbooks/php-fpm/recipes/repository.rb | 54 - cookbooks/php-fpm/recipes/test.rb | 3 - cookbooks/php-fpm/templates/php-fpm.conf.erb | 60 - cookbooks/php-fpm/templates/pool.conf.erb | 424 ------- cookbooks/php/CHANGELOG.md | 38 +- cookbooks/php/CONTRIBUTING.md | 4 +- cookbooks/php/README.md | 228 +--- cookbooks/php/attributes/default.rb | 156 ++- cookbooks/php/metadata.json | 2 +- cookbooks/php/recipes/ini.rb | 20 + cookbooks/php/recipes/package.rb | 12 +- cookbooks/php/recipes/recompile.rb | 32 +- cookbooks/php/recipes/source.rb | 68 +- cookbooks/php/resources/pear.rb | 28 +- cookbooks/php/resources/pear_channel.rb | 3 - .../php/templates/default/extension.ini.erb | 3 + cookbooks/php/templates/default/php.ini.erb | 1077 +++++++++-------- nodes/wiki-1.json | 16 +- .../kosmos-mediawiki/recipes/default.rb | 8 +- 61 files changed, 1179 insertions(+), 2252 deletions(-) delete mode 100644 cookbooks/mysql/.foodcritic delete mode 100644 cookbooks/mysql/libraries/matchers.rb delete mode 100644 cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld.erb delete mode 100644 cookbooks/php-fpm/.foodcritic delete mode 100644 cookbooks/php-fpm/README.md delete mode 100644 cookbooks/php-fpm/attributes/default.rb delete mode 100644 cookbooks/php-fpm/definitions/php_fpm_pool.rb delete mode 100644 cookbooks/php-fpm/metadata.json delete mode 100644 cookbooks/php-fpm/recipes/configure.rb delete mode 100644 cookbooks/php-fpm/recipes/default.rb delete mode 100644 cookbooks/php-fpm/recipes/install.rb delete mode 100644 cookbooks/php-fpm/recipes/repository.rb delete mode 100644 cookbooks/php-fpm/recipes/test.rb delete mode 100644 cookbooks/php-fpm/templates/php-fpm.conf.erb delete mode 100644 cookbooks/php-fpm/templates/pool.conf.erb diff --git a/Berksfile b/Berksfile index 1db64f4..5420a3a 100644 --- a/Berksfile +++ b/Berksfile @@ -9,8 +9,8 @@ cookbook 'redis', git: 'https://github.com/phlipper/chef-redis.git', ref: 'v0.5.6' cookbook 'postfix', '= 5.0.2' -cookbook 'php', '~> 6.1.1' -cookbook 'composer', '~> 2.6.1' +cookbook 'php', '~> 8.0.0' +cookbook 'composer', '~> 2.7.0' cookbook 'poise-ruby-build', '~> 1.1.0' cookbook 'application', '~> 5.2.0' cookbook 'application_javascript', '~> 1.0.0' @@ -28,15 +28,15 @@ cookbook 'nginx', '= 9.0.0' # Remove when cookbooks stop depending on it, the build_essential resource is # part of Chef 14 (https://docs.chef.io/resource_build_essential.html) cookbook 'build-essential', '~> 8.2.1' -cookbook 'mysql', '~> 8.5.1' +cookbook 'mysql', '~> 8.7.3' # cookbook 'postgresql', '= 7.1.8' cookbook 'apt', '~> 7.3.0' -cookbook 'git', '>= 6.0.0' +cookbook 'git', '~> 10.0.0' cookbook 'hostsfile', '= 2.4.5' cookbook 'ohai', '~> 5.2.5' cookbook 'nodejs', '~> 5.0.0' cookbook 'timezone_iii', '= 1.0.4' -cookbook 'ark', '>= 3.1.0' +cookbook 'ark', '>= 5.0.0' cookbook 'logrotate', '= 2.2.0' cookbook 'openssl', '~> 8.5.5' cookbook 'ntp', '= 3.4.0' diff --git a/Berksfile.lock b/Berksfile.lock index cfefcac..590945a 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -4,14 +4,14 @@ DEPENDENCIES application_git (= 1.1.0) application_javascript (~> 1.0.0) apt (~> 7.3.0) - ark (>= 3.1.0) + ark (>= 5.0.0) build-essential (~> 8.2.1) chef-sugar (= 3.3.0) compat_resource (= 12.19.0) - composer (~> 2.6.1) + composer (~> 2.7.0) elasticsearch (= 4.2.0) firewall (~> 2.6.3) - git (>= 6.0.0) + git (~> 10.0.0) golang (~> 4.1.0) homebrew (= 3.0.0) hostname (= 0.4.2) @@ -27,13 +27,13 @@ DEPENDENCIES git: https://github.com/67P/mediawiki-cookbook.git revision: 78641e53635ba6cbd4a2a51fd597adb8fef1e8ad ref: nginx - mysql (~> 8.5.1) + mysql (~> 8.7.3) nginx (= 9.0.0) nodejs (~> 5.0.0) ntp (= 3.4.0) ohai (~> 5.2.5) openssl (~> 8.5.5) - php (~> 6.1.1) + php (~> 8.0.0) poise (~> 2.8.2) poise-archive (~> 1.5.0) poise-javascript @@ -74,7 +74,7 @@ GRAPH seven_zip (>= 0.0.0) chef-sugar (3.3.0) compat_resource (12.19.0) - composer (2.6.1) + composer (2.7.0) apt (>= 0.0.0) php (>= 0.0.0) windows (>= 0.0.0) @@ -108,7 +108,7 @@ GRAPH php (>= 0.0.0) mingw (2.1.0) seven_zip (>= 0.0.0) - mysql (8.5.1) + mysql (8.7.3) nginx (9.0.0) build-essential (>= 5.0) ohai (>= 4.1.0) @@ -119,8 +119,7 @@ GRAPH ntp (3.4.0) ohai (5.2.5) openssl (8.5.5) - php (6.1.1) - build-essential (>= 5.0) + php (8.0.0) yum-epel (>= 0.0.0) poise (2.8.2) poise-archive (1.5.0) diff --git a/cookbooks/composer/README.md b/cookbooks/composer/README.md index d41686e..97c9268 100644 --- a/cookbooks/composer/README.md +++ b/cookbooks/composer/README.md @@ -159,7 +159,7 @@ end ## License and Authors Author: David Joos -Copyright: 2016, David Joos +Copyright: 2016-2017, David Joos Author: David Joos Author: Escape Studios Development diff --git a/cookbooks/composer/attributes/default.rb b/cookbooks/composer/attributes/default.rb index bb99dca..9465e01 100644 --- a/cookbooks/composer/attributes/default.rb +++ b/cookbooks/composer/attributes/default.rb @@ -14,7 +14,7 @@ if node['platform'] == 'windows' default['composer']['global_install']['install_dir'] = 'C:\\Program\ Files\\Composer' default['composer']['global_install']['bin_dir'] = 'C:\\ProgramData\\Composer' else - default['composer']['url'] = 'http://getcomposer.org/composer.phar' + default['composer']['url'] = 'http://getcomposer.org/composer-stable.phar' default['composer']['install_dir'] = '/usr/local/bin' default['composer']['bin'] = "#{node['composer']['install_dir']}/composer" default['composer']['install_globally'] = true @@ -27,3 +27,4 @@ end default['composer']['global_configs'] = {} default['composer']['home_dir'] = nil default['composer']['php_recipe'] = 'php::default' +default['composer']['self_update_channel'] = nil diff --git a/cookbooks/composer/metadata.json b/cookbooks/composer/metadata.json index d86a891..c552bd0 100644 --- a/cookbooks/composer/metadata.json +++ b/cookbooks/composer/metadata.json @@ -1,7 +1,7 @@ { "name": "composer", "description": "Installs/Configures Composer", - "long_description": "[![Build Status](https://travis-ci.org/djoos-cookbooks/composer.png)](https://travis-ci.org/djoos-cookbooks/composer)\n\n# composer cookbook\n\n## Description\n\nThis cookbook provides an easy way to install Composer, a dependency manager for PHP.\n\nMore information?\nhttp://getcomposer.org/\n\n## Requirements\n\n### Cookbooks:\n\n* php\n* windows\n\n### Platforms:\n\n* Ubuntu\n* Debian\n* RHEL\n* CentOS\n* Fedora\n* Windows\n\n## Attributes\n\n* `node['composer']['url']` - Location of the source\n* `node['composer']['install_dir']` - Installation target directory (absolute or relative path) if installing locally\n* `node['composer']['bin']` - bin directory\n* `node['composer']['install_globally']` - Installation method, ':source' or ':package' - default true\n* `node['composer']['mask']` - Mask for composer.phar - 0755\n* `node['composer']['link_type']` - link type for composer.phar link - default :symbolic\n* `node['composer']['global_configs']` - Hash with global config options for users, eg. { \"userX\" => { \"github-oauth\" => { \"github.com\" => \"userX_oauth_token\" }, \"vendor-dir\" => \"myvendordir\" } } - default {}\n* `node['composer']['home_dir']` - COMPOSER_HOME, defaults to nil (in which case install_dir will be used), please do read the [Composer documentation on COMPOSER_HOME](https://getcomposer.org/doc/03-cli.md#composer-home) when setting a custom home_dir\n* `node['composer']['php_recipe']` - The php recipe to include, defaults to \"php::default\"\n* `node['composer']['global_install']['install_dir']` - The default location to install the packages in for composer_install_global\n* `node['composer']['global_install']['bin_dir']` - The default location to symlink the binaries when using composer_install_global\n\n## Resources / Providers\nThis cookbook includes an LWRP for managing a Composer project and one for a global installation of composer packages\n\n### `composer_project`\n\n#### Actions\n- :install: Reads the composer.json file from the current directory, resolves the dependencies, and installs them into project directory - this is the default action\n- :require Create composer.json file using specified package and version and installs it with the dependencies.\n- :update: Gets the latest versions of the dependencies and updates the composer.lock file\n- :dump_autoload: Updates the autoloader without having to go through an install or update (eg. because of new classes in a classmap package)\n- :remove Removes package from composer.json and uninstalls it\n\n#### Attribute parameters\n- project_dir: The directory where your project's composer.json can be found (name attribute)\n- package: The package to require or remove when using those actions\n- version: The version of the package to require or remove when using those actions, default *.*.* Be careful when uninstalling, the version has to match the installed package!\n- vendor: Can be used to combine package and version, deprecated!\n- dev: Install packages listed in require-dev, default false\n- quiet: Do not output any message, default true\n- optimize_autoloader: Optimize PSR0 packages to use classmaps, default false\n- prefer_dist: use the dist installation method\n- prefer_source: use the source installation method\n- bin_dir, overwrites the composer bin dir\n- user: the user to use when executing the composer commands\n- group: the group to use when executing the composer commands\n- umask: the umask to use when executing the composer commands\n- environment: A hash of environment variables that will be available when running composer\n\n#### Examples\n```\n# Install the project dependencies\ncomposer_project \"/path/to/project\" do\n dev false\n quiet true\n prefer_dist false\n action :install\nend\n\n# Require the package in the project dir\ncomposer_project \"/path/to/project\" do\n package 'vendor/package'\n version '*.*.*'\n dev false\n quiet true\n prefer_dist false\n action :require\nend\n\n# Update the project dependencies\ncomposer_project \"/path/to/project\" do\n dev false\n quiet true\n action :update\nend\n\n# Dump-autoload in the project dir\ncomposer_project \"/path/to/project\" do\n dev false\n quiet true\n action :dump_autoload\nend\n\n# Remove the package in the project dir\ncomposer_project \"/path/to/project\" do\n package 'vendor/package'\n action :remove\nend\n```\n\n### `composer_install_global`\n\n#### Actions\n- :install: Installs the package in the preferred global composer directory, putting binary symlinks in the preferred global binary directory (see attributes)\n- :update: Gets the latest versions of the dependencies and updates the composer.lock file for the globally installed composer packages\n- :remove Removes package from the global composer.json and uninstalls it\n\n#### Attribute parameters\n- package: The package to install or remove, name_attribute\n- version: The version of the package to install or remove when using those actions, default *.*.* Be careful when uninstalling, the version has to match the installed package!\n- install_dir: the directory in which to make the global installation, default: see the attributes\n- bin_dir: the directory in which to make the symlinks to the binaries, default: see the attributes\n- dev: Install packages listed in require-dev, default false\n- quiet: Do not output any message, default true\n- optimize_autoloader: Optimize PSR0 packages to use classmaps, default false\n- prefer_dist: use the dist installation method\n- prefer_source: use the source installation method\n\n#### Examples\n```\n# Install a package globally\ncomposer_install_global \"package\" do\n version '~4.1'\n action :install\nend\n\n# Update the package\ncomposer_install_global \"package\" do\n action :update\nend\n\n# Remove the package from the global installation\ncomposer_install_global \"package\" do\n action :remove\nend\n```\n\n## Usage\n\n1. include `recipe[composer]` in a run list\n2. tweak the attributes via attributes/default.rb\n--- OR ---\n[override the attribute on a higher level](http://wiki.opscode.com/display/chef/Attributes#Attributes-AttributesPrecedence)\n\n## References\n\n* [Composer home page] (http://getcomposer.org/)\n\n## License and Authors\n\nAuthor: David Joos \nCopyright: 2016, David Joos\n\nAuthor: David Joos \nAuthor: Escape Studios Development \nCopyright: 2012-2015, Escape Studios\n\nUnless otherwise noted, all files are released under the MIT license,\npossible exceptions will contain licensing information in them.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n", + "long_description": "[![Build Status](https://travis-ci.org/djoos-cookbooks/composer.png)](https://travis-ci.org/djoos-cookbooks/composer)\n\n# composer cookbook\n\n## Description\n\nThis cookbook provides an easy way to install Composer, a dependency manager for PHP.\n\nMore information?\nhttp://getcomposer.org/\n\n## Requirements\n\n### Cookbooks:\n\n* php\n* windows\n\n### Platforms:\n\n* Ubuntu\n* Debian\n* RHEL\n* CentOS\n* Fedora\n* Windows\n\n## Attributes\n\n* `node['composer']['url']` - Location of the source\n* `node['composer']['install_dir']` - Installation target directory (absolute or relative path) if installing locally\n* `node['composer']['bin']` - bin directory\n* `node['composer']['install_globally']` - Installation method, ':source' or ':package' - default true\n* `node['composer']['mask']` - Mask for composer.phar - 0755\n* `node['composer']['link_type']` - link type for composer.phar link - default :symbolic\n* `node['composer']['global_configs']` - Hash with global config options for users, eg. { \"userX\" => { \"github-oauth\" => { \"github.com\" => \"userX_oauth_token\" }, \"vendor-dir\" => \"myvendordir\" } } - default {}\n* `node['composer']['home_dir']` - COMPOSER_HOME, defaults to nil (in which case install_dir will be used), please do read the [Composer documentation on COMPOSER_HOME](https://getcomposer.org/doc/03-cli.md#composer-home) when setting a custom home_dir\n* `node['composer']['php_recipe']` - The php recipe to include, defaults to \"php::default\"\n* `node['composer']['global_install']['install_dir']` - The default location to install the packages in for composer_install_global\n* `node['composer']['global_install']['bin_dir']` - The default location to symlink the binaries when using composer_install_global\n\n## Resources / Providers\nThis cookbook includes an LWRP for managing a Composer project and one for a global installation of composer packages\n\n### `composer_project`\n\n#### Actions\n- :install: Reads the composer.json file from the current directory, resolves the dependencies, and installs them into project directory - this is the default action\n- :require Create composer.json file using specified package and version and installs it with the dependencies.\n- :update: Gets the latest versions of the dependencies and updates the composer.lock file\n- :dump_autoload: Updates the autoloader without having to go through an install or update (eg. because of new classes in a classmap package)\n- :remove Removes package from composer.json and uninstalls it\n\n#### Attribute parameters\n- project_dir: The directory where your project's composer.json can be found (name attribute)\n- package: The package to require or remove when using those actions\n- version: The version of the package to require or remove when using those actions, default *.*.* Be careful when uninstalling, the version has to match the installed package!\n- vendor: Can be used to combine package and version, deprecated!\n- dev: Install packages listed in require-dev, default false\n- quiet: Do not output any message, default true\n- optimize_autoloader: Optimize PSR0 packages to use classmaps, default false\n- prefer_dist: use the dist installation method\n- prefer_source: use the source installation method\n- bin_dir, overwrites the composer bin dir\n- user: the user to use when executing the composer commands\n- group: the group to use when executing the composer commands\n- umask: the umask to use when executing the composer commands\n- environment: A hash of environment variables that will be available when running composer\n\n#### Examples\n```\n# Install the project dependencies\ncomposer_project \"/path/to/project\" do\n dev false\n quiet true\n prefer_dist false\n action :install\nend\n\n# Require the package in the project dir\ncomposer_project \"/path/to/project\" do\n package 'vendor/package'\n version '*.*.*'\n dev false\n quiet true\n prefer_dist false\n action :require\nend\n\n# Update the project dependencies\ncomposer_project \"/path/to/project\" do\n dev false\n quiet true\n action :update\nend\n\n# Dump-autoload in the project dir\ncomposer_project \"/path/to/project\" do\n dev false\n quiet true\n action :dump_autoload\nend\n\n# Remove the package in the project dir\ncomposer_project \"/path/to/project\" do\n package 'vendor/package'\n action :remove\nend\n```\n\n### `composer_install_global`\n\n#### Actions\n- :install: Installs the package in the preferred global composer directory, putting binary symlinks in the preferred global binary directory (see attributes)\n- :update: Gets the latest versions of the dependencies and updates the composer.lock file for the globally installed composer packages\n- :remove Removes package from the global composer.json and uninstalls it\n\n#### Attribute parameters\n- package: The package to install or remove, name_attribute\n- version: The version of the package to install or remove when using those actions, default *.*.* Be careful when uninstalling, the version has to match the installed package!\n- install_dir: the directory in which to make the global installation, default: see the attributes\n- bin_dir: the directory in which to make the symlinks to the binaries, default: see the attributes\n- dev: Install packages listed in require-dev, default false\n- quiet: Do not output any message, default true\n- optimize_autoloader: Optimize PSR0 packages to use classmaps, default false\n- prefer_dist: use the dist installation method\n- prefer_source: use the source installation method\n\n#### Examples\n```\n# Install a package globally\ncomposer_install_global \"package\" do\n version '~4.1'\n action :install\nend\n\n# Update the package\ncomposer_install_global \"package\" do\n action :update\nend\n\n# Remove the package from the global installation\ncomposer_install_global \"package\" do\n action :remove\nend\n```\n\n## Usage\n\n1. include `recipe[composer]` in a run list\n2. tweak the attributes via attributes/default.rb\n--- OR ---\n[override the attribute on a higher level](http://wiki.opscode.com/display/chef/Attributes#Attributes-AttributesPrecedence)\n\n## References\n\n* [Composer home page] (http://getcomposer.org/)\n\n## License and Authors\n\nAuthor: David Joos \nCopyright: 2016-2017, David Joos\n\nAuthor: David Joos \nAuthor: Escape Studios Development \nCopyright: 2012-2015, Escape Studios\n\nUnless otherwise noted, all files are released under the MIT license,\npossible exceptions will contain licensing information in them.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n", "maintainer": "David Joos", "maintainer_email": "development@davidjoos.com", "license": "MIT", @@ -19,27 +19,12 @@ "apt": ">= 0.0.0", "php": ">= 0.0.0", "windows": ">= 0.0.0" - }, - "recommendations": { - - }, - "suggestions": { - - }, - "conflicting": { - }, "providing": { - }, - "replacing": { - }, "attributes": { - }, - "groupings": { - }, "recipes": { "composer": "Installs (if applicable) and self-updates composer.", @@ -47,12 +32,14 @@ "composer::self_update": "Installs (if applicable) and self-updates composer.", "composer::global_configs": "Sets up global config options via `composer config --global`" }, - "version": "2.6.1", + "version": "2.7.0", "source_url": "https://github.com/djoos-cookbooks/composer", "issues_url": "https://github.com/djoos-cookbooks/composer/issues", "privacy": false, "chef_versions": [ - + [ + ">= 0.10.0" + ] ], "ohai_versions": [ diff --git a/cookbooks/composer/metadata.rb b/cookbooks/composer/metadata.rb index 4cc7da0..aae5776 100644 --- a/cookbooks/composer/metadata.rb +++ b/cookbooks/composer/metadata.rb @@ -4,9 +4,10 @@ maintainer_email 'development@davidjoos.com' license 'MIT' description 'Installs/Configures Composer' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.6.1' +version '2.7.0' +chef_version '>= 0.10.0' if respond_to?(:chef_version) -%w(debian ubuntu redhat centos fedora scientific amazon windows).each do |os| +%w[debian ubuntu redhat centos fedora scientific amazon windows].each do |os| supports os end diff --git a/cookbooks/composer/providers/install_global.rb b/cookbooks/composer/providers/install_global.rb index 8022a64..99dfbfb 100644 --- a/cookbooks/composer/providers/install_global.rb +++ b/cookbooks/composer/providers/install_global.rb @@ -13,17 +13,14 @@ end action :install do install_global_install - new_resource.updated_by_last_action(true) end action :remove do install_global_remove - new_resource.updated_by_last_action(true) end action :update do install_global_update - new_resource.updated_by_last_action(true) end def install_global_install diff --git a/cookbooks/composer/providers/project.rb b/cookbooks/composer/providers/project.rb index 11064ad..35b421d 100644 --- a/cookbooks/composer/providers/project.rb +++ b/cookbooks/composer/providers/project.rb @@ -13,7 +13,6 @@ end action :install do make_execute 'install' - new_resource.updated_by_last_action(true) end action :require do @@ -22,12 +21,10 @@ end action :update do make_execute 'update' - new_resource.updated_by_last_action(true) end action :dump_autoload do make_execute 'dump-autoload' - new_resource.updated_by_last_action(true) end action :remove do diff --git a/cookbooks/composer/recipes/install.rb b/cookbooks/composer/recipes/install.rb index 477b418..3a2f9e2 100755 --- a/cookbooks/composer/recipes/install.rb +++ b/cookbooks/composer/recipes/install.rb @@ -10,9 +10,9 @@ include_recipe node['composer']['php_recipe'] if node['platform'] == 'windows' windows_package 'Composer - PHP Dependency Manager' do source node['composer']['url'] - options %w( + options %w[ /VERYSILENT - ).join(' ') + ].join(' ') end install_dir = "#{node['composer']['install_dir'].tr('/', '\\')}\\bin" diff --git a/cookbooks/composer/recipes/self_update.rb b/cookbooks/composer/recipes/self_update.rb index 25d1bc1..6cf1058 100644 --- a/cookbooks/composer/recipes/self_update.rb +++ b/cookbooks/composer/recipes/self_update.rb @@ -7,9 +7,15 @@ include_recipe 'composer::install' +channel = if node['composer']['self_update_channel'].nil? + '' + else + " --#{node['composer']['self_update_channel']}" + end + execute 'composer-self_update' do cwd node['composer']['install_dir'] - command 'composer self-update' + command 'composer self-update' + channel environment 'COMPOSER_HOME' => Composer.home_dir(node) action :run ignore_failure true diff --git a/cookbooks/composer/resources/install_global.rb b/cookbooks/composer/resources/install_global.rb index 93f259d..a595251 100644 --- a/cookbooks/composer/resources/install_global.rb +++ b/cookbooks/composer/resources/install_global.rb @@ -17,8 +17,3 @@ attribute :quiet, :kind_of => [TrueClass, FalseClass], :default => true attribute :optimize_autoloader, :kind_of => [TrueClass, FalseClass], :default => false attribute :prefer_dist, :kind_of => [TrueClass, FalseClass], :default => false attribute :prefer_source, :kind_of => [TrueClass, FalseClass], :default => false - -def initialize(*args) - super - @action = :install -end diff --git a/cookbooks/composer/resources/project.rb b/cookbooks/composer/resources/project.rb index 1780ef2..93ebca5 100644 --- a/cookbooks/composer/resources/project.rb +++ b/cookbooks/composer/resources/project.rb @@ -22,8 +22,3 @@ attribute :user, :kind_of => String, :default => 'root' attribute :group, :kind_of => String, :default => 'root' attribute :umask, :kind_of => [String, Integer], :default => '0002' attribute :environment, :kind_of => Hash, :default => {} - -def initialize(*args) - super - @action = :install -end diff --git a/cookbooks/mediawiki/metadata.json b/cookbooks/mediawiki/metadata.json index 6e73805..9998b8b 100644 --- a/cookbooks/mediawiki/metadata.json +++ b/cookbooks/mediawiki/metadata.json @@ -12,8 +12,7 @@ "dependencies": { "apache2": ">= 0.0.0", "php": ">= 0.0.0", - "nginx": ">= 0.0.0", - "php-fpm": ">= 0.0.0" + "nginx": ">= 0.0.0" }, "providing": { diff --git a/cookbooks/mediawiki/metadata.rb b/cookbooks/mediawiki/metadata.rb index 4dbc567..2861c3c 100644 --- a/cookbooks/mediawiki/metadata.rb +++ b/cookbooks/mediawiki/metadata.rb @@ -8,7 +8,6 @@ version '0.5.0' depends 'apache2' depends 'php' depends 'nginx' -depends 'php-fpm' attribute 'mediawiki/version', :display_name => "Mediawiki version", diff --git a/cookbooks/mediawiki/recipes/nginx.rb b/cookbooks/mediawiki/recipes/nginx.rb index 30c1fb8..6fe3eaa 100644 --- a/cookbooks/mediawiki/recipes/nginx.rb +++ b/cookbooks/mediawiki/recipes/nginx.rb @@ -3,30 +3,11 @@ # Recipe:: nginx # -node.default['php-fpm']['pools'] = [] -node.override['php-fpm']['package_name'] = "php-fpm" -node.override['php-fpm']['service_name'] = "php7.2-fpm" -node.override['php-fpm']['conf_dir'] = "/etc/php/7.2/fpm/conf.d" -node.override['php-fpm']['pool_conf_dir'] = "/etc/php/7.2/fpm/pool.d" -node.override['php-fpm']['conf_file'] = "/etc/php/7.2/fpm/php-fpm.conf" - -include_recipe "php-fpm" -include_recipe 'php-fpm::repository' unless node['php-fpm']['skip_repository_install'] -include_recipe "php-fpm::install" - -php_fpm_pool "www" do - enable false -end - php_fpm_pool "mediawiki" do listen "127.0.0.1:9002" user node['nginx']['user'] group node['nginx']['group'] - listen_owner node['nginx']['user'] - listen_group node['nginx']['group'] - php_options node['mediawiki']['php_options'] - start_servers 5 - enable true + additional_config node['mediawiki']['php_options'] end include_recipe "nginx" diff --git a/cookbooks/mysql/.foodcritic b/cookbooks/mysql/.foodcritic deleted file mode 100644 index 913f038..0000000 --- a/cookbooks/mysql/.foodcritic +++ /dev/null @@ -1 +0,0 @@ -~FC005 diff --git a/cookbooks/mysql/CHANGELOG.md b/cookbooks/mysql/CHANGELOG.md index 92291b9..2296313 100644 --- a/cookbooks/mysql/CHANGELOG.md +++ b/cookbooks/mysql/CHANGELOG.md @@ -1,24 +1,84 @@ -# mysql Cookbook CHANGELOG +# Changelog -This file is used to list changes made in each version of the mysql cookbook. +All notable changes to this project will be documented in this file. -## 8.5.1 (2017-08-23) +## 8.7.3 - 2020-07-22 + +- restore resource_name in mysql_service for Chef Infra Client < 16 +- resolved cookstyle error: libraries/mysql_client_installation_package.rb:8:5 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: libraries/mysql_client_installation_package.rb:9:1 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_client_installation_package.rb:9:1 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_client_installation_package.rb:9:3 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_client_installation_package.rb:9:9 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_server_installation_package.rb:4:5 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: libraries/mysql_server_installation_package.rb:5:1 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_server_installation_package.rb:5:1 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_server_installation_package.rb:5:3 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_server_installation_package.rb:5:9 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_service_manager_systemd.rb:3:5 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: libraries/mysql_service_manager_systemd.rb:4:1 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_service_manager_systemd.rb:4:1 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_service_manager_systemd.rb:4:3 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_service_manager_systemd.rb:4:9 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_service_manager_sysvinit.rb:3:5 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: libraries/mysql_service_manager_sysvinit.rb:4:1 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_service_manager_sysvinit.rb:4:1 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_service_manager_sysvinit.rb:4:3 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_service_manager_sysvinit.rb:4:9 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_service_manager_upstart.rb:3:5 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: libraries/mysql_service_manager_upstart.rb:4:1 convention: `Layout/IndentationConsistency` +- resolved cookstyle error: libraries/mysql_service_manager_upstart.rb:4:1 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_service_manager_upstart.rb:4:3 convention: `Layout/IndentationWidth` +- resolved cookstyle error: libraries/mysql_service_manager_upstart.rb:4:9 convention: `Layout/IndentationConsistency` + +## 8.7.2 - 2020-06-02 + +- resolved cookstyle error: libraries/mysql_service.rb:4:5 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + +## 8.7.1 - 2020-05-20 + +- resolved cookstyle error: spec/mysql_client_installation_package_spec.rb:7:46 warning: `ChefDeprecations/DeprecatedChefSpecPlatform` +- resolved cookstyle error: spec/mysql_server_installation_package_spec.rb:7:46 warning: `ChefDeprecations/DeprecatedChefSpecPlatform` + +## 8.7.0 - 2020-05-05 + +- migration to Github Actions +- Ability to include "none" as an installation method in mysql_service +- resolved cookstyle error: libraries/helpers.rb:57:48 refactor: `ChefStyle/UnnecessaryOSCheck` +- resolved cookstyle error: libraries/helpers.rb:58:41 refactor: `ChefStyle/UnnecessaryOSCheck` + +## [8.6.0] - 2019-12-03 + +- Fix the failing linting tests +- Add mysql57 support for Amazon Linux AMI +- Fix installation and testing on Ubuntu 18.04 bionic, EL7, Fedora and Opensuse +- Ensure compatibility with mysql 5.7 on Ubtuntu 16.04 +- Add apparmor profile for ubuntu 16.04 +- Allow instance with 'mysql' as name +- Add a helper for Ubuntu 18.04 +- Remove support for Debian 7 +- Remove ChefSpec matchers +- Set apparmor tmp_dir permissions on directory itself +- Run latest cookstyle +- Circleci, Yaml and markdown lint updates + +## [8.5.1] - 2017-08-23 - Fix the remainder of the namespace collision deprecation warnings - Remove the class_eval in the action class as this causes issues with some releases of Chef 12 -## 8.5.0 (2017-08-23) +## [8.5.0] - 2017-08-23 - Require Chef 12.7+ since 12.5/12.6 has custom resource action_class issues - Resolve several Chef 14 deprecation warnings -## 8.4.0 (2017-05-30) +## [8.4.0] - 2017-05-30 - Fix client/server install on Amazon Linux and add testing - Remove support for Ubuntu Precise since it's EOL - Add Amazon Linux testing -## 8.3.1 (2017-04-04) +## [8.3.1] - 2017-04-04 - Fix an ignoring of 'cookbook' attribute by 'mysql_config' resource - Remove unused helper method @@ -26,21 +86,24 @@ This file is used to list changes made in each version of the mysql cookbook. - Switch to Delivery Local and rename the docked config - Remove mention of the EOL opensuse 13.x in the readme -## 8.3.0 (2017-03-20) +## [8.3.0] - 2017-03-20 + - Refactor mysql_service_manager_upstart.rb to eliminate use of cloned resource -## 8.2.0 (2016-12-03) +## [8.2.0] - 2016-12-03 - Include client development packages on RHEL/SUSE platforms -## 8.1.1 (2016-10-31) +## [8.1.1] - 2016-10-31 + - Fixing CVE-2016-6662 - Reverting execure bit on mysql config -## 8.1.0 (2016-10-29) +## [8.1.0] - 2016-10-29 - Drop hardcoded, specific package version logic that broke many users -## 8.0.4 (2016-09-26) +## [8.0.4] - 2016-09-26 + - Bump debian version - Updated packages for 12.04 and 14.04 too - Add chef_version metadata @@ -48,19 +111,22 @@ This file is used to list changes made in each version of the mysql cookbook. - Add selinux to the Berksfile for testing - Make sure yum repos are setup in local Test Kitchen -## 8.0.3 (2016-09-14) +## [8.0.3] - 2016-09-14 + - [GH-390] Fix #390 incorrect escaping of initial_root_password - Updated package versions for Ubuntu 16.04 - Testing updates -# v8.0.2 (2016-08-25) +## [8.0.2] - 2016-08-25 + - Various bug fixed and updates to package version strings -# v8.0.1 (2016-07-20) +## [8.0.1] - 2016-07-20 + - Fixed a regression in the mysql_client resource where the action was changed from create to install in the 8.0 release - Added oracle, opensuse, and opensuseleap as supported platforms in the metadata -# v8.0.0 (2016-07-11) +## [8.0.0] - 2016-07-11 - Converting from LWRP to custom resources - Removing yum-mysql and other dependencies. @@ -71,26 +137,26 @@ This file is used to list changes made in each version of the mysql cookbook. - Renaming "replication" test suite to "smoke" - Moving to Inspec -## v7.2.0 (2016-06-30) +## [7.2.0] - 2016-06-30 - Support openeSUSE leap - Support Fedora 24 -## v7.1.2 (2016-06-30) +## [7.1.2] - 2016-06-30 - Avoid deprecation warnings on the upcoming Chef 12.12 release -## v7.1.1 (2016-06-03) +## [7.1.1] - 2016-06-03 - Fix apparmor blocking writes to non-default tmp_dirs - Updated apparmor config to allow read & write to sock.lock file - Use cookstyle instead of Rubocop directly -## v7.1.0 (2016-05-11) +## [7.1.0] - 2016-05-11 - Added support for Ubuntu 16.04 -## v7.0.0 (2016-04-19) +## [7.0.0] - 2016-04-19 - Removed support for legacy distros: Ubuntu 10.04/13.04/14.10/15.04, Fedora 20/21, OmniOS r151006, opensuse 11.3/12.0 - Added support for Fedora 23, suse 13.X, and Ubuntu 16.04 @@ -100,161 +166,161 @@ This file is used to list changes made in each version of the mysql cookbook. - Added Travis CI Test Kitchen testing on Fedora 22/23 and removed Fedora 21 - Updated the platforms used in the specs -## v6.1.3 (2016-03-14) +## [6.1.3] - 2016-03-14 - Added support for Ubuntu 15.10 - Added support for Amazon Linux 2016-03 - Updated Kitchen testing configs -## v6.1.2 (2015-10-05) +## [6.1.2] - 2015-10-05 - Added support for Amazon Linux 2015.09 -## v6.1.1 (2015-09-24) +## [6.1.1] - 2015-09-24 - Completing ChefSpec matchers -## v6.1.0 (2015-07-17) +## [6.1.0] - 2015-07-17 - Adding tunables for tmp_dir, error_log, and pid_file - Adding mysqld_options hash interface for main my.cnf template -## v6.0.31 (2015-07-13) +## [6.0.31] - 2015-07-13 - Reverting create_stop_system_service checks -## v6.0.30 (2015-07-13) +## [6.0.30] - 2015-07-13 - Ubuntu 15.04 support - Check for scripts and unit files during create_stop_system_service -## v6.0.29 (2015-07-12) +## [6.0.29] - 2015-07-12 - Patch to allow blank root password - Adding package information for Suse 12.0 -## v6.0.28 (2015-07-10) +## [6.0.28] - 2015-07-10 - Fixes for 12.4.x -## v6.0.27 (2015-07-09) +## [6.0.27] - 2015-07-09 - Allowing integer value for port number -## v6.0.26 (2015-07-07) +## [6.0.26] - 2015-07-07 - Reverting breaking changes introduced in 6.0.25 -## v6.0.25 (2015-07-06) +## [6.0.25] - 2015-07-06 - Fixes for 12.4.1 -## v6.0.24 (2015-06-27) +## [6.0.24] - 2015-06-27 - 341 - Changing default GRANT for root from '%' to 'localhost' and '127.0.0.1' -## v6.0.23 (2015-06-21) +## [6.0.23] - 2015-06-21 - 354 Better handling of long MySQL startup times -## v6.0.22 (2015-05-07) +## [6.0.22] - 2015-05-07 - Debian 8 (Jessie) support -## v6.0.21 (2015-04-08) +## [6.0.21] - 2015-04-08 - Fix to Upstart prestart script when using custom socket - Adding --explicit_defaults_for_timestamp mysql_install_db_cmd for - 5.6 and above -## v6.0.20 (2015-03-27) +## [6.0.20] - 2015-03-27 - 318 - Fixing Upstart pre-start script to handle custom socket paths -## v6.0.19 (2015-03-25) +## [6.0.19] - 2015-03-25 - Adding support for Amazon Linux 2015.03 -## v6.0.18 (2015-03-24) +## [6.0.18] - 2015-03-24 - Adding support for 5.6 and 5.7 packages from dotdeb repos on Debian 7 -## v6.0.17 (2015-03-13) +## [6.0.17] - 2015-03-13 - Updated for MySQL 5.7.6. - Handing removal of mysql_install_db and mysqld_safe -## v6.0.16 (2015-03-10) +## [6.0.16] - 2015-03-10 - Moved --defaults-file as first option to mysql_install_db_script -## v6.0.15 (2015-02-26) +## [6.0.15] - 2015-02-26 - Updating docker detection fix to pass specs -## v6.0.14 (2015-02-26) +## [6.0.14] - 2015-02-26 - Fixed debian system service :disable action. Now survives reboot - Fixing centos-7 instance :enable action. Now survives - Not applying Apparmor policy if running in a Docker container -## v6.0.13 (2015-02-15) +## [6.0.13] - 2015-02-15 - Adding support for special characters in initial_root_password - Fixing failure status bug in sysvinit script -## v6.0.12 (2015-02-30) +## [6.0.12] - 2015-02-30 - No changes. Released a 6.0.11 that was identical to 6.0.10. - Git before coffee. -## v6.0.11 (2015-02-30) +## [6.0.11] - 2015-02-30 - Adding support for configurable socket files -## v6.0.10 (2015-01-19) +## [6.0.10] - 2015-01-19 - Fix #282 - Fixing up data_dir template variable -## v6.0.9 (2015-01-19) +## [6.0.9] - 2015-01-19 - Fix #282 - undefined method `parsed_data_dir' bug -## v6.0.8 (2015-01-19) +## [6.0.8] - 2015-01-19 - Refactoring helper methods out of resource classes -## v6.0.7 (2015-01-14) +## [6.0.7] - 2015-01-14 - Fixing timing issue with Upstart provider :restart and :reload - actions where service returns before being available -## v6.0.6 (2014-12-26) +## [6.0.6] - 2014-12-26 - Fixing subtle bug where MysqlCookbook::Helper methods were polluting Chef::Resource -## v6.0.5 (2014-12-25) +## [6.0.5] - 2014-12-25 - Using 'include_recipe' instead of 'recipe_eval' in LWRP - Fixing type checking on package_name attribute in mysql_client resource. -## v6.0.4 (2014-12-21) +## [6.0.4] - 2014-12-21 - Suggest available versions if current is not available for current platform. -## v6.0.3 (2014-12-17) +## [6.0.3] - 2014-12-17 - Adding bind_address parameter to mysql_service resource -## v6.0.2 (2014-12-17) +## [6.0.2] - 2014-12-17 - Fixing sysvinit provider to survive reboots -## v6.0.1 (2014-12-16) +## [6.0.1] - 2014-12-16 - Fixing Upstart template to survive reboots -## v6.0.0 (2014-12-15) +## [6.0.0] - 2014-12-15 - Major version update - Cookbook now provides LWRPs instead of recipes @@ -269,11 +335,11 @@ This file is used to list changes made in each version of the mysql cookbook. - Refactored acceptance tests - Temporarily dropped FreeBSD support -## v5.6.1 (2014-10-29) +## [5.6.1] - 2014-10-29 - Use Gem::Version instead of Chef::Version -## v5.6.0 (2014-10-29) +## [5.6.0] - 2014-10-29 - Changing default charset to utf8 - Quoting passwords in debian.cnf.erb @@ -282,45 +348,45 @@ This file is used to list changes made in each version of the mysql cookbook. - Only hide passwords from STDOUT via "sensitive true" in chef-client higher than 11.14 - Updating test harness -## v5.5.4 (2014-10-07) +## [5.5.4] - 2014-10-07 - Adding sensitive flag to execute resources to protect passwords from logs -## v5.5.3 (2014-09-24) +## [5.5.3] - 2014-09-24 - Reverting back to Upstart on Ubuntu 14.04 -## v5.5.2 (2014-09-8) +## [5.5.2] - 2014-09-8 - Reverting commit that broke Debian pass_string -## v5.5.1 (2014-09-2) +## [5.5.1] - 2014-09-2 - Switching Ubuntu service provider to use SysVinit instead of Upstart -## v5.5.0 (2014-08-27) +## [5.5.0] - 2014-08-27 - Adding package version and action parameters to mysql_service resource - Fixing Debian pass_string -## v5.4.4 (2014-08-27) +## [5.4.4] - 2014-08-27 - Changing module namespace to MysqlCookbook -## v5.4.3 (2014-08-25) +## [5.4.3] - 2014-08-25 - More refactoring. Moving helper function bits into resource parsed_parameters -## v5.4.2 (2014-08-25) +## [5.4.2] - 2014-08-25 - Moving provider local variables into definitions for RHEL provider -## v5.4.1 (2014-08-25) +## [5.4.1] - 2014-08-25 - Refactoring resources into the LWRP style with parsed parameters - Moving provider local variables into definitions -## v5.4.0 (2014-08-25) +## [5.4.0] - 2014-08-25 - 212 - support for centos-7 (mysql55 and mysql56) - Adding (untested) Debian-6 support @@ -330,119 +396,119 @@ This file is used to list changes made in each version of the mysql cookbook. - Appeasing AppArmor - Reducing duplication in client provider -## v5.3.6 (2014-06-18) +## [5.3.6] - 2014-06-18 - Fixing pid path location. Updating tests to include real RHEL -## v5.3.4 (2014-06-16) +## [5.3.4] - 2014-06-16 - Fixing specs for Amazon Linux server package names -## v5.3.2 (2014-06-16) +## [5.3.2] - 2014-06-16 - Fixing Amazon Linux support -## v5.3.0 (2014-06-11) +## [5.3.0] - 2014-06-11 - 189 - Fix server_repl_password description - 191 - Adding support for server55 and server56 on el-6 - 193 - Fix syntax in mysql_service example - 199 - Adding Suse support -## v5.2.12 (2014-05-19) +## [5.2.12] - 2014-05-19 PR #192 - recipes/server.rb should honor parameter node['mysql']['version'] -## v5.2.10 (2014-05-15) +## [5.2.10] - 2014-05-15 - COOK-4394 - restore freebsd support -## v5.2.8 (2014-05-15) +## [5.2.8] - 2014-05-15 - [COOK-4653] - Missing mySQL 5.6 support for Ubuntu 14.04 -## v5.2.6 (2014-05-07) +## [5.2.6] - 2014-05-07 - [COOK-4625] - Fix password resource parameter consumption on Debian and Ubuntu - Fix up typos and version numbers in PLATFORMS.md - Fix up specs from COOK-4613 changes -## v5.2.4 (2014-05-02) +## [5.2.4] - 2014-05-02 - [COOK-4613] - Fix permissions on mysql data_dir to allow global access to mysql.sock -## v5.2.2 (2014-04-24) +## [5.2.2] - 2014-04-24 - [COOK-4564] - Using positive tests for datadir move -## v5.2.0 (2014-04-22) +## [5.2.0] - 2014-04-22 - [COOK-4551] - power grants.sql from resource parameters -## v5.1.12 (2014-04-21) +## [5.1.12] - 2014-04-21 - [COOK-4554] - Support for Debian Sid -## v5.1.10 (2014-04-21) +## [5.1.10] - 2014-04-21 - [COOK-4565] Support for Ubuntu 14.04 - [COOK-4565] Adding Specs and TK platform - Removing non-LTS 13.10 specs and TK platform -## v5.1.8 (2014-04-12) +## [5.1.8] - 2014-04-12 Adding Ubuntu 13.04 to Platforminfo -## v5.1.6 (2014-04-11) +## [5.1.6] - 2014-04-11 - [COOK-4548] - Add template[/etc/mysql/debian.cnf] to Ubuntu provider -## v5.1.4 (2014-04-11) +## [5.1.4] - 2014-04-11 - [COOK-4547] - Shellescape server_root_password -## v5.1.2 (2014-04-09) +## [5.1.2] - 2014-04-09 - [COOK-4519] - Fix error in run_dir for Ubuntu - [COOK-4531] - Fix pid and run_dir for Debian -## v5.1.0 (2014-04-08) +## [5.1.0] - 2014-04-08 [COOK-4523] - Allow for both :restart and :reload -## v5.0.6 (2014-04-07) +## [5.0.6] - 2014-04-07 - [COOK-4519] - Updating specs to reflect pid file change on Ubuntu -## v5.0.4 (2014-04-07) +## [5.0.4] - 2014-04-07 - [COOK-4519] - Fix path to pid file on Ubuntu -## v5.0.2 (2014-04-01) +## [5.0.2] - 2014-04-01 - Moving server_deprecated into recipes directory -## v5.0.0 (2014-03-31) +## [5.0.0] - 2014-03-31 - Rewriting as a library cookbook - Exposing mysql_service and mysql_client resources - User now needs to supply configuration - Moving attribute driven recipe to server-deprecated -## v4.1.2 (2014-02-28) +## [4.1.2] - 2014-02-28 - [COOK-4349] - Fix invalid platform check - [COOK-4184] - Better handling of Ubuntu upstart service - [COOK-2100] - Changing innodb_log_file_size tunable results in inability to start MySQL -## v4.1.1 (2014-02-25) +## [4.1.1] - 2014-02-25 - **[COOK-2966] - Address foodcritic failures' - **[COOK-4182] - Template parse failure in /etc/init/mysql.conf (data_dir)' - **[COOK-4198] - Added missing tunable' - **[COOK-4206] - create root@127.0.0.1, as well as root@localhost' -## v4.0.20 (2014-01-18) +## [4.0.20] - 2014-01-18 - [COOK-3931] - MySQL Server Recipe Regression for Non-LTS Ubuntu Versions - [COOK-3945] - MySQL cookbook fails on Ubuntu 13.04/13.10 @@ -452,11 +518,11 @@ Adding Ubuntu 13.04 to Platforminfo - [COOK-4001] - Pull request: Fixes for broken mysql::server on Debian - [COOK-4071] - Mysql cookbook doesn't work on debian 7.2 -## v4.0.14 +## [4.0.14] Fixing style cops -## v4.0.12 +## [4.0.12] ### Bug @@ -466,25 +532,25 @@ Fixing style cops - **[COOK-3801](https://tickets.chef.io/browse/COOK-3801)** - Add innodb_adaptive_flushing_method and innodb_adaptive_checkpoint -## v4.0.10 +## [4.0.10] fixing metadata version error. locking to 3.0 -## v4.0.8 +## [4.0.8] Locking yum dependency to '< 3' -## v4.0.6 +## [4.0.6] -# Bug +### Bug - [COOK-3943] Notifying service restart on grants update -## v4.0.4 +## [4.0.4] [COOK-3952] - Adding 'recursive true' to directory resources -## v4.0.2 +## [4.0.2] ### BUGS @@ -492,7 +558,7 @@ Locking yum dependency to '< 3' - Fixing bug where unprivileged users cannot connect over a local socket. Adding integration test. - Fixing bug in mysql_grants_cmd generation -## v4.0.0 +## [4.0.0] - [COOK-3928] Heavily refactoring for readability. Moving platform implementation into separate recipes - Moving integration tests from minitest to serverspec, removing "improper" tests @@ -503,23 +569,23 @@ Locking yum dependency to '< 3' - [COOK-3807] - Don't use execute[assign-root-password] on Debian and Ubuntu - [COOK-3881] - Fixing /etc being owned by mysql user -## v3.0.12 +## [3.0.12] ### Bug - **[COOK-3752](https://tickets.chef.io/browse/COOK-3752)** - mysql service fails to start in mysql::server recipe -## v3.0.10 +## [3.0.10] - Fix a failed release attempt for v3.0.8 -## v3.0.8 +## [3.0.8] ### Bug - **[COOK-3749](https://tickets.chef.io/browse/COOK-3749)** - Fix a regression with Chef 11-specific features -## v3.0.6 +## [3.0.6] ### Bug @@ -536,7 +602,7 @@ Locking yum dependency to '< 3' - **[COOK-3498](https://tickets.chef.io/browse/COOK-3498)** - Add support for replicate_* variables in my.cnf -## v3.0.4 +## [3.0.4] ### Bug @@ -546,7 +612,7 @@ Locking yum dependency to '< 3' - **[COOK-3134](https://tickets.chef.io/browse/COOK-3134)** - Fix Chef 11 support - **[COOK-2318](https://tickets.chef.io/browse/COOK-2318)** - Remove redundant `if` block around `node.mysql.tunable.log_bin` -## v3.0.2 +## [3.0.2] ### Bug @@ -558,7 +624,7 @@ Locking yum dependency to '< 3' - [COOK-2102]: `innodb_flush_log_at_trx_commit` value is incorrectly set based on CPU count -## v3.0.0 +## [3.0.0] **Note** This is a backwards incompatible version with previous versions of the cookbook. Tickets that introduce incompatibility are COOK-2615 and COOK-2617. @@ -580,11 +646,11 @@ Locking yum dependency to '< 3' - [COOK-2618] - myisam-recover not using attribute value - [COOK-2617] - open-files is a duplicate of open-files-limit -## v2.1.2 +## [2.1.2] - [COOK-2172] - Mysql cookbook duplicates `binlog_format` configuration -## v2.1.0 +## [2.1.0] - [COOK-1669] - Using platform("ubuntu") in default attributes always returns true - [COOK-1694] - Added additional my.cnf fields and reorganized cookbook to avoid race conditions with mysql startup and sql script execution @@ -592,13 +658,13 @@ Locking yum dependency to '< 3' - [COOK-1929] - Update msyql server attributes file because setting attributes without specifying a precedence is deprecated - [COOK-1999] - Add read_only tunable useful for replication slave servers -## v2.0.2 +## [2.0.2] - [COOK-1967] - mysql: trailing comma in server.rb platform family -## v2.0.0 +## [2.0.0] -**Important note for this release** +### Important note for this release Under Chef Solo, you must set the node attributes for the root, debian and repl passwords or the run will completely fail. See COOK-1737 for background on this. @@ -613,9 +679,9 @@ Under Chef Solo, you must set the node attributes for the root, debian and repl - [COOK-1769] - link to database recipe in mysql README goes to old chef/cookbooks repo instead of chef-cookbook organization - [COOK-1963] - use `platform_family` -## v1.3.0 +## [1.3.0] -**Important note for this release** +### Important note for this release This version no longer installs Ruby bindings in the client recipe by default. Use the ruby recipe if you'd like the RubyGem. If you'd like packages from your distribution, use them in your application's specific cookbook/recipe, or modify the client packages attribute. This resolves the following tickets: @@ -637,7 +703,7 @@ The following issues are also addressed in this release. - [COOK-934] - remove deprecated mysql/libraries/database.rb, use the database cookbook instead. - [COOK-1475] - fix restart on config change -## v1.2.6 +## [1.2.6] - [COOK-1113] - Use an attribute to determine if upstart is used - [COOK-1121] - Add support for Windows @@ -645,47 +711,47 @@ The following issues are also addressed in this release. - [COOK-1151] - Fix server_ec2 handling /var/lib/mysql bind mount - [COOK-1321] - Document setting password attributes for solo -## v1.2.4 +## [1.2.4] - [COOK-992] - fix FATAL nameerror - [COOK-827] - `mysql:server_ec2` recipe can't mount `data_dir` - [COOK-945] - FreeBSD support -## v1.2.2 +## [1.2.2] - [COOK-826] mysql::server recipe doesn't quote password string - [COOK-834] Add 'scientific' and 'amazon' platforms to mysql cookbook -## v1.2.1 +## [1.2.1] - [COOK-644] Mysql client cookbook 'package missing' error message is confusing - [COOK-645] RHEL6/CentOS6 - mysql cookbook contains 'skip-federated' directive which is unsupported on MySQL 5.1 -## v1.2.0 +## [1.2.0] - [COOK-684] remove mysql_database LWRP -## v1.0.8 +## [1.0.8] - [COOK-633] ensure "cloud" attribute is available -## v1.0.7 +## [1.0.7] - [COOK-614] expose all mysql tunable settings in config - [COOK-617] bind to private IP if available -## v1.0.6 +## [1.0.6] - [COOK-605] install mysql-client package on ubuntu/debian -## v1.0.5 +## [1.0.5] - [COOK-465] allow optional remote root connections to mysql - [COOK-455] improve platform version handling - externalize conf_dir attribute for easier cross platform support - change datadir attribute to data_dir for consistency -## v1.0.4 +## [1.0.4] - fix regressions on debian platform - [COOK-578] wrap root password in quotes diff --git a/cookbooks/mysql/CONTRIBUTING.md b/cookbooks/mysql/CONTRIBUTING.md index ef2f2b8..a946aea 100644 --- a/cookbooks/mysql/CONTRIBUTING.md +++ b/cookbooks/mysql/CONTRIBUTING.md @@ -1,2 +1,4 @@ +# Contributing + Please refer to -https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD +[https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) diff --git a/cookbooks/mysql/README.md b/cookbooks/mysql/README.md index 63dba0f..adf14cc 100644 --- a/cookbooks/mysql/README.md +++ b/cookbooks/mysql/README.md @@ -1,6 +1,10 @@ # MySQL Cookbook -[![Build Status](https://travis-ci.org/chef-cookbooks/mysql.svg?branch=master)](https://travis-ci.org/chef-cookbooks/mysql) [![Cookbook Version](https://img.shields.io/cookbook/v/mysql.svg)](https://supermarket.chef.io/cookbooks/mysql) +[![Cookbook Version](https://img.shields.io/cookbook/v/mysql.svg)](https://supermarket.chef.io/cookbooks/mysql) +[![Build Status](https://img.shields.io/circleci/project/github/sous-chefs/mysql/master.svg)](https://circleci.com/gh/sous-chefs/mysql) +[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) The MySQL Cookbook is a library cookbook that provides resource primitives (LWRPs) for use in recipes. It is designed to be a reference example for creating highly reusable cross-platform cookbooks. @@ -8,6 +12,10 @@ The MySQL Cookbook is a library cookbook that provides resource primitives (LWRP This cookbook is concerned with the "MySQL Community Server", particularly those shipped with F/OSS Unix and Linux distributions. It does not address forks or value-added repackaged MySQL distributions like MariaDB or Percona. +## Maintainers + +This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). + ## Requirements - Chef 12.7 or higher @@ -18,27 +26,15 @@ This cookbook is concerned with the "MySQL Community Server", particularly those The following platforms have been tested with Test Kitchen: -``` -|----------------+-----+-----+-----+-----| -| | 5.1 | 5.5 | 5.6 | 5.7 | -|----------------+-----+-----+-----+-----| -| debian-7 | | X | | | -|----------------+-----+-----+-----+-----| +| OS | 5.1 | 5.5 | 5.6 | 5.7 | +|----------------|-----|-----|-----|-----| | debian-8 | | X | | | -|----------------+-----+-----+-----+-----| | ubuntu-14.04 | | X | X | | -|----------------+-----+-----+-----+-----| | ubuntu-16.04 | | | | X | -|----------------+-----+-----+-----+-----| | centos-6 | X | X | X | X | -|----------------+-----+-----+-----+-----| | centos-7 | | X | X | X | -|----------------+-----+-----+-----+-----| | fedora | | | X | X | -|----------------+-----+-----+-----+-----| | openSUSE Leap | | | X | | -|----------------+-----+-----+-----+-----| -``` ## Cookbook Dependencies @@ -65,9 +61,11 @@ end The service name on the OS is `mysql-foo`. You can manually start and stop it with `service mysql-foo start` and `service mysql-foo stop`. +If you use `default` as the name the service name will be `mysql` instead of `mysql-default`. + The configuration file is at `/etc/mysql-foo/my.cnf`. It contains the minimum options to get the service running. It looks like this. -``` +```toml # Chef generated my.cnf for instance mysql-foo [client] @@ -104,12 +102,13 @@ end mysql_config 'foo' do source 'my_extra_settings.erb' + instance 'foo' notifies :restart, 'mysql_service[foo]' action :create end ``` -You are responsible for providing `my_extra_settings.erb` in your own cookbook's templates folder. +You are responsible for providing `my_extra_settings.erb` in your own cookbook's templates folder. The name of the mysql service instance must be provided in mysql config as this defaults to 'default'. ## Connecting with the mysql CLI command @@ -156,7 +155,6 @@ Please note that when using `notifies` or `subscribes`, the resource to referenc - `error_log` - Tunable location of the error_log - `initial_root_password` - allows the user to specify the initial root password for mysql when initializing new databases. This can be set explicitly in a recipe, driven from a node attribute, or from data_bags. When omitted, it defaults to `ilikerandompasswords`. Please be sure to change it. - `instance` - A string to identify the MySQL service. By convention, to allow for multiple instances of the `mysql_service`, directories and files on disk are named `mysql-`. Defaults to the resource name. -- `package_action` - Defaults to `:install`. - `package_name` - Defaults to a value looked up in an internal map. - `package_version` - Specific version of the package to install,passed onto the underlying package manager. Defaults to `nil`. - `bind_address` - determines the listen IP address for the mysqld service. When omitted, it will be determined by MySQL. If the address is "regular" IPv4/IPv6address (e.g 127.0.0.1 or ::1), the server accepts TCP/IP connections only for that particular address. If the address is "0.0.0.0" (IPv4) or "::" (IPv6), the server accepts TCP/IP connections on all IPv4 or IPv6 interfaces. @@ -166,17 +164,17 @@ Please note that when using `notifies` or `subscribes`, the resource to referenc - `run_user` - The name of the system user the `mysql_service` should run as. Defaults to 'mysql'. - `pid_file` - Tunable location of the pid file. - `socket` - determines where to write the socket file for the `mysql_service` instance. Useful when configuring clients on the same machine to talk over socket and skip the networking stack. Defaults to a calculated value based on platform and instance name. -- `tmp_dir` - Tunable location of the tmp_dir +- `tmp_dir` - Tunable location of the tmp_dir. - `version` - allows the user to select from the versions available for the platform, where applicable. When omitted, it will install the default MySQL version for the target platform. Available version numbers are `5.0`, `5.1`, `5.5`, `5.6`, and `5.7`, depending on platform. #### Actions - `:create` - Configures everything but the underlying operating system service. - `:delete` - Removes everything but the package and data_dir. -- `:start` - Starts the underlying operating system service -- `:stop`- Stops the underlying operating system service -- `:restart` - Restarts the underlying operating system service -- `:reload` - Reloads the underlying operating system service +- `:start` - Starts the underlying operating system service. +- `:stop`- Stops the underlying operating system service. +- `:restart` - Restarts the underlying operating system service. +- `:reload` - Reloads the underlying operating system service. #### Providers @@ -353,7 +351,7 @@ Use multiple `mysql_service` instances to test a replication setup. This particu ## Frequently Asked Questions -### How do I run this behind my firewall? +### How do I run this behind my firewall On Linux, the `mysql_service` resource uses the platform's underlying package manager to install software. For this to work behind firewalls, you'll need to either: @@ -395,30 +393,35 @@ Or to connect over the network, use something like this: connect over the networ These network or socket ssettings can also be put in you $HOME/.my.cnf, if preferred. -### What about MariaDB, Percona, etc. +### What about MariaDB, Percona, etc MySQL forks are purposefully out of scope for this cookbook. This is mostly to reduce the testing matrix to a manageable size. Cookbooks for these technologies can easily be created by copying and adapting this cookbook. However, there will be differences. Package repository locations, package version names, software major version numbers, supported platform matrices, and the availability of software such as XtraDB and Galera are the main reasons that creating multiple cookbooks to make sense. -## Maintainers +There are existing cookbooks to carter for these forks, check them out on the supermarket -This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/) +## Contributors -## License +This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) -```text -Copyright:: 2009-2017 Chef Software, Inc +### Backers -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +Thank you to all our backers! - http://www.apache.org/licenses/LICENSE-2.0 +![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` +### Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. + +![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) diff --git a/cookbooks/mysql/libraries/helpers.rb b/cookbooks/mysql/libraries/helpers.rb index e60d21d..ac2340b 100644 --- a/cookbooks/mysql/libraries/helpers.rb +++ b/cookbooks/mysql/libraries/helpers.rb @@ -12,8 +12,13 @@ module MysqlCookbook false end - def wheezy? - return true if node['platform'] == 'debian' && node['platform_version'].to_i == 7 + def fedora? + return true if node['platform_family'] == 'fedora' + false + end + + def suse? + return true if node['platform_family'] == 'suse' false end @@ -38,14 +43,19 @@ module MysqlCookbook false end + def bionic? + return true if node['platform'] == 'ubuntu' && node['platform_version'] == '18.04' + false + end + def defaults_file "#{etc_dir}/my.cnf" end def default_data_dir return "/var/lib/#{mysql_name}" if node['os'] == 'linux' - return "/opt/local/lib/#{mysql_name}" if node['os'] == 'solaris2' - return "/var/db/#{mysql_name}" if node['os'] == 'freebsd' + return "/opt/local/lib/#{mysql_name}" if platform_family?('solaris2') + return "/var/db/#{mysql_name}" if platform_family?('freebsd') end def default_error_log @@ -58,22 +68,22 @@ module MysqlCookbook def default_major_version # rhelish - return '5.1' if el6? + return '5.6' if el6? return '5.6' if el7? return '5.6' if node['platform'] == 'amazon' # debian - return '5.5' if wheezy? return '5.5' if jessie? # ubuntu return '5.5' if trusty? return '5.7' if xenial? + return '5.7' if bionic? # misc return '5.6' if node['platform'] == 'freebsd' - return '5.6' if node['platform'] == 'fedora' - return '5.6' if node['platform_family'] == 'suse' + return '5.7' if fedora? + return '5.6' if suse? end def major_from_full(v) @@ -81,7 +91,11 @@ module MysqlCookbook end def mysql_name - "mysql-#{instance}" + if instance == 'default' + 'mysql' + else + "mysql-#{instance}" + end end def default_socket_file @@ -89,20 +103,23 @@ module MysqlCookbook end def default_client_package_name - return ['mysql', 'mysql-devel'] if major_version == '5.1' && el6? + return %w(mysql mysql-devel) if major_version == '5.1' && el6? + return %w(mysql mysql-devel) if el7? return ['mysql55', 'mysql55-devel.x86_64'] if major_version == '5.5' && node['platform'] == 'amazon' return ['mysql56', 'mysql56-devel.x86_64'] if major_version == '5.6' && node['platform'] == 'amazon' + return ['mysql57', 'mysql57-devel.x86_64'] if major_version == '5.7' && node['platform'] == 'amazon' return ['mysql-client-5.5', 'libmysqlclient-dev'] if major_version == '5.5' && node['platform_family'] == 'debian' return ['mysql-client-5.6', 'libmysqlclient-dev'] if major_version == '5.6' && node['platform_family'] == 'debian' return ['mysql-client-5.7', 'libmysqlclient-dev'] if major_version == '5.7' && node['platform_family'] == 'debian' return 'mysql-community-server-client' if major_version == '5.6' && node['platform_family'] == 'suse' - ['mysql-community-client', 'mysql-community-devel'] + %w(mysql-community-client mysql-community-devel) end def default_server_package_name return 'mysql-server' if major_version == '5.1' && el6? return 'mysql55-server' if major_version == '5.5' && node['platform'] == 'amazon' return 'mysql56-server' if major_version == '5.6' && node['platform'] == 'amazon' + return 'mysql57-server' if major_version == '5.7' && node['platform'] == 'amazon' return 'mysql-server-5.5' if major_version == '5.5' && node['platform_family'] == 'debian' return 'mysql-server-5.6' if major_version == '5.6' && node['platform_family'] == 'debian' return 'mysql-server-5.7' if major_version == '5.7' && node['platform_family'] == 'debian' @@ -189,7 +206,6 @@ module MysqlCookbook set -e rm -rf /tmp/#{mysql_name} mkdir /tmp/#{mysql_name} - cat > /tmp/#{mysql_name}/my.sql <<-'EOSQL' UPDATE mysql.user SET #{password_column_name}=PASSWORD('#{sql_escaped_password}')#{password_expired} WHERE user = 'root'; DELETE FROM mysql.user WHERE USER LIKE ''; @@ -198,15 +214,24 @@ FLUSH PRIVILEGES; DELETE FROM mysql.db WHERE db LIKE 'test%'; DROP DATABASE IF EXISTS test ; EOSQL - #{db_init} #{record_init} - while [ ! -f #{pid_file} ] ; do sleep 1 ; done kill `cat #{pid_file}` while [ -f #{pid_file} ] ; do sleep 1 ; done rm -rf /tmp/#{mysql_name} - EOS + EOS + end + + def wait_for_init + cmd = <<-EOS + while [ ! -f #{pid_file} ] ; do sleep 1 ; done + kill `cat #{pid_file}` + while [ -f #{pid_file} ] ; do sleep 1 ; done + rm -rf /tmp/#{mysql_name} + EOS + cmd = '' if v57plus + cmd end def password_column_name @@ -256,12 +281,26 @@ EOSQL def mysqld_bin return "#{prefix_dir}/libexec/mysqld" if node['platform_family'] == 'smartos' return "#{base_dir}/bin/mysqld" if node['platform_family'] == 'omnios' - return '/usr/sbin/mysqld' if node['platform_family'] == 'fedora' && v56plus - return '/usr/libexec/mysqld' if node['platform_family'] == 'fedora' + return '/usr/sbin/mysqld' if fedora? && v56plus + return '/usr/libexec/mysqld' if fedora? return 'mysqld' if scl_package? "#{prefix_dir}/usr/sbin/mysqld" end + def mysql_systemd_start_pre + return '/usr/bin/mysqld_pre_systemd' if v57plus && (el7? || fedora?) + return '/usr/bin/mysql-systemd-start pre' if node['platform_family'] == 'rhel' + return '/usr/lib/mysql/mysql-systemd-helper install' if suse? + '/usr/share/mysql/mysql-systemd-start pre' + end + + def mysql_systemd + return "/usr/libexec/#{mysql_name}-wait-ready $MAINPID" if v57plus && (el7? || fedora?) + return '/usr/bin/mysql-systemd-start' if node['platform_family'] == 'rhel' + return '/usr/share/mysql/mysql-systemd-start' if v57plus + "/usr/libexec/#{mysql_name}-wait-ready $MAINPID" + end + def mysqld_initialize_cmd cmd = mysqld_bin cmd << " --defaults-file=#{etc_dir}/my.cnf" diff --git a/cookbooks/mysql/libraries/matchers.rb b/cookbooks/mysql/libraries/matchers.rb deleted file mode 100644 index adf5e73..0000000 --- a/cookbooks/mysql/libraries/matchers.rb +++ /dev/null @@ -1,71 +0,0 @@ -if defined?(ChefSpec) - ChefSpec.define_matcher :mysql_config - ChefSpec.define_matcher :mysql_service - ChefSpec.define_matcher :mysql_client - - # mysql_client_client_installation_package - def install_mysql_client_installation_package(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_client_installation_package, :create, resource_name) - end - - def remove_mysql_client_installation_package(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_client_installation_package, :remove, resource_name) - end - - # mysql_server_server_installation_package - def install_mysql_server_installation_package(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_server_installation_package, :install, resource_name) - end - - def remove_mysql_server_installation_package(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_server_installation_package, :remove, resource_name) - end - - ##### - # old - ##### - - # client - def create_mysql_client(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_client, :create, resource_name) - end - - def delete_mysql_client(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_client, :delete, resource_name) - end - - # mysql_config - def create_mysql_config(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_config, :create, resource_name) - end - - def delete_mysql_config(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_config, :delete, resource_name) - end - - # service - def create_mysql_service(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_service, :create, resource_name) - end - - def delete_mysql_service(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_service, :delete, resource_name) - end - - def start_mysql_service(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_service, :start, resource_name) - end - - def stop_mysql_service(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_service, :stop, resource_name) - end - - def restart_mysql_service(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_service, :restart, resource_name) - end - - def reload_mysql_service(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:mysql_service, :reload, resource_name) - end - -end diff --git a/cookbooks/mysql/libraries/mysql_base.rb b/cookbooks/mysql/libraries/mysql_base.rb index 2db0c16..0e1d675 100644 --- a/cookbooks/mysql/libraries/mysql_base.rb +++ b/cookbooks/mysql/libraries/mysql_base.rb @@ -3,9 +3,6 @@ module MysqlCookbook require_relative 'helpers' # All resources are composites - def whyrun_supported? - true - end ################ # Type Constants diff --git a/cookbooks/mysql/libraries/mysql_client_installation_package.rb b/cookbooks/mysql/libraries/mysql_client_installation_package.rb index 1dc87f5..9da3cfa 100644 --- a/cookbooks/mysql/libraries/mysql_client_installation_package.rb +++ b/cookbooks/mysql/libraries/mysql_client_installation_package.rb @@ -4,14 +4,15 @@ module MysqlCookbook require_relative 'helpers' include MysqlCookbook::HelpersBase - # Resource properties + # Resource:: properties resource_name :mysql_client_installation_package + provides :mysql_client_installation_package provides :mysql_client_installation, os: 'linux' provides :mysql_client, os: 'linux' property :package_name, [String, Array], default: lazy { default_client_package_name }, desired_state: false property :package_options, [String, nil], desired_state: false - property :package_version, [String, nil], default: nil, desired_state: false + property :package_version, [String, nil], desired_state: false # Actions action :create do diff --git a/cookbooks/mysql/libraries/mysql_config.rb b/cookbooks/mysql/libraries/mysql_config.rb index d4a52c9..27409fe 100644 --- a/cookbooks/mysql/libraries/mysql_config.rb +++ b/cookbooks/mysql/libraries/mysql_config.rb @@ -1,6 +1,7 @@ module MysqlCookbook class MysqlConfig < MysqlBase resource_name :mysql_config + provides :mysql_config property :config_name, String, name_property: true, desired_state: false property :cookbook, String, desired_state: false @@ -14,8 +15,6 @@ module MysqlCookbook require_relative 'helpers' include MysqlCookbook::HelpersBase - provides :mysql_config - action :create do # hax because group property g = Chef::Resource::Group.new(new_resource.group, run_context) diff --git a/cookbooks/mysql/libraries/mysql_server_installation_package.rb b/cookbooks/mysql/libraries/mysql_server_installation_package.rb index bf46c8d..86791cf 100644 --- a/cookbooks/mysql/libraries/mysql_server_installation_package.rb +++ b/cookbooks/mysql/libraries/mysql_server_installation_package.rb @@ -1,12 +1,13 @@ module MysqlCookbook class MysqlServerInstallationPackage < MysqlBase - # Resource properties + # Resource:: properties resource_name :mysql_server_installation_package + provides :mysql_server_installation_package provides :mysql_server_installation, os: 'linux' property :package_name, String, default: lazy { default_server_package_name }, desired_state: false property :package_options, [String, nil], desired_state: false - property :package_version, [String, nil], default: nil, desired_state: false + property :package_version, [String, nil], desired_state: false # helper methods require_relative 'helpers' diff --git a/cookbooks/mysql/libraries/mysql_service.rb b/cookbooks/mysql/libraries/mysql_service.rb index aa969bd..2880ab3 100644 --- a/cookbooks/mysql/libraries/mysql_service.rb +++ b/cookbooks/mysql/libraries/mysql_service.rb @@ -2,9 +2,10 @@ module MysqlCookbook require_relative 'mysql_service_base' class MysqlService < MysqlServiceBase resource_name :mysql_service + provides :mysql_service # installation type and service_manager - property :install_method, %w(package auto), default: 'auto', desired_state: false + property :install_method, %w(package auto none), default: 'auto', desired_state: false property :service_manager, %w(sysvinit upstart systemd auto), default: 'auto', desired_state: false # mysql_server_installation @@ -12,7 +13,7 @@ module MysqlCookbook property :major_version, String, default: lazy { major_from_full(version) }, desired_state: false property :package_name, String, default: lazy { default_package_name }, desired_state: false property :package_options, [String, nil], desired_state: false - property :package_version, [String, nil], default: nil, desired_state: false + property :package_version, [String, nil], desired_state: false ################ # Helper Methods diff --git a/cookbooks/mysql/libraries/mysql_service_base.rb b/cookbooks/mysql/libraries/mysql_service_base.rb index a03b5aa..1e22d7e 100644 --- a/cookbooks/mysql/libraries/mysql_service_base.rb +++ b/cookbooks/mysql/libraries/mysql_service_base.rb @@ -41,6 +41,7 @@ module MysqlCookbook # setting up multiple services. file "#{prefix_dir}/etc/mysql/my.cnf" do action :delete + not_if { node['init_package'] == 'systemd' } end file "#{prefix_dir}/etc/my.cnf" do @@ -55,20 +56,14 @@ module MysqlCookbook end # Support directories - directory etc_dir do - owner new_resource.run_user - group new_resource.run_group - mode '0750' - recursive true - action :create - end - - directory new_resource.include_dir do - owner new_resource.run_user - group new_resource.run_group - mode '0750' - recursive true - action :create + [etc_dir, new_resource.include_dir, log_dir, new_resource.data_dir].each do |dir| + directory dir do + owner new_resource.run_user + group new_resource.run_group + mode '0750' + recursive true + action :create + end end directory run_dir do @@ -79,22 +74,6 @@ module MysqlCookbook action :create end - directory log_dir do - owner new_resource.run_user - group new_resource.run_group - mode '0750' - recursive true - action :create - end - - directory new_resource.data_dir do - owner new_resource.run_user - group new_resource.run_group - mode '0750' - recursive true - action :create - end - # Main configuration file template "#{etc_dir}/my.cnf" do source 'my.cnf.erb' @@ -171,7 +150,7 @@ module MysqlCookbook template '/etc/apparmor.d/usr.sbin.mysqld' do cookbook 'mysql' - source 'apparmor/usr.sbin.mysqld.erb' + source "apparmor/#{node['platform']}-#{node['platform_version']}/usr.sbin.mysqld.erb" owner 'root' group 'root' mode '0644' diff --git a/cookbooks/mysql/libraries/mysql_service_manager_systemd.rb b/cookbooks/mysql/libraries/mysql_service_manager_systemd.rb index 5c6880a..acf46f1 100644 --- a/cookbooks/mysql/libraries/mysql_service_manager_systemd.rb +++ b/cookbooks/mysql/libraries/mysql_service_manager_systemd.rb @@ -1,6 +1,7 @@ module MysqlCookbook class MysqlServiceManagerSystemd < MysqlServiceBase resource_name :mysql_service_manager_systemd + provides :mysql_service_manager_systemd provides :mysql_service_manager, os: 'linux' do |_node| Chef::Platform::ServiceHelpers.service_resource_providers.include?(:systemd) @@ -48,7 +49,9 @@ module MysqlCookbook config: new_resource, etc_dir: etc_dir, base_dir: base_dir, - mysqld_bin: mysqld_bin + mysqld_bin: mysqld_bin, + mysql_systemd_start_pre: mysql_systemd_start_pre, + mysql_systemd: mysql_systemd ) cookbook 'mysql' notifies :run, "execute[#{new_resource.instance} systemctl daemon-reload]", :immediately diff --git a/cookbooks/mysql/libraries/mysql_service_manager_sysvinit.rb b/cookbooks/mysql/libraries/mysql_service_manager_sysvinit.rb index 5608dec..563ab77 100644 --- a/cookbooks/mysql/libraries/mysql_service_manager_sysvinit.rb +++ b/cookbooks/mysql/libraries/mysql_service_manager_sysvinit.rb @@ -1,6 +1,7 @@ module MysqlCookbook class MysqlServiceManagerSysvinit < MysqlServiceBase resource_name :mysql_service_manager_sysvinit + provides :mysql_service_manager_sysvinit provides :mysql_service_manager, os: 'linux' diff --git a/cookbooks/mysql/libraries/mysql_service_manager_upstart.rb b/cookbooks/mysql/libraries/mysql_service_manager_upstart.rb index f8f28c2..f547e35 100644 --- a/cookbooks/mysql/libraries/mysql_service_manager_upstart.rb +++ b/cookbooks/mysql/libraries/mysql_service_manager_upstart.rb @@ -1,6 +1,7 @@ module MysqlCookbook class MysqlServiceManagerUpstart < MysqlServiceBase resource_name :mysql_service_manager_upstart + provides :mysql_service_manager_upstart provides :mysql_service_manager, platform_family: 'debian' do |_node| Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart) && diff --git a/cookbooks/mysql/metadata.json b/cookbooks/mysql/metadata.json index f847f3b..e78d557 100644 --- a/cookbooks/mysql/metadata.json +++ b/cookbooks/mysql/metadata.json @@ -1 +1 @@ -{"name":"mysql","version":"8.5.1","description":"Provides mysql_service, mysql_config, and mysql_client resources","long_description":"","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"redhat":">= 6.0","centos":">= 6.0","scientific":">= 6.0","oracle":">= 6.0","amazon":">= 0.0.0","fedora":">= 0.0.0","debian":">= 7.0","ubuntu":">= 12.04","opensuse":">= 13.0","opensuseleap":">= 0.0.0","suse":">= 12.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/mysql","issues_url":"https://github.com/chef-cookbooks/mysql/issues","chef_version":[[">= 12.7"]],"ohai_version":[]} \ No newline at end of file +{"name":"mysql","version":"8.7.3","description":"Provides mysql_service, mysql_config, and mysql_client resources","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"redhat":">= 6.0","centos":">= 6.0","scientific":">= 6.0","oracle":">= 6.0","amazon":">= 0.0.0","fedora":">= 0.0.0","debian":">= 7.0","ubuntu":">= 14.04","opensuseleap":">= 0.0.0","suse":">= 12.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/mysql","issues_url":"https://github.com/sous-chefs/mysql/issues","chef_version":[[">= 12.7"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld-instance.erb b/cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld-instance.erb index 130beb7..e3bbb05 100644 --- a/cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld-instance.erb +++ b/cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld-instance.erb @@ -11,4 +11,5 @@ <%= @config.socket_file %> rw, /tmp/<%= @mysql_name %>/ r, /tmp/<%= @mysql_name %>/my.sql r, +<%= @config.tmp_dir %>/ rw, <%= @config.tmp_dir %>/* rw, diff --git a/cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld.erb b/cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld.erb deleted file mode 100644 index 19ddbf5..0000000 --- a/cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld.erb +++ /dev/null @@ -1,47 +0,0 @@ -# vim:syntax=apparmor -# Last Modified: Tue Jun 19 17:37:30 2007 -#include - -/usr/sbin/mysqld { - #include - #include - #include - #include - #include - - capability dac_override, - capability sys_resource, - capability setgid, - capability setuid, - - network tcp, - - /etc/hosts.allow r, - /etc/hosts.deny r, - - /etc/mysql/*.pem r, - /etc/mysql/conf.d/ r, - /etc/mysql/conf.d/* r, - /etc/mysql/*.cnf r, - /usr/lib/mysql/plugin/ r, - /usr/lib/mysql/plugin/*.so* mr, - /usr/sbin/mysqld mr, - /usr/share/mysql/** r, - /var/log/mysql.log rw, - /var/log/mysql.err rw, - /var/lib/mysql/ r, - /var/lib/mysql/** rwk, - /var/log/mysql/ r, - /var/log/mysql/* rw, - /var/run/mysqld/mysqld.pid rw, - /var/run/mysqld/mysqld.sock w, - /var/run/mysqld/mysqld.sock.lock rw, - /run/mysqld/mysqld.pid rw, - /run/mysqld/mysqld.sock w, - /run/mysqld/mysqld.sock.lock rw, - - /sys/devices/system/cpu/ r, - - # Site-specific additions and overrides. See local/README for details. - #include -} diff --git a/cookbooks/mysql/templates/default/systemd/mysqld.service.erb b/cookbooks/mysql/templates/default/systemd/mysqld.service.erb index f1fb6c1..1a5cd41 100644 --- a/cookbooks/mysql/templates/default/systemd/mysqld.service.erb +++ b/cookbooks/mysql/templates/default/systemd/mysqld.service.erb @@ -7,10 +7,15 @@ After=network.target Type=simple User=<%= @config.run_user %> Group=<%= @config.run_group %> +PermissionsStartOnly=true +ExecStartPre=<%= @mysql_systemd_start_pre %> + ExecStart=<%= @mysqld_bin %> --defaults-file=<%= @etc_dir %>/my.cnf --basedir=<%= @base_dir %> -ExecStartPost=/usr/libexec/mysql-<%= @config.instance %>-wait-ready $MAINPID +ExecStartPost=<%= @mysql_systemd %> TimeoutSec=300 -PrivateTmp=true +Restart=on-failure +RuntimeDirectory=mysqld +RuntimeDirectoryMode=755 [Install] WantedBy=multi-user.target diff --git a/cookbooks/php-fpm/.foodcritic b/cookbooks/php-fpm/.foodcritic deleted file mode 100644 index 55a27da..0000000 --- a/cookbooks/php-fpm/.foodcritic +++ /dev/null @@ -1 +0,0 @@ -~FC015 diff --git a/cookbooks/php-fpm/README.md b/cookbooks/php-fpm/README.md deleted file mode 100644 index a503473..0000000 --- a/cookbooks/php-fpm/README.md +++ /dev/null @@ -1,142 +0,0 @@ -[![Build Status](https://travis-ci.org/yevgenko/cookbook-php-fpm.svg?branch=master)](https://travis-ci.org/yevgenko/cookbook-php-fpm) - -# Description - -Installs and configures PHP-FPM (FastCGI Process Manager), an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. It's like the `unicorn` of the PHP world dawg. - -# Requirements - -## Platform - -- Debian, Ubuntu -- CentOS, Red Hat, Fedora -- Amazon Linux - -## Cookbooks - -- none - -## Chef - -- 12.14 or later - -# Description - -Creates a PHP-FPM configuration file at the path specified. Meant to be deployed with a service init scheme/supervisor such as runit. Please see the `application::php-fpm` recipe for a complete working example. In depth information about PHP-FPM's configuration values can be [found in the PHP-FPM documentation](http://php.net/manual/en/install.fpm.configuration.php). - -# Usage - -Simply include the recipe where you want PHP-FPM installed. Default pool **www** will be created. To disable pool creation set default['php-fpm']['pools'] to false. - -To customize settings and pools you can override default attributes. - -## Usage in roles: - -```ruby -name "php-fpm" -description "php fpm role" -run_list "recipe[php-fpm]" -override_attributes "php-fpm" => { - "pools" => { - "default" => { - :enable => true - }, - "www" => { - :enable => "true", - :cookbook => "another-cookbook", - :process_manager => "dynamic", - :max_requests => 5000, - :php_options => { 'php_admin_flag[log_errors]' => 'on', 'php_admin_value[memory_limit]' => '32M' } - } - } -} -``` - -# Creating pools in recipes - -## Create PHP-FPM pool named 'www' with default settings: - -```ruby -php_fpm_pool "www" -``` - -## Create PHP-FPM pool named 'www' with custom settings: - -```ruby -php_fpm_pool "www" do - cookbook "another-cookbook" # get template from another cookbook - process_manager "dynamic" - max_requests 5000 - php_options 'php_admin_flag[log_errors]' => 'on', 'php_admin_value[memory_limit]' => '32M' -end -``` - -## Delete PHP-FPM pool named 'www': - -```ruby -php_fpm_pool "www" do - enable false -end -``` - -# Development - -## Requirements - -- [Docker](https://www.docker.com/) - -## Setup - -To get all dependencies: - -``` -bundle install -``` - -## Test - -To see available platforms: - -``` -bundle exec rake -T -``` - -To test particular platform: - -``` -bundle exec rake kitchen:default-ubuntu-1604 -``` - -To test all platforms: - -``` -bundle exec rake kitchen:all -``` - -## Publishing (maintainers only!) - -Bump version in metadata.rb, commit and push to master! - -``` -bundle exec rake publish -``` - -as a result new tag will be created and pushed to github as well as new version will be published on - -# Contributing - -Please do not bump version when proposing a change, no other rules ;) - -# License and Author - -Author:: Seth Chisamore ([schisamo@chef.io](mailto:schisamo@chef.io)) - -Copyright:: 2011-2017, Chef Software, Inc - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -``` -http://www.apache.org/licenses/LICENSE-2.0 -``` - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/cookbooks/php-fpm/attributes/default.rb b/cookbooks/php-fpm/attributes/default.rb deleted file mode 100644 index e77c7ed..0000000 --- a/cookbooks/php-fpm/attributes/default.rb +++ /dev/null @@ -1,71 +0,0 @@ -case node['platform_family'] -when 'rhel', 'fedora' - user = 'apache' - group = 'apache' - conf_dir = '/etc/php.d' - pool_conf_dir = '/etc/php-fpm.d' - conf_file = '/etc/php-fpm.conf' - error_log = '/var/log/php-fpm/error.log' - pid = '/var/run/php-fpm/php-fpm.pid' -else - user = 'www-data' - group = 'www-data' - if platform?('ubuntu') && node['platform_version'].to_f >= 16.04 - php_conf_dir = '/etc/php/7.0' - php_fpm_name = 'php7.0-fpm' - else - php_conf_dir = '/etc/php5' - php_fpm_name = 'php5-fpm' - end - conf_dir = "#{php_conf_dir}/fpm/conf.d" - pool_conf_dir = "#{php_conf_dir}/fpm/pool.d" - conf_file = "#{php_conf_dir}/fpm/php-fpm.conf" - error_log = "/var/log/#{php_fpm_name}.log" - pid = "/var/run/#{php_fpm_name}.pid" -end - -default['php-fpm']['user'] = user -default['php-fpm']['group'] = group -default['php-fpm']['conf_dir'] = conf_dir -default['php-fpm']['pool_conf_dir'] = pool_conf_dir -default['php-fpm']['conf_file'] = conf_file -default['php-fpm']['pid'] = pid -default['php-fpm']['log_dir'] = '/var/log/php-fpm' -default['php-fpm']['error_log'] = error_log -default['php-fpm']['log_level'] = 'notice' -default['php-fpm']['emergency_restart_threshold'] = 0 -default['php-fpm']['emergency_restart_interval'] = 0 -default['php-fpm']['process_control_timeout'] = 0 -default['php-fpm']['process_manager'] = 'ondemand' -default['php-fpm']['max_children'] = 50 -default['php-fpm']['start_servers'] = 5 -default['php-fpm']['min_spare_servers'] = 5 -default['php-fpm']['max_spare_servers'] = 35 -default['php-fpm']['max_requests'] = 0 -default['php-fpm']['request_terminate_timeout'] = 0 -default['php-fpm']['catch_workers_output'] = 'no' -default['php-fpm']['security_limit_extensions'] = '.php' -default['php-fpm']['listen_mode'] = '0660' -default['php-fpm']['listen'] = '/var/run/php-fpm-%{pool_name}.sock' - -default['php-fpm']['pools'] = { - 'www' => { - enable: true, - }, -} - -default['php-fpm']['skip_repository_install'] = false -default['php-fpm']['installation_action'] = :install -default['php-fpm']['version'] = nil - -case node['platform_family'] -when 'rhel' - default['php-fpm']['yum_url'] = 'http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/' - default['php-fpm']['yum_mirrorlist'] = 'http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror' -when 'fedora' - default['php-fpm']['skip_repository_install'] = true -end - -default['php-fpm']['dotdeb_repository']['uri'] = 'http://packages.dotdeb.org' -default['php-fpm']['dotdeb_repository']['key'] = 'http://www.dotdeb.org/dotdeb.gpg' -default['php-fpm']['dotdeb-php53_repository']['uri'] = 'http://php53.dotdeb.org' diff --git a/cookbooks/php-fpm/definitions/php_fpm_pool.rb b/cookbooks/php-fpm/definitions/php_fpm_pool.rb deleted file mode 100644 index 12fc383..0000000 --- a/cookbooks/php-fpm/definitions/php_fpm_pool.rb +++ /dev/null @@ -1,65 +0,0 @@ -# -# Cookbook Name:: php-fpm -# Definition:: php_fpm_pool -# -# Copyright 2008-2017, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -define :php_fpm_pool, template: 'pool.conf.erb', enable: true do - pool_name = params[:name] - - conf_file = "#{node['php-fpm']['pool_conf_dir']}/#{pool_name}.conf" - - if params[:enable] - template conf_file do - only_if "test -d #{node['php-fpm']['pool_conf_dir']} || mkdir -p #{node['php-fpm']['pool_conf_dir']}" - source params[:template] - owner 'root' - group 'root' - mode '0644' - cookbook params[:cookbook] || 'php-fpm' - variables( - pool_name: pool_name, - listen: params[:listen] || node['php-fpm']['listen'].gsub(/%{pool_name}/, pool_name), - listen_owner: params[:listen_owner] || node['php-fpm']['listen_owner'] || node['php-fpm']['user'], - listen_group: params[:listen_group] || node['php-fpm']['listen_group'] || node['php-fpm']['group'], - listen_mode: params[:listen_mode] || node['php-fpm']['listen_mode'], - allowed_clients: params[:allowed_clients], - user: params[:user] || node['php-fpm']['user'], - group: params[:group] || node['php-fpm']['group'], - process_manager: params[:process_manager] || node['php-fpm']['process_manager'], - max_children: params[:max_children] || node['php-fpm']['max_children'], - start_servers: params[:start_servers] || node['php-fpm']['start_servers'], - min_spare_servers: params[:min_spare_servers] || node['php-fpm']['min_spare_servers'], - max_spare_servers: params[:max_spare_servers] || node['php-fpm']['max_spare_servers'], - max_requests: params[:max_requests] || node['php-fpm']['max_requests'], - catch_workers_output: params[:catch_workers_output] || node['php-fpm']['catch_workers_output'], - security_limit_extensions: params[:security_limit_extensions] || node['php-fpm']['security_limit_extensions'], - access_log: params[:access_log] || false, - slowlog: params[:slowlog] || false, - request_slowlog_timeout: params[:request_slowlog_timeout] || false, - php_options: params[:php_options] || {}, - request_terminate_timeout: params[:request_terminate_timeout] || node['php-fpm']['request_terminate_timeout'], - params: params - ) - notifies :restart, 'service[php-fpm]' - end - else - cookbook_file conf_file do - action :delete - notifies :restart, 'service[php-fpm]' - end - end -end diff --git a/cookbooks/php-fpm/metadata.json b/cookbooks/php-fpm/metadata.json deleted file mode 100644 index 5fc4dbe..0000000 --- a/cookbooks/php-fpm/metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"php-fpm","version":"0.8.0","description":"Installs/Configures php-fpm","long_description":"[![Build Status](https://travis-ci.org/yevgenko/cookbook-php-fpm.svg?branch=master)](https://travis-ci.org/yevgenko/cookbook-php-fpm)\n\n# Description\n\nInstalls and configures PHP-FPM (FastCGI Process Manager), an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. It's like the `unicorn` of the PHP world dawg.\n\n# Requirements\n\n## Platform\n\n- Debian, Ubuntu\n- CentOS, Red Hat, Fedora\n- Amazon Linux\n\n## Cookbooks\n\n- none\n\n## Chef\n\n- 12.14 or later\n\n# Description\n\nCreates a PHP-FPM configuration file at the path specified. Meant to be deployed with a service init scheme/supervisor such as runit. Please see the `application::php-fpm` recipe for a complete working example. In depth information about PHP-FPM's configuration values can be [found in the PHP-FPM documentation](http://php.net/manual/en/install.fpm.configuration.php).\n\n# Usage\n\nSimply include the recipe where you want PHP-FPM installed. Default pool **www** will be created. To disable pool creation set default['php-fpm']['pools'] to false.\n\nTo customize settings and pools you can override default attributes.\n\n## Usage in roles:\n\n```ruby\nname \"php-fpm\"\ndescription \"php fpm role\"\nrun_list \"recipe[php-fpm]\"\noverride_attributes \"php-fpm\" => {\n \"pools\" => {\n \"default\" => {\n :enable => true\n },\n \"www\" => {\n :enable => \"true\",\n :cookbook => \"another-cookbook\",\n :process_manager => \"dynamic\",\n :max_requests => 5000,\n :php_options => { 'php_admin_flag[log_errors]' => 'on', 'php_admin_value[memory_limit]' => '32M' }\n }\n }\n}\n```\n\n# Creating pools in recipes\n\n## Create PHP-FPM pool named 'www' with default settings:\n\n```ruby\nphp_fpm_pool \"www\"\n```\n\n## Create PHP-FPM pool named 'www' with custom settings:\n\n```ruby\nphp_fpm_pool \"www\" do\n cookbook \"another-cookbook\" # get template from another cookbook\n process_manager \"dynamic\"\n max_requests 5000\n php_options 'php_admin_flag[log_errors]' => 'on', 'php_admin_value[memory_limit]' => '32M'\nend\n```\n\n## Delete PHP-FPM pool named 'www':\n\n```ruby\nphp_fpm_pool \"www\" do\n enable false\nend\n```\n\n# Development\n\n## Requirements\n\n- [Docker](https://www.docker.com/)\n\n## Setup\n\nTo get all dependencies:\n\n```\nbundle install\n```\n\n## Test\n\nTo see available platforms:\n\n```\nbundle exec rake -T\n```\n\nTo test particular platform:\n\n```\nbundle exec rake kitchen:default-ubuntu-1604\n```\n\nTo test all platforms:\n\n```\nbundle exec rake kitchen:all\n```\n\n## Publishing (maintainers only!)\n\nBump version in metadata.rb, commit and push to master!\n\n```\nbundle exec rake publish\n```\n\nas a result new tag will be created and pushed to github as well as new version will be published on \n\n# Contributing\n\nPlease do not bump version when proposing a change, no other rules ;)\n\n# License and Author\n\nAuthor:: Seth Chisamore ([schisamo@chef.io](mailto:schisamo@chef.io))\n\nCopyright:: 2011-2017, Chef Software, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n```\nhttp://www.apache.org/licenses/LICENSE-2.0\n```\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"debian":">= 0.0.0","ubuntu":">= 0.0.0","centos":">= 0.0.0","redhat":">= 0.0.0","fedora":">= 0.0.0","amazon":">= 0.0.0","oracle":">= 0.0.0","scientific":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/yevgenko/cookbook-php-fpm","issues_url":"https://github.com/yevgenko/cookbook-php-fpm/issues","chef_version":[[">= 12.14"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/php-fpm/recipes/configure.rb b/cookbooks/php-fpm/recipes/configure.rb deleted file mode 100644 index 26bfb8d..0000000 --- a/cookbooks/php-fpm/recipes/configure.rb +++ /dev/null @@ -1,43 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: php-fpm -# Recipe:: package -# -# Copyright 2011-2017, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -template node['php-fpm']['conf_file'] do - source 'php-fpm.conf.erb' - mode 00644 - owner 'root' - group 'root' - notifies :restart, 'service[php-fpm]' -end - -if node['php-fpm']['pools'] - node['php-fpm']['pools'].each do |pool| - if pool.is_a?(Array) - pool_name = pool[0] - pool = pool[1] - else - pool_name = pool[:name] - end - php_fpm_pool pool_name do - pool.each do |k, v| - params[k.to_sym] = v - end - end - end -end diff --git a/cookbooks/php-fpm/recipes/default.rb b/cookbooks/php-fpm/recipes/default.rb deleted file mode 100644 index 652298a..0000000 --- a/cookbooks/php-fpm/recipes/default.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: php-fpm -# Recipe:: default -# -# Copyright 2011-2017, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe 'php-fpm::install' -include_recipe 'php-fpm::configure' diff --git a/cookbooks/php-fpm/recipes/install.rb b/cookbooks/php-fpm/recipes/install.rb deleted file mode 100644 index 5249919..0000000 --- a/cookbooks/php-fpm/recipes/install.rb +++ /dev/null @@ -1,59 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: php-fpm -# Recipe:: package -# -# Copyright 2011-2017, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe 'php-fpm::repository' unless node['php-fpm']['skip_repository_install'] - -php_fpm_package_name = if node['php-fpm']['package_name'].nil? - if platform_family?('rhel', 'fedora') - 'php-fpm' - elsif platform?('ubuntu') && node['platform_version'].to_f >= 16.04 - 'php7.0-fpm' - else - 'php5-fpm' - end - else - node['php-fpm']['package_name'] - end - -package php_fpm_package_name do - action node['php-fpm']['installation_action'] - version node['php-fpm']['version'] if node['php-fpm']['version'] -end - -php_fpm_service_name = if node['php-fpm']['service_name'].nil? - php_fpm_package_name - else - node['php-fpm']['service_name'] - end - -service_provider = nil -# this is actually already done in chef, but is kept here for older chef releases -if platform?('ubuntu') && node['platform_version'].to_f.between?(13.10, 14.10) - service_provider = ::Chef::Provider::Service::Upstart -end - -directory node['php-fpm']['log_dir'] - -service 'php-fpm' do - provider service_provider if service_provider - service_name php_fpm_service_name - supports start: true, stop: true, restart: true, reload: true - action [:enable, :start] -end diff --git a/cookbooks/php-fpm/recipes/repository.rb b/cookbooks/php-fpm/recipes/repository.rb deleted file mode 100644 index a0a6c0c..0000000 --- a/cookbooks/php-fpm/recipes/repository.rb +++ /dev/null @@ -1,54 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: php-fpm -# Recipe:: package -# -# Copyright 2011-2017, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -case node['platform'] -when 'debian' - # Configure Dotdeb repos - # TODO: move this to it's own 'dotdeb' cookbook? - # http://www.dotdeb.org/instructions/ - if node['platform_version'].to_f >= 8.0 - apt_repository 'dotdeb' do - uri node['php-fpm']['dotdeb_repository']['uri'] - distribution 'jessie' - components ['all'] - key node['php-fpm']['dotdeb_repository']['key'] - action :add - end - elsif node['platform_version'].to_f >= 7.0 - apt_repository 'dotdeb' do - uri node['php-fpm']['dotdeb_repository']['uri'] - distribution 'wheezy' - components ['all'] - key node['php-fpm']['dotdeb_repository']['key'] - action :add - end - end - -when 'amazon', 'fedora', 'centos', 'redhat', 'scientific', 'oracle' - unless platform?('centos', 'redhat') && node['platform_version'].to_f >= 6.4 # ~FC024 - yum_repository 'remi' do - description 'Remi' - url node['php-fpm']['yum_url'] - mirrorlist node['php-fpm']['yum_mirrorlist'] - gpgkey 'http://rpms.famillecollet.com/RPM-GPG-KEY-remi' - action :add - end - end -end diff --git a/cookbooks/php-fpm/recipes/test.rb b/cookbooks/php-fpm/recipes/test.rb deleted file mode 100644 index eff3d5f..0000000 --- a/cookbooks/php-fpm/recipes/test.rb +++ /dev/null @@ -1,3 +0,0 @@ -include_recipe 'php-fpm::default' - -package 'net-tools' diff --git a/cookbooks/php-fpm/templates/php-fpm.conf.erb b/cookbooks/php-fpm/templates/php-fpm.conf.erb deleted file mode 100644 index 900eb7c..0000000 --- a/cookbooks/php-fpm/templates/php-fpm.conf.erb +++ /dev/null @@ -1,60 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;; -; FPM Configuration ; -;;;;;;;;;;;;;;;;;;;;; - -; All relative paths in this configuration file are relative to PHP's install -; prefix. - -; Include one or more files. If glob(3) exists, it is used to include a bunch of -; files from a glob(3) pattern. This directive can be used everywhere in the -; file. -include = <%= "#{node['php-fpm']['pool_conf_dir']}/*.conf" %> - -;;;;;;;;;;;;;;;;;; -; Global Options ; -;;;;;;;;;;;;;;;;;; - -[global] -; Pid file -; Default Value: none -pid = <%= node['php-fpm']['pid'] %> - -; Error log file -; Default Value: /var/log/php-fpm.log -error_log = <%= node['php-fpm']['error_log'] %> - -; Log level -; Possible Values: alert, error, warning, notice, debug -; Default Value: notice -log_level = <%= node['php-fpm']['log_level'] %> - -; If this number of child processes exit with SIGSEGV or SIGBUS within the time -; interval set by emergency_restart_interval then FPM will restart. A value -; of '0' means 'Off'. -; Default Value: 0 -emergency_restart_threshold = <%= node['php-fpm']['emergency_restart_threshold'] %> - -; Interval of time used by emergency_restart_interval to determine when -; a graceful restart will be initiated. This can be useful to work around -; accidental corruptions in an accelerator's shared memory. -; Available Units: s(econds), m(inutes), h(ours), or d(ays) -; Default Unit: seconds -; Default Value: 0 -emergency_restart_interval = <%= node['php-fpm']['emergency_restart_interval'] %> - -; Time limit for child processes to wait for a reaction on signals from master. -; Available units: s(econds), m(inutes), h(ours), or d(ays) -; Default Unit: seconds -; Default Value: 0 -process_control_timeout = <%= node['php-fpm']['process_control_timeout'] %> - -; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. -; Default Value: yes -daemonize = yes - -;;;;;;;;;;;;;;;;;;;; -; Pool Definitions ; -;;;;;;;;;;;;;;;;;;;; - -; See <%= "#{node['php-fpm']['pool_conf_dir']}/*.conf" %> - diff --git a/cookbooks/php-fpm/templates/pool.conf.erb b/cookbooks/php-fpm/templates/pool.conf.erb deleted file mode 100644 index ec4fbf3..0000000 --- a/cookbooks/php-fpm/templates/pool.conf.erb +++ /dev/null @@ -1,424 +0,0 @@ -; Start a new pool named '<%= @pool_name %>'. -; the variable $pool can we used in any directive and will be replaced by the -; pool name ('<%= @pool_name %>' here) -[<%= @pool_name %>] - -; Per pool prefix -; It only applies on the following directives: -; - 'slowlog' -; - 'listen' (unixsocket) -; - 'chroot' -; - 'chdir' -; - 'php_values' -; - 'php_admin_values' -; When not set, the global prefix (or /usr) applies instead. -; Note: This directive can also be relative to the global prefix. -; Default Value: none -;prefix = /path/to/pools/$pool - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = <%= @user %> -group = <%= @group %> - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on -; a specific port; -; 'port' - to listen on a TCP socket to all addresses on a -; specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -listen = <%= @listen %> - -; Set listen(2) backlog. -; Default Value: 128 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 128 - -; Set permissions for unix socket, if one is used. In Linux, read/write -; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. -; Default Values: user and group are set as the running user -; mode is set to 0666 - -;listen.owner = nobody -<% unless @listen_owner.nil? %> -listen.owner = <%= @listen_owner %> -<% end %> - -;listen.group = nobody -<% unless @listen_group.nil? %> -listen.group = <%= @listen_group %> -<% end %> - -listen.mode = <%= @listen_mode %> - -; List of ipv4 addresses of FastCGI clients which are allowed to connect. -; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original -; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address -; must be separated by a comma. If this value is left blank, connections will be -; accepted from any ip address. -; Default Value: any -listen.allowed_clients = <%= @allowed_clients ? ([@allowed_clients].flatten.join(',')) : "127.0.0.1" %> - -; Specify the nice(2) priority to apply to the pool processes (only if set) -; The value can vary from -19 (highest priority) to 20 (lower priority) -; Note: - It will only work if the FPM master process is launched as root -; - The pool processes will inherit the master process priority -; unless it specified otherwise -; Default Value: no set -; priority = -19 - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = <%= @process_manager %> - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = <%= @max_children %> - -<% if @process_manager == "dynamic" %> -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -<% if @start_servers %> -pm.start_servers = <%= @start_servers %> -<% end %> - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = <%= @min_spare_servers %> - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = <%= @max_spare_servers %> -<% end %> - -<% if @process_manager == "ondemand" %> -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; -<% end %> - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -pm.max_requests = <%= @max_requests %> - -; The URI to view the FPM status page. If this value is not set, no URI will be -; recognized as a status page. It shows the following informations: -; pool - the name of the pool; -; process manager - static, dynamic or ondemand; -; start time - the date and time FPM has started; -; start since - number of seconds since FPM has started; -; accepted conn - the number of request accepted by the pool; -; listen queue - the number of request in the queue of pending -; connections (see backlog in listen(2)); -; max listen queue - the maximum number of requests in the queue -; of pending connections since FPM has started; -; listen queue len - the size of the socket queue of pending connections; -; idle processes - the number of idle processes; -; active processes - the number of active processes; -; total processes - the number of idle + active processes; -; max active processes - the maximum number of active processes since FPM -; has started; -; max children reached - number of times, the process limit has been reached, -; when pm tries to start more children (works only for -; pm 'dynamic' and 'ondemand'); -; Value are updated in real time. -; Example output: -; pool: www -; process manager: static -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 62636 -; accepted conn: 190460 -; listen queue: 0 -; max listen queue: 1 -; listen queue len: 42 -; idle processes: 4 -; active processes: 11 -; total processes: 15 -; max active processes: 12 -; max children reached: 0 -; -; By default the status page output is formatted as text/plain. Passing either -; 'html', 'xml' or 'json' in the query string will return the corresponding -; output syntax. Example: -; http://www.foo.bar/status -; http://www.foo.bar/status?json -; http://www.foo.bar/status?html -; http://www.foo.bar/status?xml -; -; By default the status page only outputs short status. Passing 'full' in the -; query string will also return status for each pool process. -; Example: -; http://www.foo.bar/status?full -; http://www.foo.bar/status?json&full -; http://www.foo.bar/status?html&full -; http://www.foo.bar/status?xml&full -; The Full status returns for each process: -; pid - the PID of the process; -; state - the state of the process (Idle, Running, ...); -; start time - the date and time the process has started; -; start since - the number of seconds since the process has started; -; requests - the number of requests the process has served; -; request duration - the duration in ms of the requests; -; request method - the request method (GET, POST, ...); -; request URI - the request URI with the query string; -; content length - the content length of the request (only with POST); -; user - the user (PHP_AUTH_USER) (or '-' if not set); -; script - the main script called (or '-' if not set); -; last request cpu - the %cpu the last request consumed -; it's always 0 if the process is not in Idle state -; because CPU calculation is done when the request -; processing has terminated; -; last request memory - the max amount of memory the last request consumed -; it's always 0 if the process is not in Idle state -; because memory calculation is done when the request -; processing has terminated; -; If the process is in Idle state, then informations are related to the -; last request the process has served. Otherwise informations are related to -; the current request being served. -; Example output: -; ************************ -; pid: 31330 -; state: Running -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 63087 -; requests: 12808 -; request duration: 1250261 -; request method: GET -; request URI: /test_mem.php?N=10000 -; content length: 0 -; user: - -; script: /home/fat/web/docs/php/test_mem.php -; last request cpu: 0.00 -; last request memory: 0 -; -; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: ${prefix}/share/fpm/status.html -; -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;pm.status_path = /status - -; The ping URI to call the monitoring page of FPM. If this value is not set, no -; URI will be recognized as a ping page. This could be used to test from outside -; that FPM is alive and responding, or to -; - create a graph of FPM availability (rrd or such); -; - remove a server from a group if it is not responding (load balancing); -; - trigger alerts for the operating team (24/7). -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;ping.path = /ping - -; This directive may be used to customize the response of a ping request. The -; response is formatted as text/plain with a 200 response code. -; Default Value: pong -;ping.response = pong - -; The access log file -; Default: not set -<% if @access_log %> -access.log = <%= node['php-fpm']['log_dir'] %>/$pool.access.log -<% end %> - -; The access log format. -; The following syntax is allowed -; %%: the '%' character -; %C: %CPU used by the request -; it can accept the following format: -; - %{user}C for user CPU only -; - %{system}C for system CPU only -; - %{total}C for user + system CPU (default) -; %d: time taken to serve the request -; it can accept the following format: -; - %{seconds}d (default) -; - %{miliseconds}d -; - %{mili}d -; - %{microseconds}d -; - %{micro}d -; %e: an environment variable (same as $_ENV or $_SERVER) -; it must be associated with embraces to specify the name of the env -; variable. Some exemples: -; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e -; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e -; %f: script filename -; %l: content-length of the request (for POST request only) -; %m: request method -; %M: peak of memory allocated by PHP -; it can accept the following format: -; - %{bytes}M (default) -; - %{kilobytes}M -; - %{kilo}M -; - %{megabytes}M -; - %{mega}M -; %n: pool name -; %o: output header -; it must be associated with embraces to specify the name of the header: -; - %{Content-Type}o -; - %{X-Powered-By}o -; - %{Transfert-Encoding}o -; - .... -; %p: PID of the child that serviced the request -; %P: PID of the parent of the child that serviced the request -; %q: the query string -; %Q: the '?' character if query string exists -; %r: the request URI (without the query string, see %q and %Q) -; %R: remote IP address -; %s: status (response code) -; %t: server time the request was received -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; %T: time the log has been written (the request has finished) -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; %u: remote user -; -; Default: "%R - %u %t \"%m %r\" %s" -;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - -; The log file for slow requests -; Default Value: not set -; Note: slowlog is mandatory if request_slowlog_timeout is set -<% if @slowlog %> -slowlog = <%= @slowlog %> -<% else %> -;slowlog = log/$pool.log.slow -<% end %> - -; The timeout for serving a single request after which a PHP backtrace will be -; dumped to the 'slowlog' file. A value of '0s' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -<% if @request_slowlog_timeout %> -request_slowlog_timeout = <%=@request_slowlog_timeout %> -<% else %> -;request_slowlog_timeout = 0 -<% end %> - -; The timeout for serving a single request after which the worker process will -; be killed. This option should be used when the 'max_execution_time' ini option -; does not stop script execution for some reason. A value of '0' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -request_terminate_timeout = <%=@request_terminate_timeout %> - -; Set open file descriptor rlimit. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Chroot to this directory at the start. This value must be defined as an -; absolute path. When this value is not set, chroot is not used. -; Note: you can prefix with '$prefix' to chroot to the pool prefix or one -; of its subdirectories. If the pool prefix is not set, the global prefix -; will be used instead. -; Note: chrooting is a great security feature and should be used whenever -; possible. However, all PHP paths will be relative to the chroot -; (error_log, sessions.save_path, ...). -; Default Value: not set -;chroot = - -; Chdir to this directory at the start. -; Note: relative path can be used. -; Default Value: current directory or / when chroot -;chdir = / - -; Redirect worker stdout and stderr into main error log. If not set, stdout and -; stderr will be redirected to /dev/null according to FastCGI specs. -; Note: on highloaded environement, this can cause some delay in the page -; process time (several ms). -; Default Value: no -catch_workers_output = <%= @catch_workers_output %> - -<% if node['platform'] != 'ubuntu' && node['platform_version'] != '10.04' %> -; Limits the extensions of the main script FPM will allow to parse. This can -; prevent configuration mistakes on the web server side. You should only limit -; FPM to .php extensions to prevent malicious users to use other extensions to -; exectute php code. -; Note: set an empty value to allow all extensions. -; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 -security.limit_extensions = <%=@security_limit_extensions %> -<% end %> - -; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from -; the current environment. -; Default Value: clean env -;env[HOSTNAME] = $HOSTNAME -;env[PATH] = /usr/local/bin:/usr/bin:/bin -;env[TMP] = /tmp -;env[TMPDIR] = /tmp -;env[TEMP] = /tmp - -; Additional php.ini defines, specific to this pool of workers. These settings -; overwrite the values previously defined in the php.ini. The directives are the -; same as the PHP SAPI: -; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. -; php_admin_value/php_admin_flag - these directives won't be overwritten by -; PHP call 'ini_set' -; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. - -; Defining 'extension' will load the corresponding shared extension from -; extension_dir. Defining 'disable_functions' or 'disable_classes' will not -; overwrite previously defined php.ini values, but will append the new value -; instead. - -; Note: path INI options can be relative and will be expanded with the prefix -; (pool, global or /usr) - -; Default Value: nothing is defined by default except the values in php.ini and -; specified at startup with the -d argument -;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com -;php_flag[display_errors] = off -;php_admin_value[error_log] = /var/log/fpm-php.www.log -;php_admin_flag[log_errors] = on -;php_admin_value[memory_limit] = 32M - -<% @php_options.each do |name,value| %> -<%= "#{name} = #{value}" %> -<% end %> diff --git a/cookbooks/php/CHANGELOG.md b/cookbooks/php/CHANGELOG.md index ae0c697..ddc51ab 100644 --- a/cookbooks/php/CHANGELOG.md +++ b/cookbooks/php/CHANGELOG.md @@ -1,6 +1,38 @@ -# php Cookbook CHANGELOG +# PHP Cookbook CHANGELOG -This file is used to list changes made in each version of the php cookbook. +This file is used to list changes made in each version of the PHP cookbook. + +## 8.0.0 (2020-07-09) + +- Drop support for: + - Debian 8 + - Ubuntu < 16.04 + - Amazon Linux 1 +- Set default PHP version to 7.2.x +- Update Ubuntu 18.04 support to source build PHP 7.2 +- Update attributes for Debian 10 +- Add support for Ubuntu 20.04 +- Only symlink GMP on Ubuntu 16.04 to aid source builds +- Drop support for installing from source on Debian 9 + +## 7.2.0 (2020-06-19) + +- Include extension priority on the specified format to the extension file + +## 7.1.0 (2020-05-05) + +- Split out resource documentation into the documentation folder +- Run cookstyle 0.75.1 +- Fix dependency problem with installing php from source on ubuntu 18.04 +- Simplify platform checks +- Remove unused long_description metadata from metadata.rb +- Migrated to Github Actions for testing +- Adding control of php-fpm php.ini with specific attribute + +## 7.0.0 (2019-08-07) + +- *Drop support for Chef 13* so we don't need to require build essentials +- Sync php.ini template with php.ini-production from php-7.2.18 ## 6.1.1 (2018-08-07) @@ -42,7 +74,7 @@ This release removes the previous recipes in this cookbook for setting up variou - Converted the php_pear resource to a custom resource - Moved all helper logic out of the resource and into its own helper library file -- Fix source install on Ubuntu by making sure we have xml2-config package +- Fix source install on Ubuntu by making sure we have xml2-config package - Remove options that are no longer recognised by the php installer when installing from source - Remove matchers as we no longer require them with a modern ChefDK diff --git a/cookbooks/php/CONTRIBUTING.md b/cookbooks/php/CONTRIBUTING.md index ef2f2b8..a946aea 100644 --- a/cookbooks/php/CONTRIBUTING.md +++ b/cookbooks/php/CONTRIBUTING.md @@ -1,2 +1,4 @@ +# Contributing + Please refer to -https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD +[https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) diff --git a/cookbooks/php/README.md b/cookbooks/php/README.md index 6bd2873..ae26ef1 100644 --- a/cookbooks/php/README.md +++ b/cookbooks/php/README.md @@ -1,9 +1,17 @@ # php Cookbook -[![Build Status](https://travis-ci.org/chef-cookbooks/php.svg?branch=master)](http://travis-ci.org/chef-cookbooks/php) [![Cookbook Version](https://img.shields.io/cookbook/v/php.svg)](https://supermarket.chef.io/cookbooks/php) +[![Cookbook Version](https://img.shields.io/cookbook/v/php.svg)](https://supermarket.chef.io/cookbooks/php) +[![Build Status](https://img.shields.io/circleci/project/github/sous-chefs/php/master.svg)](https://circleci.com/gh/sous-chefs/php) +[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) It installs and configures PHP and the PEAR package management system. Also includes resources for managing PEAR (and PECL) packages, PECL channels, and PHP-FPM pools. +## Maintainers + +This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). + ## Requirements ### Platforms @@ -14,18 +22,14 @@ It installs and configures PHP and the PEAR package management system. Also incl ### Chef -- Chef 12.7+ - -### Cookbooks - -- build-essential +- Chef 14+ ## Attributes - `node['php']['install_method']` = method to install php with, default `package`. - `node['php']['directives']` = Hash of directives and values to append to `php.ini`, default `{}`. - `node['php']['pear_setup']` = Boolean value to determine whether to set up pear repositories. Default: `true` -- `node['php']['pear_channels']` = List of external pear channels to add if `node['php']['pear_setup]` is true. Default: `['pear.php.net', 'pecl.php.net']` +- `node['php']['pear_channels']` = List of external pear channels to add if `node['php']['pear_setup']` is true. Default: `['pear.php.net', 'pecl.php.net']` The file also contains the following attribute types: @@ -36,175 +40,9 @@ The file also contains the following attribute types: This cookbook includes resources for managing: -- PEAR channels -- PEAR/PECL packages - -### `php_pear_channel` - -[PEAR Channels](http://pear.php.net/manual/en/guide.users.commandline.channels.php) are alternative sources for PEAR packages. This resource provides and easy way to manage these channels. - -#### Actions - -- `:discover`: Initialize a channel from its server. -- `:add`: Add a channel to the channel list, usually only used to add private channels. Public channels are usually added using the `:discover` action -- `:update`: Update an existing channel -- `:remove`: Remove a channel from the List - -#### Properties - -- `channel_name`: name attribute. The name of the channel to discover -- `channel_xml`: the channel.xml file of the channel you are adding -- `binary`: pear binary, default: pear - -#### Examples - -```ruby -# discover the horde channel -php_pear_channel "pear.horde.org" do - action :discover -end - -# download xml then add the symfony channel -remote_file "#{Chef::Config[:file_cache_path]}/symfony-channel.xml" do - source 'http://pear.symfony-project.com/channel.xml' - mode '0644' -end -php_pear_channel 'symfony' do - channel_xml "#{Chef::Config[:file_cache_path]}/symfony-channel.xml" - action :add -end - -# update the main pear channel -php_pear_channel 'pear.php.net' do - action :update -end - -# update the main pecl channel -php_pear_channel 'pecl.php.net' do - action :update -end -``` - -### `php_pear` - -[PEAR](http://pear.php.net/) is a framework and distribution system for reusable PHP components. [PECL](http://pecl.php.net/) is a repository for PHP Extensions. PECL contains C extensions for compiling into PHP. As C programs, PECL extensions run more efficiently than PEAR packages. PEARs and PECLs use the same packaging and distribution system. As such this resource is clever enough to abstract away the small differences and can be used for managing either. This resource also creates the proper module .ini file for each PECL extension at the correct location for each supported platform. - -#### Actions - -- `:install`: Install a pear package - if version is provided, install that specific version -- `:upgrade`: Upgrade a pear package - if version is provided, upgrade to that specific version -- `:remove`: Remove a pear package -- `:reinstall`: Force install of the package even if the same version is already installed. Note: This will converge on every Chef run and is probably not what you want. -- `:purge`: An alias for remove as the two behave the same in pear - -#### Properties - -- `package_name`: name attribute. The name of the pear package to install -- `version`: the version of the pear package to install/upgrade. If no version is given latest is assumed. -- `channel`: -- `options`: Add additional options to the underlying pear package command -- `directives`: extra extension directives (settings) for a pecl. on most platforms these usually get rendered into the extension's .ini file -- `zend_extensions`: extension filenames which should be loaded with zend_extension. -- `preferred_state`: PEAR by default installs stable packages only, this allows you to install pear packages in a devel, alpha or beta state -- `binary`: The pear binary to use, by default pear, can be overridden if the binary is not called pear, e.g. pear7 - -#### Examples - -```ruby -# upgrade a pear -php_pear 'XML_RPC' do - action :upgrade -end - -# install a specific version -php_pear 'XML_RPC' do - version '1.5.4' - action :install -end - -# install the mongodb pecl -php_pear 'Install mongo but use a different resource name' do - package_name 'mongo' - action :install -end - -# install the xdebug pecl -php_pear 'xdebug' do - # Specify that xdebug.so must be loaded as a zend extension - zend_extensions ['xdebug.so'] - action :install -end - -# install apc pecl with directives -php_pear 'apc' do - action :install - directives(shm_size: 128, enable_cli: 1) -end - -# install using the pear-7 binary -php_pear 'apc' do - action :install - binary 'pear7' -end - -# install the beta version of Horde_Url -# from the horde channel -hc = php_pear_channel 'pear.horde.org' do - action :discover -end - -php_pear 'Horde_Url' do - preferred_state 'beta' - channel hc.channel_name - action :install -end - -# install the YAML pear from the symfony project -sc = php_pear_channel 'pear.symfony-project.com' do - action :discover -end - -php_pear 'YAML' do - channel sc.channel_name - action :install -end -``` - -### `php_fpm_pool` - -Installs the `php-fpm` package appropriate for your distro (if using packages) and configures a FPM pool for you. Currently only supported in Debian-family operating systems and CentOS 7 (or at least tested with such, YMMV if you are using source). - -Please consider FPM functionally pre-release, and test it thoroughly in your environment before using it in production - -More info: - -#### Actions - -- `:install`: Installs the FPM pool (default). -- `:uninstall`: Removes the FPM pool. - -#### Attribute Parameters - -- `pool_name`: name attribute. The name of the FPM pool. -- `listen`: The listen address. Default: `/var/run/php5-fpm.sock` -- `user`: The user to run the FPM under. Default should be the webserver user for your distro. -- `group`: The group to run the FPM under. Default should be the webserver group for your distro. -- `process_manager`: Process manager to use - see . Default: `dynamic` -- `max_children`: Max children to scale to. Default: 5 -- `start_servers`: Number of servers to start the pool with. Default: 2 -- `min_spare_servers`: Minimum number of servers to have as spares. Default: 1 -- `max_spare_servers`: Maximum number of servers to have as spares. Default: 3 -- `chdir`: The startup working directory of the pool. Default: `/` -- `additional_config`: Additional parameters in JSON. Default: {} - -#### Examples - -```ruby -# Install a FPM pool named "default" -php_fpm_pool 'default' do - action :install -end -``` +- [php_pear](https://github.com/sous-chefs/php/tree/master/documentation/php_pear.md) +- [php_pear_channel](https://github.com/sous-chefs/php/tree/master/documentation/php_pear_channel.md) +- [php_fpm_pool](https://github.com/sous-chefs/php/tree/master/documentation/php_fpm_pool.md) ## Recipes @@ -220,11 +58,13 @@ This recipe installs PHP from packages. This recipe installs PHP from source. +*Note:* Debian 9 is not supported for building from source. + ## Usage Simply include the `php` recipe where ever you would like php installed. To install from source override the `node['php']['install_method']` attribute with in a role or wrapper cookbook: -### Role example: +### Role example ```ruby name 'php' @@ -239,25 +79,27 @@ run_list( ) ``` -## Maintainers +## Contributors -This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/) +This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) -## License +### Backers -**Copyright:** 2011-2018, Chef Software, Inc. -**Copyright:** 2018, Oracle and/or its affiliates. All rights reserved +Thank you to all our backers! -``` -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) - http://www.apache.org/licenses/LICENSE-2.0 +### Sponsors -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. + +![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) diff --git a/cookbooks/php/attributes/default.rb b/cookbooks/php/attributes/default.rb index f12383d..3528620 100644 --- a/cookbooks/php/attributes/default.rb +++ b/cookbooks/php/attributes/default.rb @@ -18,13 +18,14 @@ # lib_dir = 'lib' + default['php']['install_method'] = 'package' default['php']['directives'] = {} default['php']['bin'] = 'php' default['php']['pecl'] = 'pecl' -default['php']['version'] = '5.6.30' +default['php']['version'] = '7.2.31' default['php']['pear'] = '/usr/bin/pear' default['php']['pear_setup'] = true @@ -33,20 +34,23 @@ default['php']['pear_channels'] = [ 'pecl.php.net', ] -default['php']['url'] = 'http://us1.php.net/get' -default['php']['checksum'] = '8bc7d93e4c840df11e3d9855dcad15c1b7134e8acf0cf3b90b932baea2d0bde2' +default['php']['url'] = 'https://www.php.net/distributions' +default['php']['checksum'] = '796837831ccebf00dc15921ed327cfbac59177da41b33044d9a6c7134cdd250c' # checksum of the .tar.gz files default['php']['prefix_dir'] = '/usr/local' -default['php']['enable_mod'] = '/usr/sbin/php5enmod' -default['php']['disable_mod'] = '/usr/sbin/php5dismod' +default['php']['enable_mod'] = '/usr/sbin/phpenmod' +default['php']['disable_mod'] = '/usr/sbin/phpdismod' default['php']['ini']['template'] = 'php.ini.erb' default['php']['ini']['cookbook'] = 'php' -default['php']['fpm_socket'] = '/var/run/php5-fpm.sock' +default['php']['fpm_socket'] = '/var/run/php7.2-fpm.sock' +default['php']['fpm_conf_dir'] = nil +default['php']['fpm_ini_control'] = false case node['platform_family'] -when 'rhel', 'fedora', 'amazon' +when 'rhel', 'amazon' lib_dir = node['kernel']['machine'] =~ /x86_64/ ? 'lib64' : 'lib' + default['php']['conf_dir'] = '/etc' default['php']['ext_conf_dir'] = '/etc/php.d' default['php']['fpm_user'] = 'nobody' @@ -54,21 +58,14 @@ when 'rhel', 'fedora', 'amazon' default['php']['fpm_listen_user'] = 'nobody' default['php']['fpm_listen_group'] = 'nobody' default['php']['ext_dir'] = "/usr/#{lib_dir}/php/modules" - if node['platform'] == 'amazon' # amazon names their packages with versions on 201X amazon - default['php']['src_deps'] = %w(bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel libxml2-devel libxslt-devel zlib-devel) + default['php']['fpm_package'] = 'php-fpm' - if node['platform_version'].to_i == 2 - default['php']['packages'] = %w(php php-devel php-pear) - default['php']['fpm_package'] = 'php-fpm' - else - default['php']['packages'] = %w(php56 php56-devel php-pear) - default['php']['fpm_package'] = 'php56-fpm' - end - else # redhat does not name their packages with version on RHEL 6+ - default['php']['src_deps'] = %w(bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel libxml2-devel libxslt-devel zlib-devel mhash-devel) - default['php']['packages'] = %w(php php-devel php-cli php-pear) - default['php']['fpm_package'] = 'php-fpm' - end + default['php']['src_deps'] = if platform?('amazon') || node['platform_version'].to_i < 8 + %w(bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel libxml2-devel libxslt-devel zlib-devel mhash-devel) + else # redhat does not name their packages with version on RHEL 6+ + %w(bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel libxml2-devel libxslt-devel zlib-devel mhash-devel) + end + default['php']['packages'] = %w(php php-devel php-cli php-pear) default['php']['fpm_pooldir'] = '/etc/php-fpm.d' default['php']['fpm_default_conf'] = '/etc/php-fpm.d/www.conf' default['php']['fpm_service'] = 'php-fpm' @@ -79,86 +76,73 @@ when 'rhel', 'fedora', 'amazon' default['php']['fpm_listen_group'] = 'apache' end when 'debian' - default['php']['conf_dir'] = '/etc/php5/cli' - default['php']['ext_conf_dir'] = '/etc/php5/conf.d' - default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev libxml2-dev libxslt-dev zlib1g-dev) - default['php']['packages'] = %w(php5-cgi php5 php5-dev php5-cli php-pear) - default['php']['fpm_package'] = 'php5-fpm' - default['php']['fpm_pooldir'] = '/etc/php5/fpm/pool.d' - default['php']['fpm_user'] = 'www-data' - default['php']['fpm_group'] = 'www-data' + default['php']['version'] = '7.0.4' + default['php']['checksum'] = 'f6cdac2fd37da0ac0bbcee0187d74b3719c2f83973dfe883d5cde81c356fe0a8' + default['php']['conf_dir'] = '/etc/php/7.0/cli' + default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev) + default['php']['packages'] = %w(php7.0-cgi php7.0 php7.0-dev php7.0-cli php-pear) + default['php']['disable_mod'] = '/usr/sbin/phpdismod' + default['php']['enable_mod'] = '/usr/sbin/phpenmod' + default['php']['fpm_default_conf'] = '/etc/php/7.0/fpm/pool.d/www.conf' + default['php']['fpm_conf_dir'] = '/etc/php/7.0/fpm' + default['php']['ext_conf_dir'] = '/etc/php/7.0/mods-available' + default['php']['fpm_package'] = 'php7.0-fpm' + default['php']['fpm_pooldir'] = '/etc/php/7.0/fpm/pool.d' + default['php']['fpm_service'] = 'php7.0-fpm' + default['php']['fpm_socket'] = '/var/run/php/php7.0-fpm.sock' + default['php']['fpm_user'] = 'www-data' + default['php']['fpm_group'] = 'www-data' default['php']['fpm_listen_user'] = 'www-data' default['php']['fpm_listen_group'] = 'www-data' - default['php']['fpm_service'] = 'php5-fpm' - default['php']['fpm_default_conf'] = '/etc/php5/fpm/pool.d/www.conf' - if (platform?('debian') && node['platform_version'].to_i >= 9) || - (platform?('ubuntu') && node['platform_version'].to_f == 16.04) - default['php']['version'] = '7.0.4' - default['php']['checksum'] = 'f6cdac2fd37da0ac0bbcee0187d74b3719c2f83973dfe883d5cde81c356fe0a8' - default['php']['conf_dir'] = '/etc/php/7.0/cli' - default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev pkg-config libxml2-dev) - default['php']['packages'] = %w(php7.0-cgi php7.0 php7.0-dev php7.0-cli php-pear) - default['php']['fpm_package'] = 'php7.0-fpm' - default['php']['fpm_pooldir'] = '/etc/php/7.0/fpm/pool.d' - default['php']['fpm_service'] = 'php7.0-fpm' - default['php']['fpm_socket'] = '/var/run/php/php7.0-fpm.sock' - default['php']['fpm_default_conf'] = '/etc/php/7.0/fpm/pool.d/www.conf' - default['php']['enable_mod'] = '/usr/sbin/phpenmod' - default['php']['disable_mod'] = '/usr/sbin/phpdismod' - default['php']['ext_conf_dir'] = '/etc/php/7.0/mods-available' - elsif platform?('ubuntu') && node['platform_version'].to_f >= 18.04 - default['php']['version'] = '7.0.4' - default['php']['checksum'] = 'f6cdac2fd37da0ac0bbcee0187d74b3719c2f83973dfe883d5cde81c356fe0a8' + if platform?('debian') && node['platform_version'].to_i >= 10 + default['php']['version'] = '7.3.19' + default['php']['checksum'] = '809126b46d62a1a06c2d5a0f9d7ba61aba40e165f24d2d185396d0f9646d3280' + default['php']['conf_dir'] = '/etc/php/7.3/cli' + default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-turbo-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev file re2c libzip-dev) + # Debian >= 10 drops versions from the package names + default['php']['packages'] = %w(php-cgi php php-dev php-cli php-pear) + default['php']['fpm_package'] = 'php7.3-fpm' + default['php']['fpm_pooldir'] = '/etc/php/7.3/fpm/pool.d' + default['php']['fpm_service'] = 'php7.3-fpm' + default['php']['fpm_socket'] = '/var/run/php/php7.3-fpm.sock' + default['php']['fpm_default_conf'] = '/etc/php/7.3/fpm/pool.d/www.conf' + default['php']['fpm_conf_dir'] = '/etc/php/7.3/fpm' + default['php']['ext_conf_dir'] = '/etc/php/7.3/mods-available' + elsif platform?('ubuntu') && node['platform_version'].to_f == 18.04 + default['php']['version'] = '7.2.31' + default['php']['checksum'] = '796837831ccebf00dc15921ed327cfbac59177da41b33044d9a6c7134cdd250c' default['php']['conf_dir'] = '/etc/php/7.2/cli' - default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev pkg-config libxml2-dev) + default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev) default['php']['packages'] = %w(php7.2-cgi php7.2 php7.2-dev php7.2-cli php-pear) default['php']['fpm_package'] = 'php7.2-fpm' default['php']['fpm_pooldir'] = '/etc/php/7.2/fpm/pool.d' default['php']['fpm_service'] = 'php7.2-fpm' default['php']['fpm_socket'] = '/var/run/php/php7.2-fpm.sock' default['php']['fpm_default_conf'] = '/etc/php/7.2/fpm/pool.d/www.conf' + default['php']['fpm_conf_dir'] = '/etc/php/7.2/fpm' + default['php']['ext_conf_dir'] = '/etc/php/7.2/mods-available' + elsif platform?('ubuntu') && node['platform_version'].to_f >= 20.04 + default['php']['version'] = '7.4.7' + default['php']['checksum'] = 'a554a510190e726ebe7157fb00b4aceabdb50c679430510a3b93cbf5d7546e44' + default['php']['conf_dir'] = '/etc/php/7.4/cli' + default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev libsqlite3-dev libonig-dev) + # Ubuntu >= 20.04 drops versions from the package names + default['php']['packages'] = %w(php-cgi php php-dev php-cli php-pear) + default['php']['fpm_package'] = 'php7.4-fpm' + default['php']['fpm_pooldir'] = '/etc/php/7.4/fpm/pool.d' + default['php']['fpm_service'] = 'php7.4-fpm' + default['php']['fpm_socket'] = '/var/run/php/php7.4-fpm.sock' + default['php']['fpm_default_conf'] = '/etc/php/7.4/fpm/pool.d/www.conf' + default['php']['fpm_conf_dir'] = '/etc/php/7.4/fpm' default['php']['enable_mod'] = '/usr/sbin/phpenmod' default['php']['disable_mod'] = '/usr/sbin/phpdismod' - default['php']['ext_conf_dir'] = '/etc/php/7.2/mods-available' + default['php']['ext_conf_dir'] = '/etc/php/7.4/mods-available' end - - case node['platform'] - when 'ubuntu' - case node['platform_version'].to_f - when 13.04..15.10 - default['php']['ext_conf_dir'] = '/etc/php5/mods-available' - end - when 'debian' - if node['platform_version'].to_i == 8 - default['php']['ext_conf_dir'] = '/etc/php5/mods-available' - end - end -when 'suse' - default['php']['conf_dir'] = '/etc/php5/cli' - default['php']['ext_conf_dir'] = '/etc/php5/conf.d' - default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev libxml2-devel libxslt-devel zlib-devel) - default['php']['fpm_default_conf'] = '/etc/php-fpm.d/www.conf' - default['php']['fpm_pooldir'] = '/etc/php5/fpm' - default['php']['fpm_service'] = 'php-fpm' - default['php']['fpm_package'] = 'php5-fpm' - default['php']['fpm_user'] = 'wwwrun' - default['php']['fpm_group'] = 'www' - default['php']['fpm_listen_user'] = 'wwwrun' - default['php']['fpm_listen_group'] = 'www' - default['php']['packages'] = %w(apache2-mod_php5 php5-pear) - lib_dir = node['kernel']['machine'] =~ /x86_64/ ? 'lib64' : 'lib' -when 'freebsd' - default['php']['conf_dir'] = '/usr/local/etc' - default['php']['ext_conf_dir'] = '/usr/local/etc/php' - default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev) - default['php']['fpm_user'] = 'www' - default['php']['fpm_group'] = 'www' - default['php']['fpm_listen_user'] = 'www' - default['php']['fpm_listen_group'] = 'www' - default['php']['packages'] = %w( php56 pear ) end +default['php']['src_recompile'] = false + default['php']['configure_options'] = %W(--prefix=#{node['php']['prefix_dir']} --with-libdir=#{lib_dir} --with-config-file-path=#{node['php']['conf_dir']} diff --git a/cookbooks/php/metadata.json b/cookbooks/php/metadata.json index 5f11b3d..5fa1158 100644 --- a/cookbooks/php/metadata.json +++ b/cookbooks/php/metadata.json @@ -1 +1 @@ -{"name":"php","version":"6.1.1","description":"Installs and maintains php and php modules","long_description":"# php Cookbook\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/php.svg?branch=master)](http://travis-ci.org/chef-cookbooks/php) [![Cookbook Version](https://img.shields.io/cookbook/v/php.svg)](https://supermarket.chef.io/cookbooks/php)\n\nIt installs and configures PHP and the PEAR package management system. Also includes resources for managing PEAR (and PECL) packages, PECL channels, and PHP-FPM pools.\n\n## Requirements\n\n### Platforms\n\n- Debian, Ubuntu\n- CentOS, Red Hat, Oracle, Scientific, Amazon Linux\n- Fedora\n\n### Chef\n\n- Chef 12.7+\n\n### Cookbooks\n\n- build-essential\n\n## Attributes\n\n- `node['php']['install_method']` = method to install php with, default `package`.\n- `node['php']['directives']` = Hash of directives and values to append to `php.ini`, default `{}`.\n- `node['php']['pear_setup']` = Boolean value to determine whether to set up pear repositories. Default: `true`\n- `node['php']['pear_channels']` = List of external pear channels to add if `node['php']['pear_setup]` is true. Default: `['pear.php.net', 'pecl.php.net']`\n\nThe file also contains the following attribute types:\n\n- platform specific locations and settings.\n- source installation settings\n\n## Resources\n\nThis cookbook includes resources for managing:\n\n- PEAR channels\n- PEAR/PECL packages\n\n### `php_pear_channel`\n\n[PEAR Channels](http://pear.php.net/manual/en/guide.users.commandline.channels.php) are alternative sources for PEAR packages. This resource provides and easy way to manage these channels.\n\n#### Actions\n\n- `:discover`: Initialize a channel from its server.\n- `:add`: Add a channel to the channel list, usually only used to add private channels. Public channels are usually added using the `:discover` action\n- `:update`: Update an existing channel\n- `:remove`: Remove a channel from the List\n\n#### Properties\n\n- `channel_name`: name attribute. The name of the channel to discover\n- `channel_xml`: the channel.xml file of the channel you are adding\n- `binary`: pear binary, default: pear\n\n#### Examples\n\n```ruby\n# discover the horde channel\nphp_pear_channel \"pear.horde.org\" do\n action :discover\nend\n\n# download xml then add the symfony channel\nremote_file \"#{Chef::Config[:file_cache_path]}/symfony-channel.xml\" do\n source 'http://pear.symfony-project.com/channel.xml'\n mode '0644'\nend\nphp_pear_channel 'symfony' do\n channel_xml \"#{Chef::Config[:file_cache_path]}/symfony-channel.xml\"\n action :add\nend\n\n# update the main pear channel\nphp_pear_channel 'pear.php.net' do\n action :update\nend\n\n# update the main pecl channel\nphp_pear_channel 'pecl.php.net' do\n action :update\nend\n```\n\n### `php_pear`\n\n[PEAR](http://pear.php.net/) is a framework and distribution system for reusable PHP components. [PECL](http://pecl.php.net/) is a repository for PHP Extensions. PECL contains C extensions for compiling into PHP. As C programs, PECL extensions run more efficiently than PEAR packages. PEARs and PECLs use the same packaging and distribution system. As such this resource is clever enough to abstract away the small differences and can be used for managing either. This resource also creates the proper module .ini file for each PECL extension at the correct location for each supported platform.\n\n#### Actions\n\n- `:install`: Install a pear package - if version is provided, install that specific version\n- `:upgrade`: Upgrade a pear package - if version is provided, upgrade to that specific version\n- `:remove`: Remove a pear package\n- `:reinstall`: Force install of the package even if the same version is already installed. Note: This will converge on every Chef run and is probably not what you want.\n- `:purge`: An alias for remove as the two behave the same in pear\n\n#### Properties\n\n- `package_name`: name attribute. The name of the pear package to install\n- `version`: the version of the pear package to install/upgrade. If no version is given latest is assumed.\n- `channel`:\n- `options`: Add additional options to the underlying pear package command\n- `directives`: extra extension directives (settings) for a pecl. on most platforms these usually get rendered into the extension's .ini file\n- `zend_extensions`: extension filenames which should be loaded with zend_extension.\n- `preferred_state`: PEAR by default installs stable packages only, this allows you to install pear packages in a devel, alpha or beta state\n- `binary`: The pear binary to use, by default pear, can be overridden if the binary is not called pear, e.g. pear7\n\n#### Examples\n\n```ruby\n# upgrade a pear\nphp_pear 'XML_RPC' do\n action :upgrade\nend\n\n# install a specific version\nphp_pear 'XML_RPC' do\n version '1.5.4'\n action :install\nend\n\n# install the mongodb pecl\nphp_pear 'Install mongo but use a different resource name' do\n package_name 'mongo'\n action :install\nend\n\n# install the xdebug pecl\nphp_pear 'xdebug' do\n # Specify that xdebug.so must be loaded as a zend extension\n zend_extensions ['xdebug.so']\n action :install\nend\n\n# install apc pecl with directives\nphp_pear 'apc' do\n action :install\n directives(shm_size: 128, enable_cli: 1)\nend\n\n# install using the pear-7 binary\nphp_pear 'apc' do\n action :install\n binary 'pear7'\nend\n\n# install the beta version of Horde_Url\n# from the horde channel\nhc = php_pear_channel 'pear.horde.org' do\n action :discover\nend\n\nphp_pear 'Horde_Url' do\n preferred_state 'beta'\n channel hc.channel_name\n action :install\nend\n\n# install the YAML pear from the symfony project\nsc = php_pear_channel 'pear.symfony-project.com' do\n action :discover\nend\n\nphp_pear 'YAML' do\n channel sc.channel_name\n action :install\nend\n```\n\n### `php_fpm_pool`\n\nInstalls the `php-fpm` package appropriate for your distro (if using packages) and configures a FPM pool for you. Currently only supported in Debian-family operating systems and CentOS 7 (or at least tested with such, YMMV if you are using source).\n\nPlease consider FPM functionally pre-release, and test it thoroughly in your environment before using it in production\n\nMore info: \n\n#### Actions\n\n- `:install`: Installs the FPM pool (default).\n- `:uninstall`: Removes the FPM pool.\n\n#### Attribute Parameters\n\n- `pool_name`: name attribute. The name of the FPM pool.\n- `listen`: The listen address. Default: `/var/run/php5-fpm.sock`\n- `user`: The user to run the FPM under. Default should be the webserver user for your distro.\n- `group`: The group to run the FPM under. Default should be the webserver group for your distro.\n- `process_manager`: Process manager to use - see . Default: `dynamic`\n- `max_children`: Max children to scale to. Default: 5\n- `start_servers`: Number of servers to start the pool with. Default: 2\n- `min_spare_servers`: Minimum number of servers to have as spares. Default: 1\n- `max_spare_servers`: Maximum number of servers to have as spares. Default: 3\n- `chdir`: The startup working directory of the pool. Default: `/`\n- `additional_config`: Additional parameters in JSON. Default: {}\n\n#### Examples\n\n```ruby\n# Install a FPM pool named \"default\"\nphp_fpm_pool 'default' do\n action :install\nend\n```\n\n## Recipes\n\n### default\n\nInclude the default recipe in a run list, to get `php`. By default `php` is installed from packages but this can be changed by using the `install_method` attribute.\n\n### package\n\nThis recipe installs PHP from packages.\n\n### source\n\nThis recipe installs PHP from source.\n\n## Usage\n\nSimply include the `php` recipe where ever you would like php installed. To install from source override the `node['php']['install_method']` attribute with in a role or wrapper cookbook:\n\n### Role example:\n\n```ruby\nname 'php'\ndescription 'Install php from source'\noverride_attributes(\n 'php' => {\n 'install_method' => 'source',\n }\n)\nrun_list(\n 'recipe[php]'\n)\n```\n\n## Maintainers\n\nThis cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/)\n\n## License\n\n**Copyright:** 2011-2018, Chef Software, Inc.\n**Copyright:** 2018, Oracle and/or its affiliates. All rights reserved\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","debian":">= 0.0.0","fedora":">= 0.0.0","oracle":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","suse":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0","ubuntu":">= 0.0.0"},"dependencies":{"build-essential":">= 5.0","yum-epel":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{"php":"Installs php","php::package":"Installs php using packages.","php::source":"Installs php from source."},"source_url":"https://github.com/chef-cookbooks/php","issues_url":"https://github.com/chef-cookbooks/php/issues","chef_version":[[">= 12.7"]],"ohai_version":[]} \ No newline at end of file +{"name":"php","version":"8.0.0","description":"Installs and maintains php and php modules","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"amazon":">= 2.0","centos":">= 7.0","debian":">= 9.0","oracle":">= 7.0","redhat":">= 7.0","scientific":">= 7.0","ubuntu":">= 16.04"},"dependencies":{"yum-epel":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/php","issues_url":"https://github.com/sous-chefs/php/issues","chef_version":[[">= 14.0"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/php/recipes/ini.rb b/cookbooks/php/recipes/ini.rb index df348d7..6a92f05 100644 --- a/cookbooks/php/recipes/ini.rb +++ b/cookbooks/php/recipes/ini.rb @@ -18,6 +18,26 @@ # limitations under the License. # +if node['php']['fpm_ini_control'] + + service node['php']['fpm_service'] do + action :enable + end + + template "#{node['php']['fpm_conf_dir']}/php.ini" do + source node['php']['ini']['template'] + cookbook node['php']['ini']['cookbook'] + owner 'root' + group node['root_group'] + mode '0644' + manage_symlink_source true + variables(directives: node['php']['directives']) + notifies :restart, "service[#{node['php']['fpm_service']}]" + not_if { node['php']['fpm_conf_dir'].nil? } + end + +end + template "#{node['php']['conf_dir']}/php.ini" do source node['php']['ini']['template'] cookbook node['php']['ini']['cookbook'] diff --git a/cookbooks/php/recipes/package.rb b/cookbooks/php/recipes/package.rb index b361ff2..c77b0ee 100644 --- a/cookbooks/php/recipes/package.rb +++ b/cookbooks/php/recipes/package.rb @@ -19,16 +19,8 @@ # limitations under the License. # -if platform_family?('rhel', 'debian', 'amazon', 'suse') - package node['php']['packages'] do - options node['php']['package_options'] - end -else - node['php']['packages'].each do |pkg| - package pkg do - options node['php']['package_options'] - end - end +package node['php']['packages'] do + options node['php']['package_options'] end include_recipe 'php::ini' diff --git a/cookbooks/php/recipes/recompile.rb b/cookbooks/php/recipes/recompile.rb index 46398cb..fce1ad9 100644 --- a/cookbooks/php/recipes/recompile.rb +++ b/cookbooks/php/recipes/recompile.rb @@ -18,34 +18,6 @@ # limitations under the License. # -version = node['php']['version'] -configure_options = node['php']['configure_options'].join(' ') -ext_dir_prefix = node['php']['ext_dir'] ? "EXTENSION_DIR=#{node['php']['ext_dir']}" : '' +node.default['php']['src_recompile'] = true -node['php']['src_deps'].each do |pkg| - package pkg do - action 'install' - end -end - -remote_file "#{Chef::Config[:file_cache_path]}/php-#{version}.tar.gz" do - source "#{node['php']['url']}/php-#{version}.tar.gz/from/this/mirror" - checksum node['php']['checksum'] - mode '0644' - action 'create_if_missing' -end - -bash 'un-pack php' do - cwd Chef::Config[:file_cache_path] - code "tar -zxf php-#{version}.tar.gz" - creates "#{Chef::Config[:file_cache_path]}/php-#{version}" -end - -bash 're-build php' do - cwd "#{Chef::Config[:file_cache_path]}/php-#{version}" - code <<-EOF - (make clean) - (#{ext_dir_prefix} ./configure #{configure_options}) - (make -j #{node['cpu']['total']} && make install) - EOF -end +include_recipe 'php::source' diff --git a/cookbooks/php/recipes/source.rb b/cookbooks/php/recipes/source.rb index 407fab9..731440f 100644 --- a/cookbooks/php/recipes/source.rb +++ b/cookbooks/php/recipes/source.rb @@ -18,20 +18,41 @@ # limitations under the License. # -configure_options = node['php']['configure_options'].join(' ') +if platform?('debian') && node['platform_version'].to_i == 9 + Chef::Log.fatal 'Debian 9 is not supported when building from source' +end -build_essential 'install compilation tools' -include_recipe 'yum-epel' if node['platform_family'] == 'rhel' +version = node['php']['version'] +configure_options = node['php']['configure_options'].join(' ') +ext_dir_prefix = node['php']['ext_dir'] ? "EXTENSION_DIR=#{node['php']['ext_dir']}" : '' + +php_exists = if node['php']['src_recompile'] + false + else + "$(which #{node['php']['bin']}) --version | grep #{version}" + end + +build_essential + +include_recipe 'yum-epel' if platform_family?('rhel', 'amazon') package node['php']['src_deps'] -version = node['php']['version'] +log "php_exists == #{php_exists}" remote_file "#{Chef::Config[:file_cache_path]}/php-#{version}.tar.gz" do - source "#{node['php']['url']}/php-#{version}.tar.gz/from/this/mirror" + source "#{node['php']['url']}/php-#{version}.tar.gz" checksum node['php']['checksum'] - mode '0644' - not_if "$(which #{node['php']['bin']}) --version | grep #{version}" + action :create_if_missing + not_if php_exists + notifies :run, 'execute[un-pack php]', :immediately +end + +execute 'un-pack php' do + cwd Chef::Config[:file_cache_path] + command "tar -zxf php-#{version}.tar.gz" + creates "#{Chef::Config[:file_cache_path]}/php-#{version}" + action :nothing end if node['php']['ext_dir'] @@ -41,26 +62,31 @@ if node['php']['ext_dir'] mode '0755' recursive true end - ext_dir_prefix = "EXTENSION_DIR=#{node['php']['ext_dir']}" -else - ext_dir_prefix = '' end -# PHP is unable to find the GMP library in 16.04. The symlink brings the file -# inside of the include libraries. +# PHP is unable to find the GMP library on Ubuntu 16.04 +# This symlink brings the file inside of the included libraries link '/usr/include/gmp.h' do to '/usr/include/x86_64-linux-gnu/gmp.h' - only_if { node['platform_family'] == 'debian' && node['platform_version'].to_f >= 14.04 } + only_if { platform?('ubuntu') && node['platform_version'].to_f == 16.04 } end -bash 'build php' do - cwd Chef::Config[:file_cache_path] - code <<-EOF - tar -zxf php-#{version}.tar.gz - (cd php-#{version} && #{ext_dir_prefix} ./configure #{configure_options}) - (cd php-#{version} && make -j #{node['cpu']['total']} && make install) - EOF - not_if "$(which #{node['php']['bin']}) --version | grep #{version}" +execute 'clean build' do + cwd "#{Chef::Config[:file_cache_path]}/php-#{version}" + command 'make clean' + only_if { node['php']['src_recompile'] } +end + +execute 'configure php' do + cwd "#{Chef::Config[:file_cache_path]}/php-#{version}" + command "#{ext_dir_prefix} ./configure #{configure_options}" + not_if php_exists +end + +execute 'build and install php' do + cwd "#{Chef::Config[:file_cache_path]}/php-#{version}" + command "make -j #{node['cpu']['total']} && make install" + not_if php_exists end directory node['php']['conf_dir'] do diff --git a/cookbooks/php/resources/pear.rb b/cookbooks/php/resources/pear.rb index c4aea46..2d7de7f 100644 --- a/cookbooks/php/resources/pear.rb +++ b/cookbooks/php/resources/pear.rb @@ -19,14 +19,14 @@ # property :package_name, String, name_property: true -property :version, [String, nil], default: nil +property :version, [String, nil] property :channel, String property :options, String property :directives, Hash, default: {} property :zend_extensions, Array, default: [] property :preferred_state, String, default: 'stable' property :binary, String, default: 'pear' -property :priority, [String, nil], default: nil +property :priority, [String, nil] def current_installed_version(new_resource) version_check_cmd = "#{new_resource.binary} -d" @@ -69,6 +69,8 @@ load_current_value do |new_resource| end action :install do + build_essential + # If we specified a version, and it's not the current version, move to the specified version install_version = new_resource.version unless new_resource.version.nil? || new_resource.version == current_resource.version # Check if the version we want is already installed @@ -87,6 +89,8 @@ end # reinstall is just an install that always fires action :reinstall do + build_essential + install_version = new_resource.version unless new_resource.version.nil? converge_by("reinstall package #{new_resource.package_name} #{install_version}") do info_output = "Installing #{new_resource.package_name}" @@ -214,7 +218,14 @@ action_class do def get_extension_files(name) files = [] - p = shell_out("#{new_resource.binary} list-files #{name}") + # use appropriate binary when listing pecl packages + list_binary = if new_resource.channel == 'pecl.php.net' + node['php']['pecl'] + else + new_resource.binary + end + + p = shell_out("#{list_binary} list-files #{name}") p.stdout.each_line.grep(/^src\s+.*\.so$/i).each do |line| files << line.split[1] end @@ -231,7 +242,11 @@ action_class do search_args << " search#{expand_channel(new_resource.channel)} #{new_resource.package_name}" if grep_for_version(shell_out(new_resource.binary + search_args).stdout, new_resource.package_name) - false + if (new_resource.binary.include? 'pecl') || (new_resource.channel == 'pecl.php.net') + true + else + false + end elsif grep_for_version(shell_out(node['php']['pecl'] + search_args).stdout, new_resource.package_name) true else @@ -276,5 +291,10 @@ action_class do ) action action end + + execute "#{node['php']['enable_mod']} #{name}" do + creates "#{node['php']['conf_dir']}/conf.d/#{name}" + only_if { platform_family? 'debian' } + end end end diff --git a/cookbooks/php/resources/pear_channel.rb b/cookbooks/php/resources/pear_channel.rb index 96a244e..40db5d3 100644 --- a/cookbooks/php/resources/pear_channel.rb +++ b/cookbooks/php/resources/pear_channel.rb @@ -22,9 +22,6 @@ property :channel_xml, String property :channel_name, String, name_property: true property :binary, String, default: 'pear' -# TODO: add authenticated channel support! -# property :username, :kind_of => String -# property :password, :kind_of => String action :discover do unless exists? diff --git a/cookbooks/php/templates/default/extension.ini.erb b/cookbooks/php/templates/default/extension.ini.erb index 13c5122..4cc47a0 100644 --- a/cookbooks/php/templates/default/extension.ini.erb +++ b/cookbooks/php/templates/default/extension.ini.erb @@ -1,4 +1,7 @@ ; configuration for php <%= @name %> module +<% if @priority %> +; priority=<%= @priority %> +<% end -%> <% @extensions.each do |filepath, zend| -%> <%= 'zend_' if zend %>extension=<%= filepath %> <% end -%> diff --git a/cookbooks/php/templates/default/php.ini.erb b/cookbooks/php/templates/default/php.ini.erb index 6c3f990..3d0fe7f 100644 --- a/cookbooks/php/templates/default/php.ini.erb +++ b/cookbooks/php/templates/default/php.ini.erb @@ -19,7 +19,7 @@ ; See the PHP docs for more specific information. ; http://php.net/configuration.file -; The syntax of the file is extremely simple. Whitespace and Lines +; The syntax of the file is extremely simple. Whitespace and lines ; beginning with a semicolon are silently ignored (as you probably guessed). ; Section headers (e.g. [Foo]) are also silently ignored, even though ; they might mean something in the future. @@ -78,9 +78,9 @@ ; compatibility with older or less security conscience applications. We ; recommending using the production ini in production and testing environments. -; php.ini-development is very similar to its production variant, except it's -; much more verbose when it comes to errors. We recommending using the -; development version only in development environments as errors shown to +; php.ini-development is very similar to its production variant, except it is +; much more verbose when it comes to errors. We recommend using the +; development version only in development environments, as errors shown to ; application users can inadvertently leak otherwise secure information. ;;;;;;;;;;;;;;;;;;; @@ -102,25 +102,20 @@ ; Production Value: Off ; error_reporting -; Default Value: E_ALL & ~E_NOTICE -; Development Value: E_ALL | E_STRICT -; Production Value: E_ALL & ~E_DEPRECATED +; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT ; html_errors ; Default Value: On ; Development Value: On -; Production value: Off +; Production value: On ; log_errors ; Default Value: Off ; Development Value: On ; Production Value: On -; magic_quotes_gpc -; Default Value: On -; Development Value: Off -; Production Value: Off - ; max_input_time ; Default Value: -1 (Unlimited) ; Development Value: 60 (60 seconds) @@ -136,32 +131,17 @@ ; Development Value: Off ; Production Value: Off -; register_long_arrays -; Default Value: On -; Development Value: Off -; Production Value: Off - ; request_order ; Default Value: None ; Development Value: "GP" ; Production Value: "GP" -; session.bug_compat_42 -; Default Value: On -; Development Value: On -; Production Value: Off - -; session.bug_compat_warn -; Default Value: On -; Development Value: On -; Production Value: Off - ; session.gc_divisor ; Default Value: 100 ; Development Value: 1000 ; Production Value: 1000 -; session.hash_bits_per_character +; session.sid_bits_per_character ; Default Value: 4 ; Development Value: 5 ; Production Value: 5 @@ -176,11 +156,6 @@ ; Development Value: On ; Production Value: Off -; url_rewriter.tags -; Default Value: "a=href,area=href,frame=src,form=,fieldset=" -; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" - ; variables_order ; Default Value: "EGPCS" ; Development Value: "GPCS" @@ -207,23 +182,18 @@ engine = On ; This directive determines whether or not PHP will recognize code between -; tags as PHP source which should be processed as such. It's been -; recommended for several years that you not use the short tag "short cut" and -; instead to use the full tag combination. With the wide spread use -; of XML and use of these tags by other languages, the server can become easily -; confused and end up parsing the wrong code in the wrong context. But because -; this short cut has been a feature for such a long time, it's currently still -; supported for backwards compatibility, but we recommend you don't use them. +; tags as PHP source which should be processed as such. It is +; generally recommended that should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the tags. -; http://php.net/asp-tags -asp_tags = Off - ; The number of significant digits displayed in floating point numbers. ; http://php.net/precision precision = 14 @@ -267,6 +237,23 @@ output_buffering = 4096 ; http://php.net/output-handler ;output_handler = +; URL rewriter function rewrites URL on the fly by using +; output buffer. You can set target tags by this configuration. +; "form" tag is special tag. It will add hidden input tag to pass values. +; Refer to session.trans_sid_tags for usage. +; Default Value: "form=" +; Development Value: "form=" +; Production Value: "form=" +;url_rewriter.tags + +; URL rewriter will not rewrites absolute URL nor form by default. To enable +; absolute URL rewrite, allowed hosts must be defined at RUNTIME. +; Refer to session.trans_sid_hosts for more details. +; Default Value: "" +; Development Value: "" +; Production Value: "" +;url_rewriter.hosts + ; Transparent output compression using the zlib library ; Valid values for this option are 'off', 'on', or a specific buffer size ; to be used for compression (default is 4KB) @@ -305,65 +292,28 @@ implicit_flush = Off ; callback-function. unserialize_callback_func = -; When floats & doubles are serialized store serialize_precision significant +; When floats & doubles are serialized, store serialize_precision significant ; digits after the floating point. The default value ensures that when floats ; are decoded with unserialize, the data will remain the same. -serialize_precision = 100 - -; Safe Mode -; http://php.net/safe-mode -safe_mode = Off - -; By default, Safe Mode does a UID compare check when -; opening files. If you want to relax this to a GID compare, -; then turn on safe_mode_gid. -; http://php.net/safe-mode-gid -safe_mode_gid = Off - -; When safe_mode is on, UID/GID checks are bypassed when -; including files from this directory and its subdirectories. -; (directory must also be in include_path or full path must -; be used when including) -; http://php.net/safe-mode-include-dir -safe_mode_include_dir = - -; When safe_mode is on, only executables located in the safe_mode_exec_dir -; will be allowed to be executed via the exec family of functions. -; http://php.net/safe-mode-exec-dir -safe_mode_exec_dir = - -; Setting certain environment variables may be a potential security breach. -; This directive contains a comma-delimited list of prefixes. In Safe Mode, -; the user may only alter environment variables whose names begin with the -; prefixes supplied here. By default, users will only be able to set -; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). -; Note: If this directive is empty, PHP will let the user modify ANY -; environment variable! -; http://php.net/safe-mode-allowed-env-vars -safe_mode_allowed_env_vars = PHP_ - -; This directive contains a comma-delimited list of environment variables that -; the end user won't be able to change using putenv(). These variables will be -; protected even if safe_mode_allowed_env_vars is set to allow to change them. -; http://php.net/safe-mode-protected-env-vars -safe_mode_protected_env_vars = LD_LIBRARY_PATH +; The value is also used for json_encode when encoding double values. +; If -1 is used, then dtoa mode 0 is used which automatically select the best +; precision. +serialize_precision = -1 ; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per-directory -; or per-virtualhost web server configuration file. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; or per-virtualhost web server configuration file. +; Note: disables the realpath cache ; http://php.net/open-basedir ;open_basedir = ; This directive allows you to disable certain functions for security reasons. -; It receives a comma-delimited list of function names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; It receives a comma-delimited list of function names. ; http://php.net/disable-functions disable_functions = ; This directive allows you to disable certain classes for security reasons. -; It receives a comma-delimited list of class names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; It receives a comma-delimited list of class names. ; http://php.net/disable-classes disable_classes = @@ -373,7 +323,6 @@ disable_classes = ;highlight.string = #DD0000 ;highlight.comment = #FF9900 ;highlight.keyword = #007700 -;highlight.bg = #FFFFFF ;highlight.default = #0000BB ;highlight.html = #000000 @@ -387,8 +336,9 @@ disable_classes = ; Determines the size of the realpath cache to be used by PHP. This value should ; be increased on systems where PHP opens many files to reflect the quantity of ; the file operations performed. +; Note: if open_basedir is set, the cache is disabled ; http://php.net/realpath-cache-size -;realpath_cache_size = 16k +;realpath_cache_size = 4096k ; Duration of time, in seconds for which to cache realpath information for a given ; file or directory. For systems with rarely changing files, consider increasing this @@ -396,6 +346,22 @@ disable_classes = ; http://php.net/realpath-cache-ttl ;realpath_cache_ttl = 120 +; Enables or disables the circular reference collector. +; http://php.net/zend.enable-gc +zend.enable_gc = On + +; If enabled, scripts may be written in encodings that are incompatible with +; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such +; encodings. To use this feature, mbstring extension must be enabled. +; Default: Off +;zend.multibyte = Off + +; Allows to set the default encoding for the scripts. This value will be used +; unless "declare(encoding=...)" directive appears at the top of the script. +; Only affects if zend.multibyte is set. +; Default: "" +;zend.script_encoding = + ;;;;;;;;;;;;;;;;; ; Miscellaneous ; ;;;;;;;;;;;;;;;;; @@ -430,6 +396,9 @@ max_input_time = 60 ; http://php.net/max-input-nesting-level ;max_input_nesting_level = 64 +; How many GET/POST/COOKIE input variables may be accepted +; max_input_vars = 1000 + ; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 128M @@ -449,12 +418,12 @@ memory_limit = 128M ; recommend error reporting setting. Your production server shouldn't be wasting ; resources complaining about best practices and coding standards. That's what ; development servers and development settings are for. -; Note: The php.ini-development file has this setting as E_ALL | E_STRICT. This +; Note: The php.ini-development file has this setting as E_ALL. This ; means it pretty much reports everything which is exactly what you want during ; development and early testing. ; ; Error Level Constants: -; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0) +; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) ; E_ERROR - fatal run-time errors ; E_RECOVERABLE_ERROR - almost fatal run-time errors ; E_WARNING - run-time warnings (non-fatal errors) @@ -462,7 +431,7 @@ memory_limit = 128M ; E_NOTICE - run-time notices (these are warnings which often result ; from a bug in your code, but it's possible that it was ; intentional (e.g., using an uninitialized variable and -; relying on the fact it's automatically initialized to an +; relying on the fact it is automatically initialized to an ; empty string) ; E_STRICT - run-time notices, enable to have PHP suggest changes ; to your code which will ensure the best interoperability @@ -480,23 +449,23 @@ memory_limit = 128M ; E_USER_DEPRECATED - user-generated deprecation warnings ; ; Common Values: -; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) -; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) +; E_ALL (Show all errors, warnings and notices including coding standards.) +; E_ALL & ~E_NOTICE (Show all errors, except for notices) +; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) ; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) -; Default Value: E_ALL & ~E_NOTICE -; Development Value: E_ALL | E_STRICT -; Production Value: E_ALL & ~E_DEPRECATED +; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT ; http://php.net/error-reporting -error_reporting = E_ALL & ~E_DEPRECATED +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT ; This directive controls whether or not and where PHP will output errors, ; notices and warnings too. Error output is very useful during development, but ; it could be very dangerous in production environments. Depending on the code ; which is triggering the error, sensitive information could potentially leak ; out of your application such as database usernames and passwords or worse. -; It's recommended that errors be logged on production servers rather than -; having the errors sent to STDOUT. +; For production environments, we recommend logging errors rather than +; sending them to STDOUT. ; Possible Values: ; Off = Do not display any errors ; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) @@ -510,8 +479,8 @@ display_errors = Off ; The display of errors which occur during PHP's startup sequence are handled ; separately from display_errors. PHP's default behavior is to suppress those ; errors from clients. Turning the display of startup errors on can be useful in -; debugging configuration problems. But, it's strongly recommended that you -; leave this setting off on production servers. +; debugging configuration problems. We strongly recommend you +; set this to 'off' for production servers. ; Default Value: Off ; Development Value: On ; Production Value: Off @@ -556,11 +525,12 @@ report_memleaks = On ; Store the last error/warning message in $php_errormsg (boolean). Setting this value ; to On can assist in debugging and is appropriate for development servers. It should ; however be disabled on production servers. +; This directive is DEPRECATED. ; Default Value: Off -; Development Value: On +; Development Value: Off ; Production Value: Off ; http://php.net/track-errors -track_errors = Off +;track_errors = Off ; Turn off normal error reporting and emit XML-RPC error XML ; http://php.net/xmlrpc-errors @@ -569,23 +539,24 @@ track_errors = Off ; An XML-RPC faultCode ;xmlrpc_error_number = 0 -; When PHP displays or logs an error, it has the capability of inserting html -; links to documentation related to that error. This directive controls whether -; those HTML links appear in error messages or not. For performance and security -; reasons, it's recommended you disable this on production servers. +; When PHP displays or logs an error, it has the capability of formatting the +; error message as HTML for easier reading. This directive controls whether +; the error message is formatted as HTML or not. ; Note: This directive is hardcoded to Off for the CLI SAPI ; Default Value: On ; Development Value: On -; Production value: Off +; Production value: On ; http://php.net/html-errors -html_errors = Off +html_errors = On -; If html_errors is set On PHP produces clickable error messages that direct -; to a page describing the error or function causing the error in detail. +; If html_errors is set to On *and* docref_root is not empty, then PHP +; produces clickable error messages that direct to a page describing the error +; or function causing the error in detail. ; You can download a copy of the PHP manual from http://php.net/docs ; and change docref_root to the base URL of your local copy including the ; leading '/'. You must also specify the file extension being used including -; the dot. PHP's default behavior is to leave these settings empty. +; the dot. PHP's default behavior is to leave these settings empty, in which +; case no links to documentation are generated. ; Note: Never use this feature for production boxes. ; http://php.net/docref-root ; Examples @@ -598,22 +569,27 @@ html_errors = Off ; this setting blank. ; http://php.net/error-prepend-string ; Example: -;error_prepend_string = "" +;error_prepend_string = "" ; String to output after an error message. PHP's default behavior is to leave ; this setting blank. ; http://php.net/error-append-string ; Example: -;error_append_string = "" +;error_append_string = "" ; Log errors to specified file. PHP's default behavior is to leave this value ; empty. ; http://php.net/error-log ; Example: ;error_log = php_errors.log -; Log errors to syslog (Event Log on NT, not valid in Windows 95). +; Log errors to syslog (Event Log on Windows). ;error_log = syslog +;windows.show_crt_warning +; Default value: 0 +; Development value: 0 +; Production value: 0 + ;;;;;;;;;;;;;;;;; ; Data Handling ; ;;;;;;;;;;;;;;;;; @@ -632,51 +608,31 @@ html_errors = Off ;arg_separator.input = ";&" ; This directive determines which super global arrays are registered when PHP -; starts up. If the register_globals directive is enabled, it also determines -; what order variables are populated into the global space. G,P,C,E & S are -; abbreviations for the following respective super globals: GET, POST, COOKIE, -; ENV and SERVER. There is a performance penalty paid for the registration of -; these arrays and because ENV is not as commonly used as the others, ENV is -; is not recommended on productions servers. You can still get access to -; the environment variables through getenv() should you need to. +; starts up. G,P,C,E & S are abbreviations for the following respective super +; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty +; paid for the registration of these arrays and because ENV is not as commonly +; used as the others, ENV is not recommended on productions servers. You +; can still get access to the environment variables through getenv() should you +; need to. ; Default Value: "EGPCS" ; Development Value: "GPCS" ; Production Value: "GPCS"; ; http://php.net/variables-order variables_order = "GPCS" -; This directive determines which super global data (G,P,C,E & S) should -; be registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive are -; specified in the same manner as the variables_order directive, EXCEPT one. -; Leaving this value empty will cause PHP to use the value set in the -; variables_order directive. It does not mean it will leave the super globals -; array REQUEST empty. +; This directive determines which super global data (G,P & C) should be +; registered into the super global array REQUEST. If so, it also determines +; the order in which that data is registered. The values for this directive +; are specified in the same manner as the variables_order directive, +; EXCEPT one. Leaving this value empty will cause PHP to use the value set +; in the variables_order directive. It does not mean it will leave the super +; globals array REQUEST empty. ; Default Value: None ; Development Value: "GP" ; Production Value: "GP" ; http://php.net/request-order request_order = "GP" -; Whether or not to register the EGPCS variables as global variables. You may -; want to turn this off if you don't want to clutter your scripts' global scope -; with user data. -; You should do your best to write your scripts so that they do not require -; register_globals to be on; Using form variables as globals can easily lead -; to possible security problems, if the code is not very well thought of. -; http://php.net/register-globals -register_globals = Off - -; Determines whether the deprecated long $HTTP_*_VARS type predefined variables -; are registered by PHP or not. As they are deprecated, we obviously don't -; recommend you use them. They are on by default for compatibility reasons but -; they are not recommended on production servers. -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/register-long-arrays -register_long_arrays = Off - ; This directive determines whether PHP registers $argv & $argc each time it ; runs. $argv contains an array of all the arguments passed to PHP when a script ; is invoked. $argc contains an integer representing the number of arguments @@ -692,42 +648,29 @@ register_long_arrays = Off ; http://php.net/register-argc-argv register_argc_argv = Off -; When enabled, the SERVER and ENV variables are created when they're first -; used (Just In Time) instead of when the script starts. If these variables -; are not used within a script, having this directive on will result in a -; performance gain. The PHP directives register_globals, register_long_arrays, -; and register_argc_argv must be disabled for this directive to have any affect. +; When enabled, the ENV, REQUEST and SERVER variables are created when they're +; first used (Just In Time) instead of when the script starts. If these +; variables are not used within a script, having this directive on will result +; in a performance gain. The PHP directive register_argc_argv must be disabled +; for this directive to have any affect. ; http://php.net/auto-globals-jit auto_globals_jit = On +; Whether PHP will read the POST data. +; This option is enabled by default. +; Most likely, you won't want to disable this option globally. It causes $_POST +; and $_FILES to always be empty; the only way you will be able to read the +; POST data will be through the php://input stream wrapper. This can be useful +; to proxy requests or to process the POST data in a memory efficient fashion. +; http://php.net/enable-post-data-reading +;enable_post_data_reading = Off + ; Maximum size of POST data that PHP will accept. +; Its value may be 0 to disable the limit. It is ignored if POST data reading +; is disabled through enable_post_data_reading. ; http://php.net/post-max-size post_max_size = 8M -; Magic quotes are a preprocessing feature of PHP where PHP will attempt to -; escape any character sequences in GET, POST, COOKIE and ENV data which might -; otherwise corrupt data being placed in resources such as databases before -; making that data available to you. Because of character encoding issues and -; non-standard SQL implementations across many databases, it's not currently -; possible for this feature to be 100% accurate. PHP's default behavior is to -; enable the feature. We strongly recommend you use the escaping mechanisms -; designed specifically for the database your using instead of relying on this -; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is -; scheduled for removal in PHP 6. -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/magic-quotes-gpc -magic_quotes_gpc = Off - -; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. -; http://php.net/magic-quotes-runtime -magic_quotes_runtime = Off - -; Use Sybase-style magic quotes (escape ' with '' instead of \'). -; http://php.net/magic-quotes-sybase -magic_quotes_sybase = Off - ; Automatically add files before PHP document. ; http://php.net/auto-prepend-file auto_prepend_file = @@ -736,22 +679,32 @@ auto_prepend_file = ; http://php.net/auto-append-file auto_append_file = -; By default, PHP will output a character encoding using -; the Content-type: header. To disable sending of the charset, simply -; set it to be empty. +; By default, PHP will output a media type using the Content-Type header. To +; disable this, simply set it to be empty. ; -; PHP's built-in default is text/html +; PHP's built-in default media type is set to text/html. ; http://php.net/default-mimetype default_mimetype = "text/html" -; PHP's default character set is set to empty. +; PHP's default character set is set to UTF-8. ; http://php.net/default-charset -;default_charset = "iso-8859-1" +default_charset = "UTF-8" -; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is -; to disable this feature. -; http://php.net/always-populate-raw-post-data -;always_populate_raw_post_data = On +; PHP internal character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/internal-encoding +;internal_encoding = + +; PHP input character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/input-encoding +;input_encoding = + +; PHP output character encoding is set to empty. +; If empty, default_charset is used. +; See also output_buffer. +; http://php.net/output-encoding +;output_encoding = ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; @@ -785,6 +738,10 @@ user_dir = ; On windows: ; extension_dir = "ext" +; Directory where the temporary files should be placed. +; Defaults to the system default (see sys_get_temp_dir) +; sys_temp_dir = "/tmp" + ; Whether or not to enable the dl() function. The dl() function does NOT work ; properly in multithreaded servers, such as IIS or Zeus, and is automatically ; disabled on them. @@ -807,7 +764,7 @@ enable_dl = Off ; will look for to know it is OK to continue execution. Setting this variable MAY ; cause security issues, KNOW WHAT YOU ARE DOING FIRST. ; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = ; +;cgi.redirect_status_env = ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok @@ -818,26 +775,38 @@ enable_dl = Off ; http://php.net/cgi.fix-pathinfo ;cgi.fix_pathinfo=1 +; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside +; of the web tree and people will not be able to circumvent .htaccess security. +; http://php.net/cgi.dicard-path +;cgi.discard_path=1 + ; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate ; security tokens of the calling client. This allows IIS to define the ; security context that the request runs under. mod_fastcgi under Apache ; does not currently support this feature (03/17/2002) ; Set to 1 if running under IIS. Default is zero. ; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1; +;fastcgi.impersonate = 1 ; Disable logging through FastCGI connection. PHP's default behavior is to enable ; this feature. ;fastcgi.logging = 0 ; cgi.rfc2616_headers configuration option tells PHP what type of headers to -; use when sending HTTP response code. If it's set 0 PHP sends Status: header that -; is supported by Apache. When this option is set to 1 PHP will send +; use when sending HTTP response code. If set to 0, PHP sends Status: header that +; is supported by Apache. When this option is set to 1, PHP will send ; RFC2616 compliant header. ; Default is zero. ; http://php.net/cgi.rfc2616-headers ;cgi.rfc2616_headers = 0 +; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! +; (shebang) at the top of the running script. This line might be needed if the +; script support running both as stand-alone script and via PHP CGI<. PHP in CGI +; mode skips this line and ignores its content if this directive is turned on. +; http://php.net/cgi.check-shebang-line +;cgi.check_shebang_line=1 + ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; @@ -898,71 +867,72 @@ default_socket_timeout = 60 ; If you wish to have an extension loaded automatically, use the following ; syntax: ; -; extension=modulename.extension +; extension=modulename ; -; For example, on Windows: +; For example: ; -; extension=msql.dll +; extension=mysqli ; -; ... or under UNIX: +; When the extension library to load is not located in the default extension +; directory, You may specify an absolute path to the library file: ; -; extension=msql.so +; extension=/path/to/extension/mysqli.so ; -; ... or with a path: +; Note : The syntax used in previous PHP versions ('extension=.so' and +; 'extension='php_.dll') is supported for legacy reasons and may be +; deprecated in a future PHP major version. So, when it is possible, please +; move to the new ('extension=) syntax. ; -; extension=/path/to/extension/msql.so +; Notes for Windows environments : ; -; If you only provide the name of the extension, PHP will look for it in its -; default extension directory. +; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) +; extension folders as well as the separate PECL DLL download (PHP 5+). +; Be sure to appropriately set the extension_dir directive. ; -; Windows Extensions -; Note that ODBC support is built in, so no dll is needed for it. -; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5) -; extension folders as well as the separate PECL DLL download (PHP 5). -; Be sure to appropriately set the extension_dir directive. -; -;extension=php_bz2.dll -;extension=php_curl.dll -;extension=php_fileinfo.dll -;extension=php_gd2.dll -;extension=php_gettext.dll -;extension=php_gmp.dll -;extension=php_intl.dll -;extension=php_imap.dll -;extension=php_interbase.dll -;extension=php_ldap.dll -;extension=php_mbstring.dll -;extension=php_exif.dll ; Must be after mbstring as it depends on it -;extension=php_mysql.dll -;extension=php_mysqli.dll -;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client -;extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client -;extension=php_openssl.dll -;extension=php_pdo_firebird.dll -;extension=php_pdo_mssql.dll -;extension=php_pdo_mysql.dll -;extension=php_pdo_oci.dll -;extension=php_pdo_odbc.dll -;extension=php_pdo_pgsql.dll -;extension=php_pdo_sqlite.dll -;extension=php_pgsql.dll -;extension=php_pspell.dll -;extension=php_shmop.dll -;extension=php_snmp.dll -;extension=php_soap.dll -;extension=php_sockets.dll -;extension=php_sqlite.dll -;extension=php_sqlite3.dll -;extension=php_sybase_ct.dll -;extension=php_tidy.dll -;extension=php_xmlrpc.dll -;extension=php_xsl.dll -;extension=php_zip.dll +;extension=bz2 +;extension=curl +;extension=fileinfo +;extension=gd2 +;extension=gettext +;extension=gmp +;extension=intl +;extension=imap +;extension=interbase +;extension=ldap +;extension=mbstring +;extension=exif ; Must be after mbstring as it depends on it +;extension=mysqli +;extension=oci8_12c ; Use with Oracle Database 12c Instant Client +;extension=odbc +;extension=openssl +;extension=pdo_firebird +;extension=pdo_mysql +;extension=pdo_oci +;extension=pdo_odbc +;extension=pdo_pgsql +;extension=pdo_sqlite +;extension=pgsql +;extension=shmop + +; The MIBS data available in the PHP distribution must be installed. +; See http://www.php.net/manual/en/snmp.installation.php +;extension=snmp + +;extension=soap +;extension=sockets +;extension=sqlite3 +;extension=tidy +;extension=xmlrpc +;extension=xsl ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;; +[CLI Server] +; Whether the CLI web server uses ANSI color coding in its terminal output. +cli_server.color = On + [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone @@ -988,9 +958,29 @@ default_socket_timeout = 60 ;filter.default_flags = [iconv] -;iconv.input_encoding = ISO-8859-1 -;iconv.internal_encoding = ISO-8859-1 -;iconv.output_encoding = ISO-8859-1 +; Use of this INI entry is deprecated, use global input_encoding instead. +; If empty, default_charset or input_encoding or iconv.input_encoding is used. +; The precedence is: default_charset < intput_encoding < iconv.input_encoding +;iconv.input_encoding = + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;iconv.internal_encoding = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; If empty, default_charset or output_encoding or iconv.output_encoding is used. +; The precedence is: default_charset < output_encoding < iconv.output_encoding +; To use an output encoding conversion, iconv's output handler must be set +; otherwise output encoding conversion cannot be performed. +;iconv.output_encoding = + +[imap] +; rsh/ssh logins are disabled by default. Use this INI entry if you want to +; enable them. Note that the IMAP library does not filter mailbox names before +; passing them to rsh/ssh command, thus passing untrusted data to this function +; with rsh/ssh enabled is insecure. +;imap.enable_insecure_rsh=0 [intl] ;intl.default_locale = @@ -998,14 +988,22 @@ default_socket_timeout = 60 ; happens within intl functions. The value is the level of the error produced. ; Default is 0, which does not produce any errors. ;intl.error_level = E_WARNING - -[sqlite] -; http://php.net/sqlite.assoc-case -;sqlite.assoc_case = 0 +;intl.use_exceptions = 0 [sqlite3] +; Directory pointing to SQLite3 extensions +; http://php.net/sqlite3.extension-dir ;sqlite3.extension_dir = +; SQLite defensive mode flag (only available from SQLite 3.26+) +; When the defensive flag is enabled, language features that allow ordinary +; SQL to deliberately corrupt the database file are disabled. This forbids +; writing directly to the schema, shadow tables (eg. FTS data tables), or +; the sqlite_dbpage virtual table. +; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html +; (for older SQLite versions, this flag has no use) +;sqlite3.defensive = 1 + [Pcre] ;PCRE library backtracking limit. ; http://php.net/pcre.backtrack-limit @@ -1018,6 +1016,10 @@ default_socket_timeout = 60 ; http://php.net/pcre.recursion-limit ;pcre.recursion_limit=100000 +;Enables or disables JIT compilation of patterns. This requires the PCRE +;library to be compiled with JIT support. +;pcre.jit=1 + [Pdo] ; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" ; http://php.net/pdo-odbc.connection-pooling @@ -1044,13 +1046,6 @@ pdo_mysql.default_socket= ;phar.cache_list = -[Syslog] -; Whether or not to define the various syslog variables (e.g. $LOG_PID, -; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In -; runtime, you can define these variables by calling define_syslog_variables(). -; http://php.net/define-syslog-variables -define_syslog_variables = Off - [mail function] ; For Win32 only. ; http://php.net/smtp @@ -1068,19 +1063,17 @@ smtp_port = 25 ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(), even in safe mode. +; the 5th parameter to mail(). ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename -mail.add_x_header = On +mail.add_x_header = Off ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ;mail.log = - -[SQL] -; http://php.net/sql.safe-mode -sql.safe_mode = Off +; Log mail to syslog (Event Log on Windows). +;mail.log = syslog [ODBC] ; http://php.net/odbc.default-db @@ -1156,64 +1149,6 @@ ibase.dateformat = "%Y-%m-%d" ; Default time format. ibase.timeformat = "%H:%M:%S" -[MySQL] -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysql.allow_local_infile -mysql.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysql.allow-persistent -mysql.allow_persistent = On - -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/mysql.cache_size -mysql.cache_size = 2000 - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysql.max-persistent -mysql.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/mysql.max-links -mysql.max_links = -1 - -; Default port number for mysql_connect(). If unset, mysql_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysql.default-port -mysql.default_port = - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysql.default-socket -mysql.default_socket = - -; Default host for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysql.default-host -mysql.default_host = - -; Default user for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysql.default-user -mysql.default_user = - -; Default password for mysql_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysql.default-password -mysql.default_password = - -; Maximum time (in seconds) for connect timeout. -1 means no limit -; http://php.net/mysql.connect-timeout -mysql.connect_timeout = 60 - -; Trace mode. When trace_mode is active (=On), warnings for table/index scans and -; SQL-Errors will be displayed. -; http://php.net/mysql.trace-mode -mysql.trace_mode = Off - [MySQLi] ; Maximum number of persistent links. -1 means no limit. @@ -1268,16 +1203,29 @@ mysqli.default_pw = mysqli.reconnect = Off [mysqlnd] -; Enable / Disable collection of general statstics by mysqlnd which can be +; Enable / Disable collection of general statistics by mysqlnd which can be ; used to tune and monitor MySQL operations. ; http://php.net/mysqlnd.collect_statistics mysqlnd.collect_statistics = On -; Enable / Disable collection of memory usage statstics by mysqlnd which can be +; Enable / Disable collection of memory usage statistics by mysqlnd which can be ; used to tune and monitor MySQL operations. ; http://php.net/mysqlnd.collect_memory_statistics mysqlnd.collect_memory_statistics = Off +; Records communication from all extensions using mysqlnd to the specified log +; file. +; http://php.net/mysqlnd.debug +;mysqlnd.debug = + +; Defines which queries will be logged. +; http://php.net/mysqlnd.log_mask +;mysqlnd.log_mask = 0 + +; Default size of the mysqlnd memory pool, which is used by result sets. +; http://php.net/mysqlnd.mempool_default_size +;mysqlnd.mempool_default_size = 16000 + ; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. ; http://php.net/mysqlnd.net_cmd_buffer_size ;mysqlnd.net_cmd_buffer_size = 2048 @@ -1287,6 +1235,15 @@ mysqlnd.collect_memory_statistics = Off ; http://php.net/mysqlnd.net_read_buffer_size ;mysqlnd.net_read_buffer_size = 32768 +; Timeout for network requests in seconds. +; http://php.net/mysqlnd.net_read_timeout +;mysqlnd.net_read_timeout = 31536000 + +; SHA-256 Authentication Plugin related. File with the MySQL server public RSA +; key. +; http://php.net/mysqlnd.sha256_server_public_key +;mysqlnd.sha256_server_public_key = + [OCI8] ; Connection: Enables privileged connections using external @@ -1340,7 +1297,7 @@ mysqlnd.collect_memory_statistics = Off ; http://php.net/oci8.old-oci-close-semantics ;oci8.old_oci_close_semantics = Off -[PostgresSQL] +[PostgreSQL] ; Allow or prevent persistent links. ; http://php.net/pgsql.allow-persistent pgsql.allow_persistent = On @@ -1368,45 +1325,6 @@ pgsql.ignore_notice = 0 ; http://php.net/pgsql.log-notice pgsql.log_notice = 0 -[Sybase-CT] -; Allow or prevent persistent links. -; http://php.net/sybct.allow-persistent -sybct.allow_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/sybct.max-persistent -sybct.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/sybct.max-links -sybct.max_links = -1 - -; Minimum server message severity to display. -; http://php.net/sybct.min-server-severity -sybct.min_server_severity = 10 - -; Minimum client message severity to display. -; http://php.net/sybct.min-client-severity -sybct.min_client_severity = 10 - -; Set per-context timeout -; http://php.net/sybct.timeout -;sybct.timeout= - -;sybct.packet_size - -; The maximum time in seconds to wait for a connection attempt to succeed before returning failure. -; Default: one minute -;sybct.login_timeout= - -; The name of the host you claim to be connecting from, for display by sp_who. -; Default: none -;sybct.hostname= - -; Allows you to define how often deadlocks are to be retried. -1 means "forever". -; Default: 0 -;sybct.deadlock_retry_count= - [bcmath] ; Number of decimal digits for all bcmath functions. ; http://php.net/bcmath.scale @@ -1431,9 +1349,9 @@ session.save_handler = files ; ; where N is an integer. Instead of storing all the session files in ; /path, what this will do is use subdirectories N-levels deep, and -; store the session data in those directories. This is useful if you -; or your OS have problems with lots of files in one directory, and is -; a more efficient layout for servers that handle lots of sessions. +; store the session data in those directories. This is useful if +; your OS has problems with many files in one directory, and is +; a more efficient layout for servers that handle many sessions. ; ; NOTE 1: PHP will not create this directory structure automatically. ; You can use the script in the ext/session dir for that purpose. @@ -1450,6 +1368,14 @@ session.save_handler = files ; http://php.net/session.save-path ;session.save_path = "/tmp" +; Whether to use strict session mode. +; Strict session mode does not accept uninitialized session ID and regenerate +; session ID if browser sends uninitialized session ID. Strict mode protects +; applications from session fixation via session adoption vulnerability. It is +; disabled by default for maximum compatibility, but enabling it is encouraged. +; https://wiki.php.net/rfc/strict_sessions +session.use_strict_mode = 0 + ; Whether to use cookies. ; http://php.net/session.use-cookies session.use_cookies = 1 @@ -1458,9 +1384,9 @@ session.use_cookies = 1 ;session.cookie_secure = ; This option forces PHP to fetch and use a cookie for storing and maintaining -; the session id. We encourage this operation as it's very helpful in combatting +; the session id. We encourage this operation as it's very helpful in combating ; session hijacking when not specifying and managing your own session id. It is -; not the end all be all of session hijacking defense, but it's a good start. +; not the be-all and end-all of session hijacking defense, but it's a good start. ; http://php.net/session.use-only-cookies session.use_only_cookies = 1 @@ -1529,32 +1455,7 @@ session.gc_maxlifetime = 1440 ; collection through a shell script, cron entry, or some other method. ; For example, the following script would is the equivalent of ; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 | xargs rm - -; PHP 4.2 and less have an undocumented feature/bug that allows you to -; to initialize a session variable in the global scope, even when register_globals -; is disabled. PHP 4.3 and later will warn you, if this feature is used. -; You can disable the feature and the warning separately. At this time, -; the warning is only displayed, if bug_compat_42 is enabled. This feature -; introduces some serious security problems if not handled correctly. It's -; recommended that you do not use this feature on production servers. But you -; should enable this on development servers and enable the warning as well. If you -; do not enable the feature on development servers, you won't be warned when it's -; used and debugging errors caused by this can be difficult to track down. -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/session.bug-compat-42 -session.bug_compat_42 = Off - -; This setting controls whether or not you are warned by PHP when initializing a -; session value into the global space. session.bug_compat_42 must be enabled before -; these warnings can be issued by PHP. See the directive above for more information. -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/session.bug-compat-warn -session.bug_compat_warn = Off +; find /path/to/sessions -cmin +24 -type f | xargs rm ; Check HTTP Referer to invalidate externally stored URLs containing ids. ; HTTP_REFERER has to contain this substring for the session to be @@ -1562,17 +1463,6 @@ session.bug_compat_warn = Off ; http://php.net/session.referer-check session.referer_check = -; How many bytes to read from the file. -; http://php.net/session.entropy-length -session.entropy_length = 0 - -; Specified here to create the session id. -; http://php.net/session.entropy-file -; On systems that don't have /dev/urandom /dev/arandom can be used -; On windows, setting the entropy_length setting will activate the -; Windows random source (using the CryptoAPI) -;session.entropy_file = /dev/urandom - ; Set to {nocache,private,public,} to determine HTTP caching aspects ; or leave this empty to avoid sending anti-caching headers. ; http://php.net/session.cache-limiter @@ -1583,26 +1473,50 @@ session.cache_limiter = nocache session.cache_expire = 180 ; trans sid support is disabled by default. -; Use of trans sid may risk your users security. +; Use of trans sid may risk your users' security. ; Use this option with caution. ; - User may send URL contains active session ID ; to other person via. email/irc/etc. ; - URL that contains active session ID may be stored -; in publically accessible computer. +; in publicly accessible computer. ; - User may access your site with the same session ID ; always using URL stored in browser's history or bookmarks. ; http://php.net/session.use-trans-sid session.use_trans_sid = 0 -; Select a hash function for use in generating session ids. -; Possible Values -; 0 (MD5 128 bits) -; 1 (SHA-1 160 bits) -; This option may also be set to the name of any hash function supported by -; the hash extension. A list of available hashes is returned by the hash_algos() -; function. -; http://php.net/session.hash-function -session.hash_function = 0 +; Set session ID character length. This value could be between 22 to 256. +; Shorter length than default is supported only for compatibility reason. +; Users should use 32 or more chars. +; http://php.net/session.sid-length +; Default Value: 32 +; Development Value: 26 +; Production Value: 26 +session.sid_length = 26 + +; The URL rewriter will look for URLs in a defined set of HTML tags. +;
is special; if you include them here, the rewriter will +; add a hidden field with the info which is otherwise appended +; to URLs. tag's action attribute URL will not be modified +; unless it is specified. +; Note that all valid entries require a "=", even if no value follows. +; Default Value: "a=href,area=href,frame=src,form=" +; Development Value: "a=href,area=href,frame=src,form=" +; Production Value: "a=href,area=href,frame=src,form=" +; http://php.net/url-rewriter.tags +session.trans_sid_tags = "a=href,area=href,frame=src,form=" + +; URL rewriter does not rewrite absolute URLs by default. +; To enable rewrites for absolute pathes, target hosts must be specified +; at RUNTIME. i.e. use ini_set() +; tags is special. PHP will check action attribute's URL regardless +; of session.trans_sid_tags setting. +; If no host is defined, HTTP_HOST will be used for allowed host. +; Example value: php.net,www.php.net,wiki.php.net +; Use "," for multiple hosts. No spaces are allowed. +; Default Value: "" +; Development Value: "" +; Production Value: "" +;session.trans_sid_hosts="" ; Define how many bits are stored in each character when converting ; the binary hash data to something readable. @@ -1614,77 +1528,78 @@ session.hash_function = 0 ; Development Value: 5 ; Production Value: 5 ; http://php.net/session.hash-bits-per-character -session.hash_bits_per_character = 5 +session.sid_bits_per_character = 5 -; The URL rewriter will look for URLs in a defined set of HTML tags. -; form/fieldset are special; if you include them here, the rewriter will -; add a hidden field with the info which is otherwise appended -; to URLs. If you want XHTML conformity, remove the form entry. -; Note that all valid entries require a "=", even if no value follows. -; Default Value: "a=href,area=href,frame=src,form=,fieldset=" -; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; http://php.net/url-rewriter.tags -url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" +; Enable upload progress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On -[MSSQL] -; Allow or prevent persistent links. -mssql.allow_persistent = On +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On -; Maximum number of persistent links. -1 means no limit. -mssql.max_persistent = -1 +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; http://php.net/session.upload-progress.prefix +;session.upload_progress.prefix = "upload_progress_" -; Maximum number of links (persistent+non persistent). -1 means no limit. -mssql.max_links = -1 +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; http://php.net/session.upload-progress.name +;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" -; Minimum error severity to display. -mssql.min_error_severity = 10 +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; http://php.net/session.upload-progress.freq +;session.upload_progress.freq = "1%" -; Minimum message severity to display. -mssql.min_message_severity = 10 +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.upload-progress.min-freq +;session.upload_progress.min_freq = "1" -; Compatibility mode with old versions of PHP 3.0. -mssql.compatability_mode = Off - -; Connect timeout -;mssql.connect_timeout = 5 - -; Query timeout -;mssql.timeout = 60 - -; Valid range 0 - 2147483647. Default = 4096. -;mssql.textlimit = 4096 - -; Valid range 0 - 2147483647. Default = 4096. -;mssql.textsize = 4096 - -; Limits the number of records in each batch. 0 = all records in one batch. -;mssql.batchsize = 0 - -; Specify how datetime and datetim4 columns are returned -; On => Returns data converted to SQL server settings -; Off => Returns values as YYYY-MM-DD hh:mm:ss -;mssql.datetimeconvert = On - -; Use NT authentication when connecting to the server -mssql.secure_connection = Off - -; Specify max number of processes. -1 = library default -; msdlib defaults to 25 -; FreeTDS defaults to 4096 -;mssql.max_procs = -1 - -; Specify client character set. -; If empty or not set the client charset from freetds.comf is used -; This is only used when compiled with FreeTDS -;mssql.charset = "ISO-8859-1" +; Only write session data when session data is changed. Enabled by default. +; http://php.net/session.lazy-write +;session.lazy_write = On [Assertion] +; Switch whether to compile assertions at all (to have no overhead at run-time) +; -1: Do not compile at all +; 0: Jump over assertion at run-time +; 1: Execute assertions +; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1) +; Default Value: 1 +; Development Value: 1 +; Production Value: -1 +; http://php.net/zend.assertions +zend.assertions = -1 + ; Assert(expr); active by default. ; http://php.net/assert.active ;assert.active = On -; Issue a PHP warning for each failed assertion. +; Throw an AssertationException on failed assertions +; http://php.net/assert.exception +;assert.exception = On + +; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active) ; http://php.net/assert.warning ;assert.warning = On @@ -1728,23 +1643,34 @@ mssql.secure_connection = Off [mbstring] ; language for internal character representation. +; This affects mb_send_mail() and mbstring.detect_order. ; http://php.net/mbstring.language ;mbstring.language = Japanese +; Use of this INI entry is deprecated, use global internal_encoding instead. ; internal/script encoding. -; Some encoding cannot work as internal encoding. -; (e.g. SJIS, BIG5, ISO-2022-*) -; http://php.net/mbstring.internal-encoding -;mbstring.internal_encoding = EUC-JP +; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;mbstring.internal_encoding = +; Use of this INI entry is deprecated, use global input_encoding instead. ; http input encoding. +; mbstring.encoding_traslation = On is needed to use this setting. +; If empty, default_charset or input_encoding or mbstring.input is used. +; The precedence is: default_charset < intput_encoding < mbsting.http_input ; http://php.net/mbstring.http-input -;mbstring.http_input = auto +;mbstring.http_input = -; http output encoding. mb_output_handler must be -; registered as output buffer to function +; Use of this INI entry is deprecated, use global output_encoding instead. +; http output encoding. +; mb_output_handler must be registered as output buffer to function. +; If empty, default_charset or output_encoding or mbstring.http_output is used. +; The precedence is: default_charset < output_encoding < mbstring.http_output +; To use an output encoding conversion, mbstring's output handler must be set +; otherwise output encoding conversion cannot be performed. ; http://php.net/mbstring.http-output -;mbstring.http_output = SJIS +;mbstring.http_output = ; enable automatic encoding translation according to ; mbstring.internal_encoding setting. Input chars are @@ -1755,14 +1681,14 @@ mssql.secure_connection = Off ;mbstring.encoding_translation = Off ; automatic encoding detection order. -; auto means +; "auto" detect order is changed according to mbstring.language ; http://php.net/mbstring.detect-order ;mbstring.detect_order = auto ; substitute_character used when character cannot be converted ; one from another ; http://php.net/mbstring.substitute-character -;mbstring.substitute_character = none; +;mbstring.substitute_character = none ; overload(replace) single byte functions by mbstring functions. ; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), @@ -1776,23 +1702,20 @@ mssql.secure_connection = Off ;mbstring.func_overload = 0 ; enable strict encoding detection. -;mbstring.strict_detection = Off +; Default: Off +;mbstring.strict_detection = On ; This directive specifies the regex pattern of content types for which mb_output_handler() ; is activated. ; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) ;mbstring.http_output_conv_mimetype= -; Allows to set script encoding. Only affects if PHP is compiled with --enable-zend-multibyte -; Default: "" -;mbstring.script_encoding= - [gd] ; Tell the jpeg decode to ignore warnings and try to create ; a gd image. The warning will then be displayed as notices ; disabled by default ; http://php.net/gd.jpeg-ignore-warning -;gd.jpeg_ignore_warning = 0 +;gd.jpeg_ignore_warning = 1 [exif] ; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. @@ -1854,20 +1777,160 @@ soap.wsdl_cache_limit = 5 ; Sets the maximum number of open links or -1 for unlimited. ldap.max_links = -1 -[mcrypt] -; For more information about mcrypt settings see http://php.net/mcrypt-module-open - -; Directory where to load mcrypt algorithms -; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) -;mcrypt.algorithms_dir= - -; Directory where to load mcrypt modes -; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) -;mcrypt.modes_dir= - [dba] ;dba.default_handler= +[opcache] +; Determines if Zend OPCache is enabled +;opcache.enable=1 + +; Determines if Zend OPCache is enabled for the CLI version of PHP +;opcache.enable_cli=0 + +; The OPcache shared memory storage size. +;opcache.memory_consumption=128 + +; The amount of memory for interned strings in Mbytes. +;opcache.interned_strings_buffer=8 + +; The maximum number of keys (scripts) in the OPcache hash table. +; Only numbers between 200 and 1000000 are allowed. +;opcache.max_accelerated_files=10000 + +; The maximum percentage of "wasted" memory until a restart is scheduled. +;opcache.max_wasted_percentage=5 + +; When this directive is enabled, the OPcache appends the current working +; directory to the script key, thus eliminating possible collisions between +; files with the same name (basename). Disabling the directive improves +; performance, but may break existing applications. +;opcache.use_cwd=1 + +; When disabled, you must reset the OPcache manually or restart the +; webserver for changes to the filesystem to take effect. +;opcache.validate_timestamps=1 + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +;opcache.revalidate_freq=2 + +; Enables or disables file search in include_path optimization +;opcache.revalidate_path=0 + +; If disabled, all PHPDoc comments are dropped from the code to reduce the +; size of the optimized code. +;opcache.save_comments=1 + +; Allow file existence override (file_exists, etc.) performance feature. +;opcache.enable_file_override=0 + +; A bitmask, where each bit enables or disables the appropriate OPcache +; passes +;opcache.optimization_level=0xffffffff + +;opcache.inherited_hack=1 +;opcache.dups_fix=0 + +; The location of the OPcache blacklist file (wildcards allowed). +; Each OPcache blacklist file is a text file that holds the names of files +; that should not be accelerated. The file format is to add each filename +; to a new line. The filename may be a full path or just a file prefix +; (i.e., /var/www/x blacklists all the files and directories in /var/www +; that start with 'x'). Line starting with a ; are ignored (comments). +;opcache.blacklist_filename= + +; Allows exclusion of large files from being cached. By default all files +; are cached. +;opcache.max_file_size=0 + +; Check the cache checksum each N requests. +; The default value of "0" means that the checks are disabled. +;opcache.consistency_checks=0 + +; How long to wait (in seconds) for a scheduled restart to begin if the cache +; is not being accessed. +;opcache.force_restart_timeout=180 + +; OPcache error_log file name. Empty string assumes "stderr". +;opcache.error_log= + +; All OPcache errors go to the Web server log. +; By default, only fatal errors (level 0) or errors (level 1) are logged. +; You can also enable warnings (level 2), info messages (level 3) or +; debug messages (level 4). +;opcache.log_verbosity_level=1 + +; Preferred Shared Memory back-end. Leave empty and let the system decide. +;opcache.preferred_memory_model= + +; Protect the shared memory from unexpected writing during script execution. +; Useful for internal debugging only. +;opcache.protect_memory=0 + +; Allows calling OPcache API functions only from PHP scripts which path is +; started from specified string. The default "" means no restriction +;opcache.restrict_api= + +; Mapping base of shared memory segments (for Windows only). All the PHP +; processes have to map shared memory into the same address space. This +; directive allows to manually fix the "Unable to reattach to base address" +; errors. +;opcache.mmap_base= + +; Enables and sets the second level cache directory. +; It should improve performance when SHM memory is full, at server restart or +; SHM reset. The default "" disables file based caching. +;opcache.file_cache= + +; Enables or disables opcode caching in shared memory. +;opcache.file_cache_only=0 + +; Enables or disables checksum validation when script loaded from file cache. +;opcache.file_cache_consistency_checks=1 + +; Implies opcache.file_cache_only=1 for a certain process that failed to +; reattach to the shared memory (for Windows only). Explicitly enabled file +; cache is required. +;opcache.file_cache_fallback=1 + +; Enables or disables copying of PHP code (text segment) into HUGE PAGES. +; This should improve performance, but requires appropriate OS configuration. +;opcache.huge_code_pages=1 + +; Validate cached file permissions. +;opcache.validate_permission=0 + +; Prevent name collisions in chroot'ed environment. +;opcache.validate_root=0 + +; If specified, it produces opcode dumps for debugging different stages of +; optimizations. +;opcache.opt_debug_level=0 + +[curl] +; A default value for the CURLOPT_CAINFO option. This is required to be an +; absolute path. +;curl.cainfo = + +[openssl] +; The location of a Certificate Authority (CA) file on the local filesystem +; to use when verifying the identity of SSL/TLS peers. Most users should +; not specify a value for this directive as PHP will attempt to use the +; OS-managed cert stores in its absence. If specified, this value may still +; be overridden on a per-stream basis via the "cafile" SSL stream context +; option. +;openssl.cafile= + +; If openssl.cafile is not specified or if the CA file is not found, the +; directory pointed to by openssl.capath is searched for a suitable +; certificate. This value must be a correctly hashed certificate directory. +; Most users should not specify a value for this directive as PHP will +; attempt to use the OS-managed cert stores in its absence. If specified, +; this value may still be overridden on a per-stream basis via the "capath" +; SSL stream context option. +;openssl.capath= + ; Local Variables: ; tab-width: 4 ; End: diff --git a/nodes/wiki-1.json b/nodes/wiki-1.json index a6f9be0..efd9083 100644 --- a/nodes/wiki-1.json +++ b/nodes/wiki-1.json @@ -8,7 +8,7 @@ "automatic": { "fqdn": "wiki-1", "os": "linux", - "os_version": "5.4.0-42-generic", + "os_version": "5.4.0-45-generic", "hostname": "wiki-1", "ipaddress": "192.168.122.26", "roles": [ @@ -41,19 +41,7 @@ "php::ini", "composer::global_configs", "mediawiki::default", - "mediawiki::database", - "kosmos-nginx::default", - "nginx::default", - "nginx::package", - "nginx::ohai_plugin", - "nginx::repo", - "nginx::commons", - "nginx::commons_dir", - "nginx::commons_script", - "nginx::commons_conf", - "mediawiki::nginx", - "backup::default", - "logrotate::default" + "mediawiki::database" ], "platform": "ubuntu", "platform_version": "20.04", diff --git a/site-cookbooks/kosmos-mediawiki/recipes/default.rb b/site-cookbooks/kosmos-mediawiki/recipes/default.rb index b459914..deb263b 100644 --- a/site-cookbooks/kosmos-mediawiki/recipes/default.rb +++ b/site-cookbooks/kosmos-mediawiki/recipes/default.rb @@ -45,11 +45,6 @@ mediawiki_credentials = data_bag_item('credentials', 'mediawiki') node.override['mediawiki']['db']['root_password'] = mysql_credentials["root_password"] node.override['mediawiki']['db']['pass'] = mediawiki_credentials["db_pass"] -# Fix bug in php cookbook -if platform?('ubuntu') && node[:platform_version].to_f == 14.04 - node.override['php']['ext_conf_dir'] = '/etc/php5/mods-available' -end - directory "#{node['mediawiki']['webdir']}/skins/common/images" do owner node['nginx']['user'] group node['nginx']['group'] @@ -98,8 +93,7 @@ nginx_site server_name do action :enable end -# TODO -# nginx_certbot_site server_name +nginx_certbot_site server_name # # Extensions