From dafd5476569c288443320bfe344f668e54bdcd43 Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Fri, 10 Sep 2021 19:21:43 -0400 Subject: [PATCH] Add example for using Postgres --- README.md | 1 + .../config.yaml | 42 +++++++++++++++++++ .../docker-compose.yml | 27 ++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 examples/docker-compose-postgres-storage/config.yaml create mode 100644 examples/docker-compose-postgres-storage/docker-compose.yml diff --git a/README.md b/README.md index 1d55dce1..a04a88c3 100644 --- a/README.md +++ b/README.md @@ -249,6 +249,7 @@ storage: type: postgres file: "postgres://user:password@127.0.0.1:5432/gatus?sslmode=disable" ``` +See [examples/docker-compose-postgres-storage](examples/docker-compose-postgres-storage) for an example. ### Client configuration diff --git a/examples/docker-compose-postgres-storage/config.yaml b/examples/docker-compose-postgres-storage/config.yaml new file mode 100644 index 00000000..b4489e01 --- /dev/null +++ b/examples/docker-compose-postgres-storage/config.yaml @@ -0,0 +1,42 @@ +storage: + type: postgres + file: "postgres://username:password@postgres:5432/gatus?sslmode=disable" + +services: + - name: back-end + group: core + url: "https://example.org/" + interval: 5m + conditions: + - "[STATUS] == 200" + - "[CERTIFICATE_EXPIRATION] > 48h" + + - name: monitoring + group: internal + url: "https://example.org/" + interval: 5m + conditions: + - "[STATUS] == 200" + + - name: nas + group: internal + url: "https://example.org/" + interval: 5m + conditions: + - "[STATUS] == 200" + + - name: example-dns-query + url: "8.8.8.8" # Address of the DNS server to use + interval: 5m + dns: + query-name: "example.com" + query-type: "A" + conditions: + - "[BODY] == 93.184.216.34" + - "[DNS_RCODE] == NOERROR" + + - name: icmp-ping + url: "icmp://example.org" + interval: 1m + conditions: + - "[CONNECTED] == true" diff --git a/examples/docker-compose-postgres-storage/docker-compose.yml b/examples/docker-compose-postgres-storage/docker-compose.yml new file mode 100644 index 00000000..2fa775ae --- /dev/null +++ b/examples/docker-compose-postgres-storage/docker-compose.yml @@ -0,0 +1,27 @@ +version: "3.9" +services: + postgres: + image: postgres + volumes: + - ./data/db:/var/lib/postgresql/data + environment: + - POSTGRES_DB=gatus + - POSTGRES_USER=username + - POSTGRES_PASSWORD=password + networks: + - web + + gatus: + image: twinproduction/gatus:latest + restart: always + ports: + - 8080:8080 + volumes: + - ./config.yaml:/config/config.yaml + networks: + - web + depends_on: + - postgres + +networks: + web: \ No newline at end of file