]> git.openstreetmap.org Git - chef.git/blob - cookbooks/donate/recipes/default.rb
Add donate.osm.org chef code
[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 package "php"
25 package "php-cli"
26 package "php-curl"
27 package "php-mbstring"
28 package "php-mysql"
29 package "php-gd"
30
31 apache_module "php7.0"
32 apache_module "headers"
33
34 passwords = data_bag_item("donate", "passwords")
35
36 database_password = passwords["database"]
37
38 mysql_user "donate@localhost" do
39   password database_password
40 end
41
42 mysql_database "donate" do
43   permissions "donate@localhost" => :all
44 end
45
46 git "/srv/donate.openstreetmap.org" do
47   action :sync
48   repository "git://github.com/osmfoundation/donation-drive.git"
49   user "donate"
50   group "donate"
51 end
52
53 apache_site "donate.openstreetmap.org" do
54   template "apache.erb"
55 end
56
57 template "/etc/cron.d/osmf-donate" do
58   source "cron.erb"
59   owner "root"
60   group "root"
61   mode 0o600
62   variables :passwords => passwords
63 end
64
65 template "/etc/cron.daily/osmf-donate-backup" do
66   source "backup.cron.erb"
67   owner "root"
68   group "root"
69   mode 0o750
70   variables :passwords => passwords
71 end