feat: migrate pupeptdb sql to patroni (#318)

- change puppetdb::sql to using the patroni profile
- change puppetdb::api to use new patroni cluster
- remove references to puppetlabs-puppetdb managed database
- update consul rules to enable sessions

Reviewed-on: https://git.query.consul/unkinben/puppet-prod/pulls/318
This commit was merged in pull request #318.
This commit is contained in:
2025-06-19 05:52:32 +10:00
parent 26b908e5e7
commit cb1d562cb0
9 changed files with 100 additions and 53 deletions
+47 -22
View File
@@ -1,36 +1,61 @@
---
hiera_include:
- profiles::sql::patroni
profiles::packages::include:
python3-devel: {}
libpq5-devel: {}
postgresql-devel: {}
postgresql_config_entries:
max_connections: 300
shared_buffers: '256MB'
consul::services:
puppetdbsql:
service_name: 'puppetdbsql'
tags:
- 'puppet'
- 'puppetdb'
- 'database'
address: "%{facts.networking.ip}"
port: 5432
checks:
- id: 'psql-check'
name: 'PostgreSQL Health Check'
args:
- '/usr/local/bin/check_consul_postgresql'
interval: '10s'
timeout: '1s'
profiles::sql::patroni::cluster_name: "patroni-puppetdb-%{facts.environment}"
profiles::sql::patroni::postgres_exporter_enabled: true
profiles::sql::patroni::postgres_exporter_user: postgres_exporter
profiles::sql::patroni::pgsql_version: "17"
# FIXME: puppet-python wants to try manage python-dev, which is required by the ceph package
python::manage_dev_package: false
#consul::services:
# "%{hiera('profiles::sql::patroni::cluster_name')}":
# service_name: "%{hiera('profiles::sql::patroni::cluster_name')}"
# tags:
# - 'puppet'
# - 'puppetdb'
# - 'database'
# address: "%{facts.networking.ip}"
# port: 5432
# checks:
# - id: 'psql-check'
# name: 'PostgreSQL Health Check'
# args:
# - '/usr/local/bin/check_consul_postgresql'
# interval: '10s'
# timeout: '1s'
profiles::consul::client::node_rules:
- resource: service
segment: puppetdbsql
segment: "%{hiera('profiles::sql::patroni::cluster_name')}"
disposition: write
- resource: service_prefix
segment: "%{hiera('profiles::sql::patroni::cluster_name')}"
disposition: write
- resource: key_prefix
segment: "service/%{hiera('profiles::sql::patroni::cluster_name')}"
disposition: write
- resource: session_prefix
segment: ""
disposition: write
profiles::yum::global::repos:
postgresql-15:
name: postgresql-15
descr: postgresql-15 repository
postgresql-17:
name: postgresql-17
descr: postgresql-17 repository
target: /etc/yum.repos.d/postgresql.repo
baseurl: https://packagerepo.service.consul/postgresql/rhel%{facts.os.release.major}/15-daily/%{facts.os.architecture}/os
gpgkey: https://packagerepo.service.consul/postgresql/rhel%{facts.os.release.major}/15-daily/%{facts.os.architecture}/os/PGDG-RPM-GPG-KEY-RHEL
baseurl: https://packagerepo.service.consul/postgresql/rhel%{facts.os.release.major}/17-daily/%{facts.os.architecture}/os
gpgkey: https://packagerepo.service.consul/postgresql/rhel%{facts.os.release.major}/17-daily/%{facts.os.architecture}/os/PGDG-RPM-GPG-KEY-RHEL
postgresql-common:
name: postgresql-common
descr: postgresql-common repository