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