include_recipe "apt"
-package %w[
+database_version = node[:timescaledb][:database_version]
+
+package %W[
timescaledb-tools
- timescaledb-2-postgresql-12
+ timescaledb-2-postgresql-#{database_version}
]
+node.default_unless[:postgresql][:versions] = []
+node.default[:postgresql][:versions] |= [database_version]
+node.default[:postgresql][:monitor_tables] = false
+node.default_unless[:postgresql][:settings][database_version][:shared_preload_libraries] = []
+node.default[:postgresql][:settings][database_version][:shared_preload_libraries] |= ["timescaledb"]
+node.default_unless[:postgresql][:settings][database_version][:customized_options] = {}
+node.default[:postgresql][:settings][database_version][:customized_options]["timescaledb.max_background_workers"] = node[:timescaledb][:max_background_workers]
+
include_recipe "postgresql"