]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/recipes/default.rb
2e9ccd1b41b3d5563445067c21fc1a3b00b28ad0
[chef.git] / cookbooks / mediawiki / recipes / default.rb
1 #
2 # Cookbook Name:: mediawiki
3 # Recipe:: default
4 #
5 # Copyright 2013, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 include_recipe "memcached"
21 include_recipe "apache"
22 include_recipe "mysql"
23 include_recipe "git"
24
25 # Mediawiki Base Requirements
26 if node[:lsb][:release].to_f >= 16.04
27   package "php"
28   package "php-cli"
29   package "php-curl"
30   package "php-mysql"
31   package "php-gd"
32   package "php-intl"
33 else
34   package "php5"
35   package "php5-cli"
36   package "php5-curl"
37   package "php5-mysql"
38   package "php5-gd"
39   package "php-apc"
40   package "php5-intl"
41 end
42
43 # Mediawiki enhanced difference engine
44 package "php-wikidiff2"
45
46 # Mediawiki Image + SVG support
47 package "imagemagick"
48 package "librsvg2-bin"
49
50 # Mediawiki PDF support via Extension:PdfHandler
51 package "ghostscript"
52 package "poppler-utils"
53
54 # Mediawiki backup
55 package "xz-utils"
56 package "liblz4-tool"
57
58 # Mediawiki packages for VisualEditor support
59 package "curl"
60 package "parsoid"
61
62 template "/etc/mediawiki/parsoid/settings.js" do
63   source "parsoid-settings.js.erb"
64   owner "root"
65   group "root"
66   mode 0o644
67 end
68
69 service "parsoid" do
70   action [:enable]
71   supports :status => false, :restart => true, :reload => false
72   subscribes :restart, "template[/etc/mediawiki/parsoid/settings.js]"
73 end
74
75 if node[:lsb][:release].to_f >= 16.04
76   link "/etc/php/7.0/apache2/conf.d/20-wikidiff2.ini" do
77     to "../../mods-available/wikidiff2.ini"
78   end
79
80   apache_module "php7.0"
81 else
82   link "/etc/php5/apache2/conf.d/20-wikidiff2.ini" do
83     to "../../mods-available/wikidiff2.ini"
84   end
85
86   apache_module "php5"
87 end
88
89 apache_module "rewrite"