From 6c3e7a302dd1ce35d24571806fbee011866f1740 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Fri, 28 Mar 2025 17:41:02 +0100 Subject: [PATCH] build(compose.yaml): fix postgres service files --- compose.yaml | 8 ++++---- postgres/pg_hba.conf | 3 +++ postgres/pgconfig.sh | 6 ++++++ postgres/postgresql.conf | 6 ++++++ postgres/schema.sql | 5 +++++ 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 postgres/pg_hba.conf create mode 100644 postgres/pgconfig.sh create mode 100644 postgres/postgresql.conf create mode 100644 postgres/schema.sql diff --git a/compose.yaml b/compose.yaml index 3fda3e466..88a15cdb5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -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 diff --git a/postgres/pg_hba.conf b/postgres/pg_hba.conf new file mode 100644 index 000000000..b826e433d --- /dev/null +++ b/postgres/pg_hba.conf @@ -0,0 +1,3 @@ +local all all trust +host all all 0.0.0.0/0 trust +host all all ::1/128 trust \ No newline at end of file diff --git a/postgres/pgconfig.sh b/postgres/pgconfig.sh new file mode 100644 index 000000000..fbed96fe0 --- /dev/null +++ b/postgres/pgconfig.sh @@ -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." \ No newline at end of file diff --git a/postgres/postgresql.conf b/postgres/postgresql.conf new file mode 100644 index 000000000..a2f917845 --- /dev/null +++ b/postgres/postgresql.conf @@ -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 \ No newline at end of file diff --git a/postgres/schema.sql b/postgres/schema.sql new file mode 100644 index 000000000..9eb024aca --- /dev/null +++ b/postgres/schema.sql @@ -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; \ No newline at end of file