]> git.openstreetmap.org Git - chef.git/blob - cookbooks/forum/recipes/default.rb
nominatim: remove old php settings
[chef.git] / cookbooks / forum / recipes / default.rb
1 #
2 # Cookbook:: forum
3 # Recipe:: default
4 #
5 # Copyright:: 2014, 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 #     https://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 "accounts"
21 include_recipe "apache"
22 include_recipe "git"
23 include_recipe "mysql"
24 include_recipe "php::apache"
25
26 cache_dir = Chef::Config[:file_cache_path]
27
28 passwords = data_bag_item("forum", "passwords")
29
30 package %w[
31   php-cli
32   php-mysql
33   php-xml
34   php-apcu
35   unzip
36 ]
37
38 apache_module "env"
39 apache_module "rewrite"
40
41 ssl_certificate "forum.openstreetmap.org" do
42   domains ["forum.openstreetmap.org", "forum.osm.org"]
43   notifies :reload, "service[apache2]"
44 end
45
46 apache_site "forum.openstreetmap.org" do
47   template "apache.erb"
48 end
49
50 directory "/srv/forum.openstreetmap.org" do
51   owner "forum"
52   group "forum"
53   mode "755"
54 end
55
56 git "/srv/forum.openstreetmap.org/html/" do
57   action :sync
58   repository "http://github.com/openstreetmap/openstreetmap-forum.git"
59   revision "openstreetmap-1.5.10"
60   depth 1
61   user "forum"
62   group "forum"
63   notifies :reload, "service[apache2]"
64 end
65
66 remote_file "#{cache_dir}/air3_v0.8.zip" do
67   action :create_if_missing
68   source "https://fluxbb.org/resources/styles/air3/releases/0.8/air3_v0.8.zip"
69   owner "root"
70   group "root"
71   mode "644"
72   backup false
73 end
74
75 execute "#{cache_dir}/air3_v0.8.zip" do
76   action :nothing
77   command "unzip -o -qq #{cache_dir}/air3_v0.8.zip Air3.css 'Air3/*'"
78   cwd "/srv/forum.openstreetmap.org/html/style"
79   user "forum"
80   group "forum"
81   subscribes :run, "remote_file[#{cache_dir}/air3_v0.8.zip]", :immediately
82 end
83
84 directory "/srv/forum.openstreetmap.org/html/cache/" do
85   owner "www-data"
86   group "www-data"
87   mode "755"
88 end
89
90 directory "/srv/forum.openstreetmap.org/html/img/avatars/" do
91   owner "www-data"
92   group "www-data"
93   mode "755"
94 end
95
96 template "/srv/forum.openstreetmap.org/html/config.php" do
97   source "config.php.erb"
98   owner "forum"
99   group "www-data"
100   mode "440"
101   variables :passwords => passwords
102 end
103
104 mysql_user "forum@localhost" do
105   password passwords["database"]
106 end
107
108 mysql_database "forum" do
109   permissions "forum@localhost" => :all
110 end
111
112 template "/etc/cron.daily/forum-backup" do
113   source "backup.cron.erb"
114   owner "root"
115   group "root"
116   mode "750"
117   variables :passwords => passwords
118 end