5 # Copyright:: 2011, 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 "db::base"
22 passwords = data_bag_item("db", "passwords")
24 postgresql_user "tomh" do
25 cluster node[:db][:cluster]
29 postgresql_user "matt" do
30 cluster node[:db][:cluster]
34 postgresql_user "openstreetmap" do
35 cluster node[:db][:cluster]
36 password passwords["openstreetmap"]
39 postgresql_user "rails" do
40 cluster node[:db][:cluster]
41 password passwords["rails"]
44 postgresql_user "planetdump" do
45 cluster node[:db][:cluster]
46 password passwords["planetdump"]
49 postgresql_user "planetdiff" do
50 cluster node[:db][:cluster]
51 password passwords["planetdiff"]
55 postgresql_user "backup" do
56 cluster node[:db][:cluster]
57 password passwords["backup"]
60 postgresql_user "gpximport" do
61 cluster node[:db][:cluster]
62 password passwords["gpximport"]
65 postgresql_user "munin" do
66 cluster node[:db][:cluster]
67 password passwords["munin"]
70 postgresql_user "replication" do
71 cluster node[:db][:cluster]
72 password passwords["replication"]
76 postgresql_database "openstreetmap" do
77 cluster node[:db][:cluster]
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 }
87 cookbook_file "/usr/local/share/monthly-reindex.sql" do
93 systemd_service "monthly-reindex" do
94 description "Monthly database reindex"
95 exec_start "/usr/bin/psql -f /usr/local/share/monthly-reindex.sql openstreetmap"
98 restrict_address_families "AF_UNIX"
101 systemd_timer "monthly-reindex" do
102 description "Monthly database reindex"
103 on_calendar "Sun *-*-1..7 02:00"
106 service "monthly-reindex.timer" do
107 action [:enable, :start]