property :recaptcha_public_key, :kind_of => String
property :recaptcha_private_key, :kind_of => String
property :extra_file_extensions, :kind_of => [String, Array], :default => []
+property :fpm_max_children, :kind_of => Integer, :default => 5
property :reload_apache, :kind_of => [TrueClass, FalseClass], :default => true
action :create do
- node.normal_unless[:mediawiki][:sites][new_resource.site] = {}
+ node.rm_normal(:mediawiki, :sites, new_resource.site)
- node.normal[:mediawiki][:sites][new_resource.site][:directory] = site_directory
- node.normal[:mediawiki][:sites][new_resource.site][:version] = new_resource.version
+ node.default[:mediawiki][:sites][new_resource.site] = {
+ :directory => site_directory,
+ :version => new_resource.version
+ }
- node.normal_unless[:mediawiki][:sites][new_resource.site][:wgSecretKey] = SecureRandom.base64(48)
+ secret_key = persistent_token("mediawiki", new_resource.site, "wgSecretKey")
mysql_user "#{new_resource.database_user}@localhost" do
password new_resource.database_password
declare_resource :directory, site_directory do
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o775
+ mode "775"
end
declare_resource :directory, mediawiki_directory do
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o775
+ mode "775"
end
mediawiki_reference = "REL#{new_resource.version}".tr(".", "_")
source "composer.local.json.erb"
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o664
+ mode "664"
end
# Safety catch if git doesn't update but install.php hasn't run
declare_resource :directory, "#{mediawiki_directory}/images" do
owner "www-data"
group node[:mediawiki][:group]
- mode 0o775
+ mode "775"
end
declare_resource :directory, "#{mediawiki_directory}/cache" do
owner "www-data"
group node[:mediawiki][:group]
- mode 0o775
+ mode "775"
end
declare_resource :directory, "#{mediawiki_directory}/LocalSettings.d" do
user node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o775
+ mode "775"
end
template "#{mediawiki_directory}/LocalSettings.php" do
source "LocalSettings.php.erb"
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o664
+ mode "664"
variables :name => new_resource.site,
:directory => mediawiki_directory,
:database_params => database_params,
- :mediawiki => mediawiki_params
+ :mediawiki => mediawiki_params,
+ :secret_key => secret_key
notifies :run, "execute[#{mediawiki_directory}/maintenance/update.php]"
end
- file "/etc/cron.d/mediawiki-#{cron_name}" do
- action :delete
- end
-
cron_d "mediawiki-#{cron_name}-sitemap" do
comment "Generate sitemap.xml daily"
minute "30"
source "mediawiki-backup.cron.erb"
owner "root"
group "root"
- mode 0o700
+ mode "700"
variables :name => new_resource.site,
:directory => site_directory,
:database_params => database_params
update_site false
end
- # LocalisationUpdate Update Cron
- # template "/etc/cron.d/mediawiki-#{name}-LocalisationUpdate" do
- # cookbook "mediawiki"
- # source "mediawiki-LocalisationUpdate.cron.erb"
- # owner "root"
- # group "root"
- # mode 0755
- # variables :name => name, :directory => site_directory, :user => node[:mediawiki][:user]
- # end
-
# mediawiki_extension "Translate" do
# site new_resource.site
# template "mw-ext-Translate.inc.php.erb"
cookbook "mediawiki"
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o644
+ mode "644"
backup false
end
cookbook "mediawiki"
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o644
+ mode "644"
backup false
end
cookbook "mediawiki"
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o644
+ mode "644"
backup false
end
domains [new_resource.site] + Array(new_resource.aliases)
end
+ php_fpm new_resource.site do
+ pm_max_children new_resource.fpm_max_children
+ php_admin_values "open_basedir" => "#{site_directory}/:/usr/share/php/:/dev/null:/tmp/"
+ php_values "memory_limit" => "500M",
+ "max_execution_time" => "240",
+ "upload_max_filesize" => "70M",
+ "post_max_size" => "100M"
+ end
+
apache_site new_resource.site do
cookbook "mediawiki"
template "apache.erb"
source "LocalSettings.php.erb"
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode 0o664
+ mode "664"
variables :name => new_resource.site,
:directory => mediawiki_directory,
:database_params => database_params,
end
action_class do
+ include Chef::Mixin::PersistentToken
+
def site_directory
new_resource.directory || "/srv/#{new_resource.site}"
end