]> git.openstreetmap.org Git - chef.git/blob - cookbooks/donate/recipes/default.rb
Use strings for file modes
[chef.git] / cookbooks / donate / recipes / default.rb
1 #
2 # Cookbook:: 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 #     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 package %w[
27   php-cli
28   php-curl
29   php-mysql
30   php-gd
31 ]
32
33 apache_module "headers"
34
35 passwords = data_bag_item("donate", "passwords")
36
37 database_password = passwords["database"]
38
39 mysql_user "donate@localhost" do
40   password database_password
41 end
42
43 mysql_database "donate" do
44   permissions "donate@localhost" => :all
45 end
46
47 directory "/srv/donate.openstreetmap.org" do
48   owner "donate"
49   group "donate"
50   mode "755"
51 end
52
53 git "/srv/donate.openstreetmap.org" do
54   action :sync
55   repository "https://github.com/osmfoundation/donation-drive.git"
56   depth 1
57   user "donate"
58   group "donate"
59 end
60
61 directory "/srv/donate.openstreetmap.org/data" do
62   owner "donate"
63   group "donate"
64   mode "755"
65 end
66
67 template "/srv/donate.openstreetmap.org/scripts/db-connect.inc.php" do
68   source "db-connect.inc.php.erb"
69   owner "root"
70   group "donate"
71   mode "644"
72   variables :passwords => passwords
73 end
74
75 ssl_certificate "donate.openstreetmap.org" do
76   domains ["donate.openstreetmap.org", "donate.openstreetmap.com",
77            "donate.openstreetmap.net", "donate.osm.org"]
78   notifies :reload, "service[apache2]"
79 end
80
81 apache_site "donate.openstreetmap.org" do
82   template "apache.erb"
83 end
84
85 cron_d "osmf-donate" do
86   minute "*/2"
87   user "donate"
88   command "cd /srv/donate.openstreetmap.org/scripts/; /usr/bin/php /srv/donate.openstreetmap.org/scripts/update_csv_donate2016.php"
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 "750"
96   variables :passwords => passwords
97 end