]> git.openstreetmap.org Git - chef.git/blob - cookbooks/donate/recipes/default.rb
Fix new foodcritic warnings
[chef.git] / cookbooks / donate / recipes / default.rb
1 #
2 # Cookbook Name:: donate
3 # Recipe:: default
4 #
5 # Copyright 2016, 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 "apache"
21 include_recipe "mysql"
22 include_recipe "git"
23
24 package "php"
25 package "php-cli"
26 package "php-curl"
27 package "php-mysql"
28 package "php-gd"
29
30 apache_module "php7.0"
31
32 apache_module "headers"
33
34 passwords = data_bag_item("donate", "passwords")
35
36 database_password = passwords["database"]
37
38 mysql_user "donate@localhost" do
39   password database_password
40 end
41
42 mysql_database "donate" do
43   permissions "donate@localhost" => :all
44 end
45
46 directory "/srv/donate.openstreetmap.org" do
47   owner "donate"
48   group "donate"
49   mode 0o755
50 end
51
52 git "/srv/donate.openstreetmap.org" do
53   action :sync
54   repository "git://github.com/osmfoundation/donation-drive.git"
55   user "donate"
56   group "donate"
57 end
58
59 directory "/srv/donate.openstreetmap.org/data" do
60   owner "donate"
61   group "donate"
62   mode 0o755
63 end
64
65 template "/srv/donate.openstreetmap.org/scripts/db-connect.inc.php" do
66   source "db-connect.inc.php.erb"
67   owner "root"
68   group "donate"
69   mode 0o644
70   variables :passwords => passwords
71 end
72
73 ssl_certificate "donate.openstreetmap.org" do
74   domains ["donate.openstreetmap.org", "donate.openstreetmap.com",
75            "donate.openstreetmap.net", "donate.osm.org"]
76   notifies :reload, "service[apache2]"
77 end
78
79 apache_site "donate.openstreetmap.org" do
80   template "apache.erb"
81 end
82
83 template "/etc/cron.d/osmf-donate" do
84   source "cron.erb"
85   owner "root"
86   group "root"
87   mode 0o600
88   variables :passwords => passwords
89 end
90
91 template "/etc/cron.daily/osmf-donate-backup" do
92   source "backup.cron.erb"
93   owner "root"
94   group "root"
95   mode 0o750
96   variables :passwords => passwords
97 end