diff --git a/.gitignore b/.gitignore index e6ae827a2..84a684659 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ /.metrics.*.removed /tools/src /vendor +.env diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..5e894040c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: "3.5" + +services: + postgres_exporter: + build: + context: . + dockerfile: Dockerfile + image: quay.io/prometheuscommunity/postgres-exporter + network_mode: host + environment: + DATA_SOURCE_NAME: "postgresql://${PG_USERNAME:-postgres}:${PG_PASSWORD:-password}@${PG_HOST:-localhost}:${PG_PORT:-5432}/${DB_NAME:-postgres}?sslmode=disable" + PG_EXPORTER_WEB_LISTEN_ADDRESS: ":9187" diff --git a/env.example b/env.example new file mode 100644 index 000000000..d8a308cf0 --- /dev/null +++ b/env.example @@ -0,0 +1,6 @@ +# The database for which the Prometheus metrics must be exported +PG_USERNAME=postgres +PG_PASSWORD=password +PG_HOST=localhost +PG_PORT=5432 +DB_NAME=postgres