build(compose.yaml): fix postgres service files

This commit is contained in:
Sarah Vaupel 2025-03-28 17:41:02 +01:00
parent e38e22a064
commit 6c3e7a302d
5 changed files with 24 additions and 4 deletions

View File

@ -61,10 +61,10 @@ services:
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
- ./docker/postgres/pg_hba.conf:/tmp/pg_hba.conf:ro
- ./docker/postgres/postgresql.conf:/tmp/postgresql.conf:ro
- ./docker/postgres/pgconfig.sh:/docker-entrypoint-initdb.d/_pgconfig.sh:ro
- ./docker/postgres/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
- ./postgres/pg_hba.conf:/tmp/pg_hba.conf:ro
- .postgres/postgresql.conf:/tmp/postgresql.conf:ro
- .postgres/pgconfig.sh:/docker-entrypoint-initdb.d/_pgconfig.sh:ro
- .postgres/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
memcached:
image: docker.io/library/memcached:latest

3
postgres/pg_hba.conf Normal file
View File

@ -0,0 +1,3 @@
local all all trust
host all all 0.0.0.0/0 trust
host all all ::1/128 trust

6
postgres/pgconfig.sh Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
cat /tmp/pg_hba.conf > /var/lib/postgresql/data/pg_hba.conf
cat /tmp/postgresql.conf > /var/lib/postgresql/data/postgresql.conf
echo "Custom pg_hba.conf and postgresql.conf successfully deployed."

6
postgres/postgresql.conf Normal file
View File

@ -0,0 +1,6 @@
listen_addresses='*'
unix_socket_permissions=0700
max_connections=9990
shared_preload_libraries=pg_stat_statements
session_preload_libraries=auto_explain
auto_explain.log_min_duration=100ms

5
postgres/schema.sql Normal file
View File

@ -0,0 +1,5 @@
CREATE USER uniworx WITH SUPERUSER PASSWORD 'uniworx';
CREATE DATABASE uniworx_test;
GRANT ALL ON DATABASE uniworx_test TO uniworx;
CREATE DATABASE uniworx;
GRANT ALL ON DATABASE uniworx TO uniworx;