]> git.openstreetmap.org Git - chef.git/blob - cookbooks/timescaledb/attributes/default.rb
Work around cookbook dependency issues
[chef.git] / cookbooks / timescaledb / attributes / default.rb
1 default[:timescaledb][:cluster] = "12/main"
2 default[:timescaledb][:max_background_workers] = 8
3
4 database_version = node[:timescaledb][:cluster].split("/").first
5
6 default[:apt][:sources] |= ["timescaledb"]
7
8 memory_gb = (node[:memory][:total].to_f / 1024 / 1024).ceil
9
10 default_unless[:postgresql][:versions] = []
11 default[:postgresql][:versions] |= [database_version]
12 default[:postgresql][:settings][database_version][:max_connections] = 500
13 default[:postgresql][:settings][database_version][:shared_buffers] = "#{memory_gb / 4}GB"
14 default[:postgresql][:settings][database_version][:work_mem] = "#{memory_gb * 128 / 50 / node[:cpu][:total]}MB"
15 default[:postgresql][:settings][database_version][:maintenance_work_mem] = "2GB"
16 default[:postgresql][:settings][database_version][:effective_io_concurrency] = "200"
17 default[:postgresql][:settings][database_version][:max_worker_processes] = node[:cpu][:total] + node[:timescaledb][:max_background_workers] + 3
18 default[:postgresql][:settings][database_version][:max_parallel_workers_per_gather] = node[:cpu][:total] / 2
19 default[:postgresql][:settings][database_version][:max_parallel_workers] = node[:cpu][:total]
20 default[:postgresql][:settings][database_version][:wal_buffers] = "16MB"
21 default[:postgresql][:settings][database_version][:max_wal_size] = "1GB"
22 default[:postgresql][:settings][database_version][:min_wal_size] = "512MB"
23 default[:postgresql][:settings][database_version][:checkpoint_completion_target] = "0.9"
24 default[:postgresql][:settings][database_version][:random_page_cost] = "1.1"
25 default[:postgresql][:settings][database_version][:effective_cache_size] = "#{memory_gb * 3 / 4}GB"
26 default[:postgresql][:settings][database_version][:default_statistics_target] = "500"
27 default[:postgresql][:settings][database_version][:autovacuum_max_workers] = "10"
28 default[:postgresql][:settings][database_version][:autovacuum_naptime] = "10"
29 default_unless[:postgresql][:settings][database_version][:shared_preload_libraries] = []
30 default[:postgresql][:settings][database_version][:shared_preload_libraries] |= ["timescaledb"]
31 default[:postgresql][:settings][database_version][:max_locks_per_transaction] = "512"
32 default_unless[:postgresql][:settings][database_version][:customized_options] = {}
33 default[:postgresql][:settings][database_version][:customized_options]["timescaledb.max_background_workers"] = node[:timescaledb][:max_background_workers]