From: Tom Hughes Date: Tue, 13 Jun 2023 19:53:26 +0000 (+0100) Subject: Drop promscale support X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/989be49b3854b167a6ccb8531d1b24ff73e9c3c8 Drop promscale support --- diff --git a/.kitchen.yml b/.kitchen.yml index 2b5b581f8..a79c15829 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -324,9 +324,6 @@ suites: - name: prometheus-server run_list: - recipe[prometheus::server] - attributes: - prometheus: - promscale: true - name: python run_list: - recipe[python::default] @@ -379,9 +376,6 @@ suites: - name: tilelog run_list: - recipe[tilelog::default] - - name: timescaledb - run_list: - - recipe[timescaledb::default] - name: tools run_list: - recipe[tools::default] diff --git a/cookbooks/apt/recipes/timescaledb.rb b/cookbooks/apt/recipes/timescaledb.rb deleted file mode 100644 index 5fc56c2d2..000000000 --- a/cookbooks/apt/recipes/timescaledb.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook:: apt -# Recipe:: timescaledb -# -# Copyright:: 2022, Tom Hughes -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe "apt" -include_recipe "apt::postgresql" - -platform_name = if platform?("debian") - "debian" - else - "ubuntu" - end - -apt_repository "timescaledb" do - uri "https://packagecloud.io/timescale/timescaledb/#{platform_name}" - components ["main"] - key "https://packagecloud.io/timescale/timescaledb/gpgkey" -end diff --git a/cookbooks/prometheus/attributes/default.rb b/cookbooks/prometheus/attributes/default.rb index a104883e7..7ea8bfd1d 100644 --- a/cookbooks/prometheus/attributes/default.rb +++ b/cookbooks/prometheus/attributes/default.rb @@ -3,4 +3,3 @@ default[:prometheus][:exporters] = {} default[:prometheus][:snmp] = {} default[:prometheus][:metrics] = {} default[:prometheus][:files] = [] -default[:prometheus][:promscale] = true diff --git a/cookbooks/prometheus/metadata.rb b/cookbooks/prometheus/metadata.rb index 0d635560a..f79ad0bcb 100644 --- a/cookbooks/prometheus/metadata.rb +++ b/cookbooks/prometheus/metadata.rb @@ -11,4 +11,3 @@ depends "apt" depends "git" depends "hardware" depends "networking" -depends "timescaledb" diff --git a/cookbooks/prometheus/recipes/server.rb b/cookbooks/prometheus/recipes/server.rb index 1c4f8e2d2..28f757672 100644 --- a/cookbooks/prometheus/recipes/server.rb +++ b/cookbooks/prometheus/recipes/server.rb @@ -19,9 +19,7 @@ include_recipe "apache" include_recipe "apt::grafana" -include_recipe "apt::timescaledb" include_recipe "networking" -include_recipe "timescaledb" passwords = data_bag_item("prometheus", "passwords") tokens = data_bag_item("prometheus", "tokens") @@ -111,78 +109,6 @@ archive_file "#{cache_dir}/karma-linux-amd64.tar.gz" do subscribes :extract, "remote_file[#{cache_dir}/karma-linux-amd64.tar.gz]", :immediately end -promscale_version = "0.17.0" -promscale_extension_version = "0.8.0-1" - -database_version = node[:timescaledb][:database_version] -database_cluster = "#{database_version}/main" - -package %W[ - prometheus - promscale-extension-postgresql-#{database_version} -] - -package "promscale-extension-postgresql-#{database_version}" do - version promscale_extension_version -end - -apt_preference "promscale-extension-postgresql" do - pin "version #{promscale_extension_version}" - pin_priority "1100" -end - -postgresql_user "prometheus" do - cluster database_cluster - superuser true -end - -postgresql_database "promscale" do - cluster database_cluster - owner "prometheus" -end - -directory "/opt/promscale" do - owner "root" - group "root" - mode "755" -end - -directory "/opt/promscale/bin" do - owner "root" - group "root" - mode "755" -end - -remote_file "/opt/promscale/bin/promscale" do - action :create - source "https://github.com/timescale/promscale/releases/download/#{promscale_version}/promscale_#{promscale_version}_Linux_x86_64" - owner "root" - group "root" - mode "755" -end - -systemd_service "promscale" do - description "Promscale Connector" - type "simple" - user "prometheus" - exec_start "/opt/promscale/bin/promscale --db.uri postgresql:///promscale?host=/run/postgresql&port=5432 --db.connections-max 400" - limit_nofile 16384 - sandbox :enable_network => true - restrict_address_families "AF_UNIX" -end - -if node[:prometheus][:promscale] - service "promscale" do - action [:enable, :start] - subscribes :restart, "remote_file[/opt/promscale/bin/promscale]" - subscribes :restart, "systemd_service[promscale]" - end -else - service "promscale" do - action [:disable, :stop] - end -end - search(:node, "roles:gateway") do |gateway| allowed_ips = gateway.ipaddresses(:role => :internal).map(&:subnet) diff --git a/cookbooks/prometheus/templates/default/prometheus.yml.erb b/cookbooks/prometheus/templates/default/prometheus.yml.erb index a4de98491..9c163f265 100644 --- a/cookbooks/prometheus/templates/default/prometheus.yml.erb +++ b/cookbooks/prometheus/templates/default/prometheus.yml.erb @@ -27,10 +27,6 @@ scrape_configs: static_configs: - targets: - localhost:9093 - - job_name: promscale - static_configs: - - targets: - - localhost:9201 - job_name: ssl scrape_interval: 15m metrics_path: /probe @@ -115,6 +111,3 @@ scrape_configs: - source_labels: [__address__] regex: "[^/]+/[^/]+/(.*)" target_label: __address__ - -remote_read: - - url: "http://localhost:9201/read" diff --git a/cookbooks/timescaledb/README.md b/cookbooks/timescaledb/README.md deleted file mode 100644 index f37c32eca..000000000 --- a/cookbooks/timescaledb/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# TimescaleDB Cookbook - -This cookbook configures TimescaleDB. diff --git a/cookbooks/timescaledb/attributes/default.rb b/cookbooks/timescaledb/attributes/default.rb deleted file mode 100644 index e39bd0507..000000000 --- a/cookbooks/timescaledb/attributes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -default[:timescaledb][:database_version] = "15" -default[:timescaledb][:max_background_workers] = 8 diff --git a/cookbooks/timescaledb/metadata.rb b/cookbooks/timescaledb/metadata.rb deleted file mode 100644 index 9b8821a80..000000000 --- a/cookbooks/timescaledb/metadata.rb +++ /dev/null @@ -1,11 +0,0 @@ -name "timescaledb" -maintainer "OpenStreetMap Administrators" -maintainer_email "admins@openstreetmap.org" -license "Apache-2.0" -description "Installs and configures timescaledb" - -version "1.0.0" -supports "ubuntu" -depends "apache" -depends "apt" -depends "postgresql" diff --git a/cookbooks/timescaledb/recipes/default.rb b/cookbooks/timescaledb/recipes/default.rb deleted file mode 100644 index 05085d948..000000000 --- a/cookbooks/timescaledb/recipes/default.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Cookbook:: timescaledb -# Recipe:: default -# -# Copyright:: 2021, OpenStreetMap Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe "apt::timescaledb" - -database_version = node[:timescaledb][:database_version] - -package %W[ - timescaledb-tools - 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" diff --git a/test/integration/prometheus-server/serverspec/promscale_spec.rb b/test/integration/prometheus-server/serverspec/promscale_spec.rb deleted file mode 100644 index aaedf15f6..000000000 --- a/test/integration/prometheus-server/serverspec/promscale_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require "serverspec" - -# Required by serverspec -set :backend, :exec - -describe service("promscale") do - it { should be_enabled } - it { should be_running } -end - -describe port(9201) do - it { should be_listening.with("tcp6") } -end