From deec416abf8d26290a82b9cd50ef4516d539a915 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 5 Jan 2024 22:00:59 +0100 Subject: [PATCH] Optimized central databases --- roles/docker-mariadb/tasks/main.yml | 6 ++++++ roles/docker-postgres/tasks/main.yml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/roles/docker-mariadb/tasks/main.yml b/roles/docker-mariadb/tasks/main.yml index d43c4095..fc3112b0 100644 --- a/roles/docker-mariadb/tasks/main.yml +++ b/roles/docker-mariadb/tasks/main.yml @@ -24,6 +24,12 @@ published_ports: - "127.0.0.1:3306:3306" # can be that this will be removed if all applications use sockets command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud + restart_policy: unless-stopped + healthcheck: + test: "/usr/bin/mariadb --user=root --password={{central_mariadb_root_password}} --execute \"SHOW DATABASES;\"" + interval: 3s + timeout: 1s + retries: 5 when: run_once_docker_mariadb is not defined - name: install python-mysqlclient diff --git a/roles/docker-postgres/tasks/main.yml b/roles/docker-postgres/tasks/main.yml index 25cb9c75..5bd22ab1 100644 --- a/roles/docker-postgres/tasks/main.yml +++ b/roles/docker-postgres/tasks/main.yml @@ -18,6 +18,13 @@ - "127.0.0.1:5432:5432" volumes: - central_postgres_database:/var/lib/postgresql/data + restart_policy: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 30s when: run_once_docker_postgres is not defined - name: wait for availability of postgres