Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Add postgresql-client depenencies to monitoring.

Alex Vandiver5308fbdeacee
diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp
index 122dc8572c1..20176d82375 100644
--- a/puppet/zulip/manifests/app_frontend_base.pp
+++ b/puppet/zulip/manifests/app_frontend_base.pp
@@ -10,10 +10,8 @@ class zulip::app_frontend_base {
if $::os['family'] == 'Debian' {
# Upgrade and other tooling wants to be able to get a database
# shell. This is not necessary on CentOS because the PostgreSQL
- # package already includes the client. This may get us a more
- # recent client than the database server is configured to be,
- # ($zulip::postgresql_common::version), but they're compatible.
- zulip::safepackage { 'postgresql-client': ensure => installed }
+ # package already includes the client.
+ include zulip::postgresql_client
}
# For Slack import
zulip::safepackage { 'unzip': ensure => installed }
diff --git a/puppet/zulip/manifests/postgresql_client.pp b/puppet/zulip/manifests/postgresql_client.pp
new file mode 100644
index 00000000000..cffcde3c846
--- /dev/null
+++ b/puppet/zulip/manifests/postgresql_client.pp
@@ -0,0 +1,8 @@
+class zulip::postgresql_client {
+ # This may get us a more recent client than the database server is
+ # configured to be, ($zulip::postgresql_common::version), but
+ # they're compatible.
+ package { 'postgresql-client':
+ ensure => installed,
+ }
+}
diff --git a/puppet/zulip_ops/manifests/prometheus/postgresql.pp b/puppet/zulip_ops/manifests/prometheus/postgresql.pp
index e41b4a7e105..09e0ca4c0c0 100644
--- a/puppet/zulip_ops/manifests/prometheus/postgresql.pp
+++ b/puppet/zulip_ops/manifests/prometheus/postgresql.pp
@@ -47,9 +47,11 @@ class zulip_ops::prometheus::postgresql {
require => Exec['compile postgres_exporter'],
}
+ include zulip::postgresql_client
exec { 'create prometheus postgres user':
+ require => Package['postgresql-client'],
command => '/usr/bin/createuser -g pg_monitor prometheus',
- unless => '/usr/bin/psql -tAc "select usename from pg_user" | /bin/grep -xq prometheus',
+ unless => 'test -f /usr/bin/psql && /usr/bin/psql -tAc "select usename from pg_user" | /bin/grep -xq prometheus',
user => 'postgres',
}