]> git.openstreetmap.org Git - chef.git/blob - roles/nominatim.rb
nominatim: apply rate limit
[chef.git] / roles / nominatim.rb
1 name "nominatim"
2 description "Role applied to all nominatim servers."
3
4 default_attributes(
5   :accounts => {
6     :users => {
7       :lonvia => { :status => :administrator },
8       :twain => { :status => :administrator },
9       :nominatim => {
10         :status => :role,
11         :members => [:lonvia, :tomh, :twain]
12       }
13     }
14   },
15   :apache => {
16     :mpm => "event",
17     :timeout => 60,
18     :keepalive => false,
19     :reqtimeout => true,
20     :event => {
21       :server_limit => 32,
22       :max_request_workers => 1600,
23       :threads_per_child => 50
24     }
25   },
26   :apt => {
27     :sources => ["postgresql"]
28   },
29   :networking => {
30     :firewall => {
31       :http_rate_limit => "s:7/sec:15"
32     }
33   },
34   :postgresql => {
35     :settings => {
36       :defaults => {
37         :max_connections => "450",
38         :synchronous_commit => "off",
39         :checkpoint_segments => "32",
40         :checkpoint_timeout => "10min",
41         :checkpoint_completion_target => "0.9",
42         :shared_buffers => "2GB",
43         :autovacuum_max_workers => "1"
44       }
45     }
46   },
47   :sysctl => {
48     :postgres => {
49       :comment => "Increase shared memory for postgres",
50       :parameters => {
51         "kernel.shmmax" => 26 * 1024 * 1024 * 1024,
52         "kernel.shmall" => 26 * 1024 * 1024 * 1024 / 4096
53       }
54     },
55     :kernel_scheduler_tune => {
56       :comment => "Tune kernel scheduler preempt",
57       :parameters => {
58         "kernel.sched_min_granularity_ns" => 10000000,
59         "kernel.sched_wakeup_granularity_ns" => 15000000
60       }
61     },
62     :swappiness => {
63       :comment => "Reduce swap usage",
64       :parameters => {
65         "vm.swappiness" => 10
66       }
67     },
68     :network_conntrack_time_wait => {
69       :comment => "Only track completed connections for 30 seconds",
70       :parameters => {
71         "net.netfilter.nf_conntrack_tcp_timeout_time_wait" => "30"
72       }
73     },
74     :network_conntrack_max => {
75       :comment => "Increase max number of connections tracked",
76       :parameters => {
77         "net.netfilter.nf_conntrack_max" => "131072"
78       }
79     }
80   }
81 )
82
83 run_list(
84   "recipe[nominatim::default]"
85 )