From 3a31a30fc796d13763d39ed2b22a33652c3c016e Mon Sep 17 00:00:00 2001 From: Mirko Milovanovic Date: Thu, 6 Feb 2025 22:40:23 +0100 Subject: [PATCH] feat: add health checks and restart policies in docker-compose, update Telegraf configuration --- docker-compose.yml | 17 ++++++++++++----- telegraf.conf | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a779af8..6e81558 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,22 +22,29 @@ services: - DATABASE=${TELEGRAF_MONGODB_DATABASE:?"Database name is required"} - DSN=${TELEGRAF_MONGODB_DSN:?"DSN is required"} - HOSTNAME=${TELEGRAF_HOSTNAME:?"Hostname is required"} + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080"] + interval: 5s + timeout: 10s + retries: 5 + restart: unless-stopped networks: - backend collector: container_name: collector - #image: gitea.kobim.cloud/kobim/peertube-collector - build: - context: . - dockerfile: Dockerfile + image: gitea.kobim.cloud/kobim/peertube-collector + #build: + #context: . + #dockerfile: Dockerfile depends_on: selenium: condition: service_healthy telegraf: - condition: service_started + condition: service_healthy environment: - VIDEO_URL=${VIDEO_URL:?"Video URL is required"} + restart: unless-stopped ports: - "9092:9092" extra_hosts: diff --git a/telegraf.conf b/telegraf.conf index f8a3a6e..15d282d 100644 --- a/telegraf.conf +++ b/telegraf.conf @@ -25,6 +25,9 @@ player = "player" peers = "peers" +[[outputs.health]] + service_address = "http://:8080" + [[outputs.file]] files = ["stdout"] data_format = "json"