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 "accounts"
 
  21 include_recipe "apache"
 
  23 include_recipe "mysql"
 
  24 include_recipe "php::fpm"
 
  33 apache_module "headers"
 
  35 apache_module "proxy_fcgi"
 
  37 passwords = data_bag_item("donate", "passwords")
 
  39 database_password = passwords["database"]
 
  41 mysql_user "donate@localhost" do
 
  42   password database_password
 
  45 mysql_database "donate" do
 
  46   permissions "donate@localhost" => :all
 
  49 directory "/srv/donate.openstreetmap.org" do
 
  55 git "/srv/donate.openstreetmap.org" do
 
  57   repository "https://github.com/osmfoundation/donation-drive.git"
 
  63 directory "/srv/donate.openstreetmap.org/data" do
 
  69 template "/srv/donate.openstreetmap.org/scripts/db-connect.inc.php" do
 
  70   source "db-connect.inc.php.erb"
 
  74   variables :passwords => passwords
 
  77 ssl_certificate "donate.openstreetmap.org" do
 
  78   domains ["donate.openstreetmap.org", "donate.openstreetmap.com",
 
  79            "donate.openstreetmap.net", "donate.osm.org"]
 
  80   notifies :reload, "service[apache2]"
 
  83 php_fpm "donate.openstreetmap.org" do
 
  84   php_admin_values "open_basedir" => "/srv/donate.openstreetmap.org/:/usr/share/php/:/tmp/",
 
  85                    "disable_functions" => "exec,shell_exec,system,passthru,popen,proc_open"
 
  89 apache_site "donate.openstreetmap.org" do
 
  93 systemd_service "osmf-donate" do
 
  94   description "Update donation list"
 
  95   exec_start "/usr/bin/php /srv/donate.openstreetmap.org/scripts/update_csv_donate2016.php"
 
  96   working_directory "/srv/donate.openstreetmap.org/scripts"
 
  99   memory_deny_write_execute true
 
 100   restrict_address_families "AF_UNIX"
 
 101   read_write_paths "/srv/donate.openstreetmap.org/data"
 
 104 systemd_timer "osmf-donate" do
 
 105   description "Update donation list"
 
 107   on_unit_inactive_sec "2m"
 
 110 service "osmf-donate.timer" do
 
 111   action [:enable, :start]
 
 114 template "/etc/cron.daily/osmf-donate-backup" do
 
 115   source "backup.cron.erb"
 
 119   variables :passwords => passwords