]> git.openstreetmap.org Git - chef.git/blob - cookbooks/donate/recipes/default.rb
donate: add missing redirects
[chef.git] / cookbooks / donate / recipes / default.rb
1 #
2 # Cookbook Name:: 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 #     http://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 "apache::ssl"
21 include_recipe "mysql"
22 include_recipe "git"
23
24 if node[:lsb][:release].to_f >= 16.04
25   package "php"
26   package "php-cli"
27   package "php-mysql"
28   package "php-gd"
29
30   apache_module "php7.0"
31 else
32   package "php5"
33   package "php5-cli"
34   package "php5-mysql"
35   package "php5-gd"
36
37   apache_module "php5"
38 end
39
40 apache_module "headers"
41
42 passwords = data_bag_item("donate", "passwords")
43
44 database_password = passwords["database"]
45
46 mysql_user "donate@localhost" do
47   password database_password
48 end
49
50 mysql_database "donate" do
51   permissions "donate@localhost" => :all
52 end
53
54 directory "/srv/donate.openstreetmap.org" do
55   owner "donate"
56   group "donate"
57   mode 0o755
58 end
59
60 git "/srv/donate.openstreetmap.org" do
61   action :sync
62   repository "git://github.com/osmfoundation/donation-drive.git"
63   user "donate"
64   group "donate"
65 end
66
67 apache_site "donate.openstreetmap.org" do
68   template "apache.erb"
69 end
70
71 template "/etc/cron.d/osmf-donate" do
72   source "cron.erb"
73   owner "root"
74   group "root"
75   mode 0o600
76   variables :passwords => passwords
77 end
78
79 template "/etc/cron.daily/osmf-donate-backup" do
80   source "backup.cron.erb"
81   owner "root"
82   group "root"
83   mode 0o750
84   variables :passwords => passwords
85 end