]> git.openstreetmap.org Git - chef.git/blob - cookbooks/forum/recipes/default.rb
7288824b5ba897f3932b9de53b440a261a89f0b8
[chef.git] / cookbooks / forum / recipes / default.rb
1 #
2 # Cookbook Name:: 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 #     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 include_recipe "apache::ssl"
20 include_recipe "git"
21 include_recipe "mysql"
22
23 passwords = data_bag_item("forum", "passwords")
24
25 package "php"
26 package "php-cli"
27 package "php-mysql"
28 package "php-xml"
29 package "php-apcu"
30
31 apache_module "php7.0"
32 apache_module "rewrite"
33
34 ssl_certificate "forum.openstreetmap.org" do
35   domains ["forum.openstreetmap.org", "forum.osm.org"]
36   notifies :reload, "service[apache2]"
37 end
38
39 apache_site "forum.openstreetmap.org" do
40   template "apache.erb"
41 end
42
43 directory "/srv/forum.openstreetmap.org" do
44   owner "forum"
45   group "forum"
46   mode 0o755
47 end
48
49 git "/srv/forum.openstreetmap.org/html/" do
50   action :sync
51   repository "http://github.com/openstreetmap/openstreetmap-forum.git"
52   revision "openstreetmap-1.5.10"
53   depth 1
54   user "forum"
55   group "forum"
56   notifies :reload, "service[apache2]"
57 end
58
59 directory "/srv/forum.openstreetmap.org/html/cache/" do
60   owner "www-data"
61   group "www-data"
62   mode 0o755
63 end
64
65 directory "/srv/forum.openstreetmap.org/html/img/avatars/" do
66   owner "www-data"
67   group "www-data"
68   mode 0o755
69 end
70
71 template "/srv/forum.openstreetmap.org/html/config.php" do
72   source "config.php.erb"
73   owner "forum"
74   group "www-data"
75   mode 0o440
76   variables :passwords => passwords
77 end
78
79 mysql_user "forum@localhost" do
80   password passwords["database"]
81 end
82
83 mysql_database "forum" do
84   permissions "forum@localhost" => :all
85 end
86
87 template "/etc/cron.daily/forum-backup" do
88   source "backup.cron.erb"
89   owner "root"
90   group "root"
91   mode 0o750
92   variables :passwords => passwords
93 end