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