From f97f968caa65103029b10940d29de2c6c98d3339 Mon Sep 17 00:00:00 2001 From: Mohan K Date: Tue, 11 Aug 2026 12:52:33 +0530 Subject: [PATCH] Add db_fixer to correct pg_hba.conf --- docker-compose.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index f130d08..5ebfc16 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -11,15 +11,15 @@ services: volumes: - ./db:/docker-entrypoint-initdb.d - pgdata:/var/lib/postgresql/data + + db_fixer: + image: alpine + restart: "no" + volumes: + - pgdata:/var/lib/postgresql/data command: > - bash -c " - if [ -f /var/lib/postgresql/data/pg_hba.conf ]; then - sed -i 's/hostssl/host/g' /var/lib/postgresql/data/pg_hba.conf - echo 'host all all all md5' >> /var/lib/postgresql/data/pg_hba.conf - echo 'host all all all scram-sha-256' >> /var/lib/postgresql/data/pg_hba.conf - fi - exec docker-entrypoint.sh postgres - " + sh -c "sed -i 's/hostssl/host/g' /var/lib/postgresql/data/pg_hba.conf || true; sed -i 's/hostnossl/host/g' /var/lib/postgresql/data/pg_hba.conf || true; echo 'host all all all scram-sha-256' >> /var/lib/postgresql/data/pg_hba.conf; echo 'host all all all md5' >> /var/lib/postgresql/data/pg_hba.conf" + api: build: ./api