2 # Cookbook Name:: donate
5 # Copyright 2016, OpenStreetMap Foundation
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
20 node.default[:ssl][:certificates] = node[:ssl][:certificates] | ["openstreetmap"]
22 include_recipe "apache::ssl"
23 include_recipe "mysql"
26 if node[:lsb][:release].to_f >= 16.04
33 apache_module "php7.0"
44 apache_module "headers"
46 passwords = data_bag_item("donate", "passwords")
48 database_password = passwords["database"]
50 mysql_user "donate@localhost" do
51 password database_password
54 mysql_database "donate" do
55 permissions "donate@localhost" => :all
58 directory "/srv/donate.openstreetmap.org" do
64 git "/srv/donate.openstreetmap.org" do
66 repository "git://github.com/osmfoundation/donation-drive.git"
71 directory "/srv/donate.openstreetmap.org/data" do
77 template "/srv/donate.openstreetmap.org/scripts/db-connect.inc.php" do
78 source "db-connect.inc.php.erb"
82 variables :passwords => passwords
85 ssl_certificate "donate.openstreetmap.org" do
86 domains ["donate.openstreetmap.org", "donate.openstreetmap.com",
87 "donate.openstreetmap.net", "donate.osm.org"]
88 notifies :reload, "service[apache2]"
91 apache_site "donate.openstreetmap.org" do
95 template "/etc/cron.d/osmf-donate" do
100 variables :passwords => passwords
103 template "/etc/cron.daily/osmf-donate-backup" do
104 source "backup.cron.erb"
108 variables :passwords => passwords