]> git.openstreetmap.org Git - chef.git/blob - cookbooks/db/recipes/master.rb
Build database extensions for all installed postgres versions
[chef.git] / cookbooks / db / recipes / master.rb
1 #
2 # Cookbook:: db
3 # Recipe:: master
4 #
5 # Copyright:: 2011, 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 #     https://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 "db::base"
21
22 passwords = data_bag_item("db", "passwords")
23
24 postgresql_user "tomh" do
25   cluster node[:db][:cluster]
26   superuser true
27 end
28
29 postgresql_user "matt" do
30   cluster node[:db][:cluster]
31   superuser true
32 end
33
34 postgresql_user "openstreetmap" do
35   cluster node[:db][:cluster]
36   password passwords["openstreetmap"]
37 end
38
39 postgresql_user "rails" do
40   cluster node[:db][:cluster]
41   password passwords["rails"]
42 end
43
44 postgresql_user "planetdump" do
45   cluster node[:db][:cluster]
46   password passwords["planetdump"]
47 end
48
49 postgresql_user "planetdiff" do
50   cluster node[:db][:cluster]
51   password passwords["planetdiff"]
52   replication true
53 end
54
55 postgresql_user "backup" do
56   cluster node[:db][:cluster]
57   password passwords["backup"]
58 end
59
60 postgresql_user "gpximport" do
61   cluster node[:db][:cluster]
62   password passwords["gpximport"]
63 end
64
65 postgresql_user "munin" do
66   cluster node[:db][:cluster]
67   password passwords["munin"]
68 end
69
70 postgresql_user "replication" do
71   cluster node[:db][:cluster]
72   password passwords["replication"]
73   replication true
74 end
75
76 postgresql_database "openstreetmap" do
77   cluster node[:db][:cluster]
78   owner "openstreetmap"
79 end
80
81 postgresql_extension "btree_gist" do
82   cluster node[:db][:cluster]
83   database "openstreetmap"
84   only_if { node[:postgresql][:clusters][node[:db][:cluster]] && node[:postgresql][:clusters][node[:db][:cluster]][:version] >= 9.0 }
85 end
86
87 file "/etc/cron.daily/rails-db" do
88   action :delete
89 end