]> git.openstreetmap.org Git - chef.git/blob - roles/nominatim.rb
ac76db74465acce5e16fac01a89f0afd671c5e6d
[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       :min_spare_threads => 125,
25       :max_spare_threads => 925
26     }
27   },
28   :apt => {
29     :sources => ["postgresql"]
30   },
31   :postgresql => {
32     :settings => {
33       :defaults => {
34         :max_connections => "450",
35         :synchronous_commit => "off",
36         :checkpoint_segments => "32",
37         :checkpoint_timeout => "10min",
38         :checkpoint_completion_target => "0.9",
39         :shared_buffers => "2GB",
40         :autovacuum_max_workers => "1"
41       }
42     }
43   },
44   :sysctl => {
45     :postgres => {
46       :comment => "Increase shared memory for postgres",
47       :parameters => {
48         "kernel.shmmax" => 26 * 1024 * 1024 * 1024,
49         "kernel.shmall" => 26 * 1024 * 1024 * 1024 / 4096
50       }
51     },
52     :kernel_scheduler_tune => {
53       :comment => "Tune kernel scheduler preempt",
54       :parameters => {
55         "kernel.sched_min_granularity_ns" => 10000000,
56         "kernel.sched_wakeup_granularity_ns" => 15000000
57       }
58     },
59     :swappiness => {
60       :comment => "Reduce swap usage",
61       :parameters => {
62         "vm.swappiness" => 10
63       }
64     },
65     :network_conntrack_time_wait => {
66       :comment => "Only track completed connections for 30 seconds",
67       :parameters => {
68         "net.netfilter.nf_conntrack_tcp_timeout_time_wait" => "30"
69       }
70     },
71     :network_conntrack_max => {
72       :comment => "Increase max number of connections tracked",
73       :parameters => {
74         "net.netfilter.nf_conntrack_max" => "131072"
75       }
76     }
77   }
78 )
79
80 run_list(
81   "recipe[nominatim::default]"
82 )