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 # https://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 include_recipe "apache"
21 include_recipe "mysql"
32 apache_module "php7.0"
34 apache_module "headers"
36 passwords = data_bag_item("donate", "passwords")
38 database_password = passwords["database"]
40 mysql_user "donate@localhost" do
41 password database_password
44 mysql_database "donate" do
45 permissions "donate@localhost" => :all
48 directory "/srv/donate.openstreetmap.org" do
54 git "/srv/donate.openstreetmap.org" do
56 repository "git://github.com/osmfoundation/donation-drive.git"
61 directory "/srv/donate.openstreetmap.org/data" do
67 template "/srv/donate.openstreetmap.org/scripts/db-connect.inc.php" do
68 source "db-connect.inc.php.erb"
72 variables :passwords => passwords
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]"
81 apache_site "donate.openstreetmap.org" do
85 template "/etc/cron.d/osmf-donate" do
90 variables :passwords => passwords
93 template "/etc/cron.daily/osmf-donate-backup" do
94 source "backup.cron.erb"
98 variables :passwords => passwords