]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/prometheus/recipes/server.rb
Make sure we use the correct gem and bundler for blogs
[chef.git] / cookbooks / prometheus / recipes / server.rb
index 7e4f4b2bf9ee83a05c866901bad9f07df45cbf3a..b4a4c36da45428f2f237a8b10de2f2ff1750eee6 100644 (file)
@@ -39,7 +39,7 @@ package %w[
 
 promscale_version = "0.1.4"
 
-database_cluster = node[:timescaledb][:cluster]
+database_cluster = "#{node[:timescaledb][:database_version]}/main"
 
 postgresql_user "prometheus" do
   cluster database_cluster
@@ -144,8 +144,24 @@ systemd_timer "promscale-maintenance" do
   on_unit_inactive_sec 1800
 end
 
+service "promscale-maintenance.timer" do
+  action [:enable, :start]
+end
+
 jobs = {}
 
+search(:node, "roles:gateway") do |gateway|
+  allowed_ips = gateway.interfaces(:role => :internal).map do |interface|
+    "#{interface[:network]}/#{interface[:prefix]}"
+  end
+
+  node.default[:networking][:wireguard][:peers] << {
+    :public_key => gateway[:networking][:wireguard][:public_key],
+    :allowed_ips => allowed_ips,
+    :endpoint => "#{gateway.name}:51820"
+  }
+end
+
 search(:node, "recipes:prometheus\\:\\:default").sort_by(&:name).each do |client|
   if client[:prometheus][:mode] == "wireguard"
     node.default[:networking][:wireguard][:peers] << {