]> git.openstreetmap.org Git - chef.git/blob - roles/db.rb
05cd66aa946ac426fddf39299028976b8ce77b07
[chef.git] / roles / db.rb
1 name "db"
2 description "Role applied to all database servers"
3
4 default_attributes(
5   :accounts => {
6     :users => {
7       :rails => {
8         :status => :role,
9         :members => [:tomh, :grant]
10       }
11     }
12   },
13   :apt => {
14     :unattended_upgrades => {
15       :enable => false
16     }
17   },
18   :munin => {
19     :plugins => {
20       :postgres_connections_openstreetmap => {
21         :waiting => {
22           :warning => 10,
23           :critical => 20
24         }
25       },
26       :postgres_locks_openstreetmap => {
27         :accesssharelock => {
28           :warning => 900,
29           :critical => 1000
30         },
31         :rowexclusivelock => {
32           :warning => 250,
33           :critical => 300
34         }
35       }
36     }
37   },
38   :postgresql => {
39     :settings => {
40       :defaults => {
41         :listen_addresses => "*",
42         :max_connections => "1500",
43         :max_stack_depth => "7MB",
44         :wal_level => "logical",
45         :max_wal_size => "1536MB",
46         :checkpoint_completion_target => "0.8",
47         :cpu_tuple_cost => "0.1",
48         :jit => "off",
49         :log_min_duration_statement => "1000",
50         :late_authentication_rules => [
51           { :address => "10.0.48.0/20" }, # amsterdam
52           { :address => "10.0.64.0/20" }, # dublin
53           { :database => "replication", :user => "replication", :address => "10.0.0.4/32" },   # snap-02
54           { :database => "replication", :user => "replication", :address => "10.0.0.10/32" },  # eddie
55           { :database => "replication", :user => "replication", :address => "10.0.48.49/32" }, # snap-01
56           { :database => "replication", :user => "replication", :address => "10.0.48.50/32" }, # karm
57           { :database => "replication", :user => "replication", :address => "10.0.64.50/32" }  # snap-03
58         ]
59       }
60     }
61   },
62   :sysctl => {
63     :swappiness => {
64       :comment => "Only swap in an emergency",
65       :parameters => {
66         "vm.swappiness" => 0
67       }
68     }
69   }
70 )