From 6f9cd7e4af1dae7a731b33e056afe678b683eb6f Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 2 Sep 2024 21:15:23 -0500 Subject: [PATCH] r/postgres-exporter: Do not connect to tempate1 DB It turns out, having the exporter connect to the _template1_ database is not a great idea. PostgreSQL does not allow creating a new database if the template database is currently being accessed by any clients. Since _template1_ is the default choice, the `createdb` command will probably fail. It doesn't specifically matter which database the exporter connects to, since it reads most (all?) of its data from the PostgreSQL catalog, which isn't database-specific. --- .../postgres-exporter/templates/postgres-exporter.container.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/postgres-exporter/templates/postgres-exporter.container.j2 b/roles/postgres-exporter/templates/postgres-exporter.container.j2 index 0a0a681..d106bd9 100644 --- a/roles/postgres-exporter/templates/postgres-exporter.container.j2 +++ b/roles/postgres-exporter/templates/postgres-exporter.container.j2 @@ -6,7 +6,7 @@ After=postgresql.service [Container] Image=quay.io/prometheuscommunity/postgres-exporter:v0.15.0 -Environment=DATA_SOURCE_URI='postgres-exporter@:5432/template1?host=/run/postgresql' +Environment=DATA_SOURCE_URI='postgres-exporter@:5432/postgres?host=/run/postgresql' Mount=type=bind,source=/run/postgresql,target=/run/postgresql # container_t cannot access the PostgreSQL socket postgresql_var_run_t SecurityLabelDisable=true