]> git.openstreetmap.org Git - chef.git/commitdiff
Run taginfo collector via bundler
authorTom Hughes <tom@compton.nu>
Sun, 23 Feb 2025 00:32:18 +0000 (00:32 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 23 Feb 2025 00:32:42 +0000 (00:32 +0000)
cookbooks/prometheus/resources/collector.rb
cookbooks/taginfo/recipes/default.rb

index ce68a7e5c5dcdd2a0a3038dd0f77ce9428949d07..4171b874d987c5496c96abea35a85b85cafc2409 100644 (file)
@@ -27,6 +27,7 @@ property :user, :kind_of => String
 property :path, :kind_of => String
 property :options, :kind_of => [String, Array]
 property :environment, :kind_of => Hash, :default => {}
+property :working_directory, String
 property :proc_subset, String
 property :capability_bounding_set, [String, Array]
 property :private_devices, [true, false]
@@ -42,6 +43,7 @@ action :create do
     dynamic_user new_resource.user.nil?
     group "adm"
     environment new_resource.environment
+    working_directory new_resource.working_directory
     standard_output "file:/var/lib/prometheus/node-exporter/#{new_resource.collector}.new"
     standard_error "journal"
     exec_start "#{executable_path} #{executable_options}"
index 729f92777b15265e98107b5f922f68e93b8817b7..ef3913c604cc76942d20f583b073a35dfa3b408e 100644 (file)
@@ -232,7 +232,8 @@ node[:taginfo][:sites].each do |site|
   prometheus_collector "taginfo-#{site_name}" do
     interval "15m"
     user "taginfo"
-    path "#{directory}/taginfo/sources/metrics.rb"
-    options "#{directory}/data"
+    path node[:ruby][:bundle]
+    options "exec sources/metrics.rb #{directory}/data"
+    working_directory "#{directory}/taginfo"
   end
 end