Add db_fixer to correct pg_hba.conf

This commit is contained in:
2026-08-11 12:52:33 +05:30
parent cdd8deeef5
commit f97f968caa
+8 -8
View File
@@ -11,15 +11,15 @@ services:
volumes: volumes:
- ./db:/docker-entrypoint-initdb.d - ./db:/docker-entrypoint-initdb.d
- pgdata:/var/lib/postgresql/data - pgdata:/var/lib/postgresql/data
db_fixer:
image: alpine
restart: "no"
volumes:
- pgdata:/var/lib/postgresql/data
command: > command: >
bash -c " 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"
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
"
api: api:
build: ./api build: ./api