- osqa
- otrs
- passenger
+ - php
+ - php-apache
+ - php-fpm
- piwik
- planet
- planet-current
- name: passenger
run_list:
- recipe[passenger::default]
+ - name: php
+ run_list:
+ - recipe[php::default]
+ - name: php-apache
+ run_list:
+ - recipe[php::apache]
+ - name: php-fpm
+ run_list:
+ - recipe[php::fpm]
- name: piwik
run_list:
- recipe[piwik::default]
depends "munin"
depends "mysql"
depends "nodejs"
+depends "php"
depends "postgresql"
depends "python"
depends "tools"
include_recipe "munin"
include_recipe "mysql"
include_recipe "nodejs"
+include_recipe "php"
include_recipe "postgresql"
include_recipe "python"
package %w[
- php
php-cgi
php-cli
php-curl
php-db
- php-fpm
php-imagick
php-mysql
php-pear
package "apache2-suexec-pristine"
-service "php7.2-fpm" do
- action [:enable, :start]
+php_fpm "default" do
+ template "fpm-default.conf.erb"
end
-template "/etc/php/7.2/fpm/pool.d/default.conf" do
- source "fpm-default.conf.erb"
- owner "root"
- group "root"
- mode 0o644
- notifies :reload, "service[php7.2-fpm]"
-end
-
-file "/etc/php/7.2/fpm/pool.d/www.conf" do
+php_fpm "www" do
action :delete
- notifies :reload, "service[php7.2-fpm]"
end
directory "/srv/dev.openstreetmap.org" do
port = 7000 + account["uid"].to_i
- template "/etc/php/7.2/fpm/pool.d/#{name}.conf" do
- source "fpm.conf.erb"
- owner "root"
- group "root"
- mode 0o644
+ php_fpm name do
+ template "fpm.conf.erb"
variables :user => name, :port => port
- notifies :reload, "service[php7.2-fpm]"
end
ssl_certificate "#{name}.dev.openstreetmap.org" do
+++ /dev/null
-# Use prefork as PHP is to dumb for anything else
-override[:apache][:mpm] = "prefork"
version "1.0.0"
supports "ubuntu"
depends "apache"
+depends "php"
#
include_recipe "apache"
-
-apache_module "php7.2"
+include_recipe "php::apache"
directory "/srv/dmca.openstreetmap.org" do
owner "root"
# Enable the "donate" role
default[:accounts][:users][:donate][:status] = :role
-
-# Use prefork as PHP is to dumb for anything else
-override[:apache][:mpm] = "prefork"
supports "ubuntu"
depends "accounts"
depends "apache"
-depends "mysql"
depends "git"
+depends "mysql"
+depends "php"
include_recipe "accounts"
include_recipe "apache"
-include_recipe "mysql"
include_recipe "git"
+include_recipe "mysql"
+include_recipe "php::apache"
package %w[
- php
php-cli
php-curl
php-mysql
php-gd
]
-apache_module "php7.2"
-
apache_module "headers"
passwords = data_bag_item("donate", "passwords")
# Enable the "forum" role
default[:accounts][:users][:forum][:status] = :role
-
-# Use prefork as PHP is to dumb for anything else
-override[:apache][:mpm] = "prefork"
depends "apache"
depends "git"
depends "mysql"
+depends "php"
include_recipe "apache"
include_recipe "git"
include_recipe "mysql"
+include_recipe "php::apache"
cache_dir = Chef::Config[:file_cache_path]
passwords = data_bag_item("forum", "passwords")
package %w[
- php
php-cli
php-mysql
php-xml
unzip
]
-apache_module "php7.2"
apache_module "rewrite"
ssl_certificate "forum.openstreetmap.org" do
# Default to enabling the "wiki" role
default[:accounts][:users][:wiki][:status] = :role
-# Use prefork as PHP is to dumb for anything else
-override[:apache][:mpm] = "prefork"
-
# Set mediawiki defaults
default[:mediawiki][:user] = "wiki"
default[:mediawiki][:group] = "wiki"
depends "git"
depends "memcached"
depends "mysql"
+depends "php"
include_recipe "git"
include_recipe "memcached"
include_recipe "mysql"
+include_recipe "php::apache"
# Mediawiki Base Requirements
package %w[
- php
php-cli
php-curl
php-gd
subscribes :restart, "template[/etc/mediawiki/parsoid/config.yaml]"
end
-apache_module "php7.2"
-
-link "/etc/php/7.2/apache2/conf.d/20-wikidiff2.ini" do
+link "/etc/php/#{node[:php][:version]}/apache2/conf.d/20-wikidiff2.ini" do
to "../../mods-available/wikidiff2.ini"
end
depends "git"
depends "munin"
depends "nginx"
+depends "php"
depends "postgresql"
depends "python"
depends "systemd"
include_recipe "accounts"
include_recipe "munin"
+include_recipe "php::fpm"
basedir = data_bag_item("accounts", "nominatim")["home"]
email_errors = data_bag_item("accounts", "lonvia")["email"]
python3-pyosmium
pyosmium
python3-psycopg2
- php
- php-fpm
php-pgsql
php-intl
]
end
end
-service "php7.2-fpm" do
- action [:enable, :start]
- supports :status => true, :restart => true, :reload => true
-end
-
node[:nominatim][:fpm_pools].each do |name, data|
- template "/etc/php/7.2/fpm/pool.d/#{name}.conf" do
- source "fpm.conf.erb"
- owner "root"
- group "root"
- mode 0o644
+ php_fpm name do
+ template "fpm.conf.erb"
variables data.merge(:name => name)
- notifies :reload, "service[php7.2-fpm]"
end
end
--- /dev/null
+# PHP Cookbook
+
+Installs and configures PHP.
--- /dev/null
+default[:php][:version] = "7.2"
--- /dev/null
+name "php"
+maintainer "OpenStreetMap Administrators"
+maintainer_email "admins@openstreetmap.org"
+license "Apache-2.0"
+description "Installs and configures PHP"
+
+version "1.0.0"
+supports "ubuntu"
+depends "apache"
--- /dev/null
+#
+# Cookbook:: php
+# Recipe:: apache
+#
+# Copyright:: 2020, OpenStreetMap Foundation
+#
+# 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://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.
+#
+
+node.override[:apache][:mpm] = "prefork"
+
+include_recipe "php"
+include_recipe "apache"
+
+apache_module "php#{node[:php][:version]}"
--- /dev/null
+#
+# Cookbook:: php
+# Recipe:: default
+#
+# Copyright:: 2020, OpenStreetMap Foundation
+#
+# 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://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.
+#
+
+package "php"
--- /dev/null
+#
+# Cookbook:: php
+# Recipe:: fpm
+#
+# Copyright:: 2020, OpenStreetMap Foundation
+#
+# 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://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"
+
+package "php-fpm"
+
+service "php#{node[:php][:version]}-fpm" do
+ action [:enable, :start]
+end
--- /dev/null
+#
+# Cookbook:: php
+# Resource:: php_fpm
+#
+# Copyright:: 2020, OpenStreetMap Foundation
+#
+# 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://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.
+#
+
+default_action :create
+
+property :pool, :kind_of => String, :name_property => true
+property :cookbook, :kind_of => String
+property :template, :kind_of => String, :required => true
+property :variables, :kind_of => Hash, :default => {}
+property :reload_fpm, :kind_of => [TrueClass, FalseClass], :default => true
+
+action :create do
+ declare_resource :template, conf_file do
+ cookbook new_resource.cookbook
+ source new_resource.template
+ owner "root"
+ group "root"
+ mode 0o644
+ variables new_resource.variables
+ end
+end
+
+action :delete do
+ file conf_file do
+ action :delete
+ end
+end
+
+action_class do
+ def php_version
+ node[:php][:version]
+ end
+
+ def conf_file
+ "/etc/php/#{php_version}/fpm/pool.d/#{new_resource.pool}.conf"
+ end
+end
+
+def after_created
+ notifies :reload, "service[php#{node[:php][:version]}-fpm]" if reload_fpm
+end
VisitFrequency VisitorInterest VisitsSummary VisitTime WebsiteMeasurable
Widgetize
]
-
-override[:apache][:mpm] = "prefork"
depends "apache"
depends "geoipupdate"
depends "mysql"
+depends "php"
include_recipe "apache"
include_recipe "geoipupdate"
include_recipe "mysql"
+include_recipe "php::apache"
passwords = data_bag_item("piwik", "passwords")
package %w[
- php
php-cli
php-curl
php-mbstring
]
apache_module "expires"
-apache_module "php7.2"
apache_module "rewrite"
version = node[:piwik][:version]
# Enable the "wordpress" role
default[:accounts][:users][:wordpress][:status] = :role
-# Use prefork as PHP is to dumb for anything else
-override[:apache][:mpm] = "prefork"
-
# Set wordpress defaults
default[:wordpress][:user] = "wordpress"
default[:wordpress][:group] = "wordpress"
depends "fail2ban"
depends "git"
depends "mysql"
+depends "php"
depends "ssl"
gem "httpclient"
gem "php_serialize"
include_recipe "fail2ban"
include_recipe "git"
include_recipe "mysql"
+include_recipe "php::apache"
package %w[
subversion
- php
php-mysql
]
-apache_module "php7.2"
apache_module "rewrite"
fail2ban_filter "wordpress" do
--- /dev/null
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("apache2") do
+ it { should be_installed }
+end
+
+describe service("apache2") do
+ it { should be_enabled }
+ it { should be_running }
+end
+
+describe port(80) do
+ it { should be_listening.with("tcp") }
+end
+
+describe port(443) do
+ it { should be_listening.with("tcp") }
+end