diff --git a/ai-horde/postgres/Dockerfile b/ai-horde/postgres/Dockerfile index 2dc5a8a..b6b0d94 100644 --- a/ai-horde/postgres/Dockerfile +++ b/ai-horde/postgres/Dockerfile @@ -31,4 +31,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Add pg_cron extension to the database RUN echo "shared_preload_libraries = 'pg_cron'" >> /usr/share/postgresql/postgresql.conf.sample -CMD ["postgres"] +COPY ./horde_init.sh /docker-entrypoint-initdb.d/horde_init.sh diff --git a/ai-horde/postgres/horde_init.sh b/ai-horde/postgres/horde_init.sh new file mode 100644 index 0000000..5716d61 --- /dev/null +++ b/ai-horde/postgres/horde_init.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Set postgres 15's config option `listen_addresses = '*'` if the environment variable "POSTGRES_LISTEN_ALL" is set + +if [ -z "$POSTGRES_LISTEN_ALL" ]; then + echo "POSTGRES_LISTEN_ALL is not set. Skipping..." + exit 0 +fi + +echo "Setting listen_addresses = '*' in /etc/postgresql/15/main/postgresql.conf" +sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/15/main/postgresql.conf