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