]> git.openstreetmap.org Git - chef.git/blob - cookbooks/forum/recipes/default.rb
Fix a few forum configuration issues
[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-apcu"
29
30 apache_module "php7.0"
31 apache_module "rewrite"
32
33 apache_site "default" do
34   action [:disable]
35 end
36
37 apache_site "forum.openstreetmap.org" do
38   template "apache.erb"
39 end
40
41 directory "/srv/forum.openstreetmap.org" do
42   owner "forum"
43   group "forum"
44   mode 0o755
45 end
46
47 git "/srv/forum.openstreetmap.org/html/" do
48   action :sync
49   repository "http://github.com/openstreetmap/openstreetmap-forum.git"
50   revision "openstreetmap"
51   depth 1
52   user "forum"
53   group "forum"
54 end
55
56 directory "/srv/forum.openstreetmap.org/html/cache/" do
57   owner "www-data"
58   group "www-data"
59   mode 0o755
60 end
61
62 directory "/srv/forum.openstreetmap.org/html/img/avatars/" do
63   owner "www-data"
64   group "www-data"
65   mode 0o755
66 end
67
68 template "/srv/forum.openstreetmap.org/html/config.php" do
69   source "config.php.erb"
70   owner "forum"
71   group "www-data"
72   mode 0o440
73   variables :passwords => passwords
74 end
75
76 mysql_user "forum@localhost" do
77   password passwords["database"]
78 end
79
80 mysql_database "forum" do
81   permissions "forum@localhost" => :all
82 end
83
84 template "/etc/cron.daily/forum-backup" do
85   source "backup.cron.erb"
86   owner "root"
87   group "root"
88   mode 0o750
89   variables :passwords => passwords
90 end