From f08e21098bb493f3e49935c364c9f5d33c4ca028 Mon Sep 17 00:00:00 2001 From: Douglas J Hunley Date: Wed, 3 Dec 2025 11:03:03 -0500 Subject: [PATCH 1/2] feat: Ensure postgres conf.d directory is set up Ensure the `/etc/postgresql-custom/conf.d` directory is correctly created and managed by the entrypoint script in Docker images for PostgreSQL 15, 17, and orioledb-17. This change adds logic to `docker-entrypoint.sh` to: - Create the `/etc/postgresql-custom/conf.d` directory if it does not exist. - Set the ownership to `postgres:postgres`. - Set the permissions to `0755`. This ensures that custom PostgreSQL configuration files placed in this directory are correctly recognized and loaded by the PostgreSQL server during container startup, improving configuration management and extension support. --- Dockerfile-15 | 7 ++++++- Dockerfile-17 | 5 +++++ Dockerfile-orioledb-17 | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Dockerfile-15 b/Dockerfile-15 index 62e0308df..41f51bf6a 100644 --- a/Dockerfile-15 +++ b/Dockerfile-15 @@ -209,7 +209,7 @@ COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf -COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/ +COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts @@ -241,6 +241,11 @@ ADD --chmod=0755 \ https://github.com/docker-library/postgres/raw/889f9447cd2dfe21cccfbe9bb7945e3b037e02d8/15/bullseye/docker-entrypoint.sh \ /usr/local/bin/docker-entrypoint.sh +RUN sed -i '/03775/a\\ +mkdir -p /etc/postgresql-custom/conf.d\ +chown postgres:postgres /etc/postgresql-custom/conf.d\ +chmod 0755 /etc/postgresql-custom/conf.d' /usr/local/bin/docker-entrypoint.sh + RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/Dockerfile-17 b/Dockerfile-17 index 6c2f1c6bf..307cfa8b2 100644 --- a/Dockerfile-17 +++ b/Dockerfile-17 @@ -253,6 +253,11 @@ ADD --chmod=0755 \ https://github.com/docker-library/postgres/raw/889f9447cd2dfe21cccfbe9bb7945e3b037e02d8/17/bullseye/docker-entrypoint.sh \ /usr/local/bin/docker-entrypoint.sh +RUN sed -i '/03775/a\\ +mkdir -p /etc/postgresql-custom/conf.d\ +chown postgres:postgres /etc/postgresql-custom/conf.d\ +chmod 0755 /etc/postgresql-custom/conf.d' /usr/local/bin/docker-entrypoint.sh + RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/Dockerfile-orioledb-17 b/Dockerfile-orioledb-17 index b242a8527..91487e4fd 100644 --- a/Dockerfile-orioledb-17 +++ b/Dockerfile-orioledb-17 @@ -264,6 +264,11 @@ ADD --chmod=0755 \ https://github.com/docker-library/postgres/raw/889f9447cd2dfe21cccfbe9bb7945e3b037e02d8/17/bullseye/docker-entrypoint.sh \ /usr/local/bin/docker-entrypoint.sh +RUN sed -i '/03775/a\\ +mkdir -p /etc/postgresql-custom/conf.d\ +chown postgres:postgres /etc/postgresql-custom/conf.d\ +chmod 0755 /etc/postgresql-custom/conf.d' /usr/local/bin/docker-entrypoint.sh + RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql ENTRYPOINT ["docker-entrypoint.sh"] From cdc330d7ce094f6cb99bedbc609039dd83465f01 Mon Sep 17 00:00:00 2001 From: Douglas J Hunley Date: Wed, 3 Dec 2025 16:26:40 -0500 Subject: [PATCH 2/2] build: Update Nix install command and Dockerfile configs - Replaced `nix profile install .#` with `nix profile add path:.#` for installing Nix packages, which is both the recommended command, and allows nix to work with git worktrees when inside Docker. - Ensured the `conf.d` directory for PostgreSQL configuration is correctly copied. - Removed redundant `mkdir` and `chown` commands from the `docker-entrypoint.sh` script, as these are now handled by the `COPY` instruction. --- Dockerfile-15 | 12 +++--------- Dockerfile-17 | 12 +++--------- Dockerfile-orioledb-17 | 12 +++--------- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/Dockerfile-15 b/Dockerfile-15 index 41f51bf6a..45c6741b0 100644 --- a/Dockerfile-15 +++ b/Dockerfile-15 @@ -113,7 +113,7 @@ COPY . /nixpg WORKDIR /nixpg -RUN nix profile install .#psql_15/bin +RUN nix profile add path:.#psql_15/bin RUN nix store gc @@ -167,7 +167,7 @@ FROM base as groonga WORKDIR /nixpg -RUN nix profile install .#supabase-groonga && \ +RUN nix profile add path:.#supabase-groonga && \ mkdir -p /tmp/groonga-plugins && \ cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/ @@ -209,7 +209,7 @@ COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf -COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom +COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/conf.d COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts @@ -227,7 +227,6 @@ RUN sed -i \ echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \ echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \ usermod -aG postgres wal-g && \ - mkdir -p /etc/postgresql-custom/conf.d && \ chown -R postgres:postgres /etc/postgresql-custom # # Include schema migrations @@ -241,11 +240,6 @@ ADD --chmod=0755 \ https://github.com/docker-library/postgres/raw/889f9447cd2dfe21cccfbe9bb7945e3b037e02d8/15/bullseye/docker-entrypoint.sh \ /usr/local/bin/docker-entrypoint.sh -RUN sed -i '/03775/a\\ -mkdir -p /etc/postgresql-custom/conf.d\ -chown postgres:postgres /etc/postgresql-custom/conf.d\ -chmod 0755 /etc/postgresql-custom/conf.d' /usr/local/bin/docker-entrypoint.sh - RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/Dockerfile-17 b/Dockerfile-17 index 307cfa8b2..bf8284b52 100644 --- a/Dockerfile-17 +++ b/Dockerfile-17 @@ -116,7 +116,7 @@ COPY . /nixpg WORKDIR /nixpg -RUN nix profile install .#psql_17/bin +RUN nix profile add path:.#psql_17/bin RUN nix store gc @@ -171,7 +171,7 @@ FROM base as groonga WORKDIR /nixpg -RUN nix profile install .#supabase-groonga && \ +RUN nix profile add path:.#supabase-groonga && \ mkdir -p /tmp/groonga-plugins && \ cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/ @@ -213,7 +213,7 @@ COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf -COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/ +COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/conf.d COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts @@ -231,7 +231,6 @@ RUN sed -i \ echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \ echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \ usermod -aG postgres wal-g && \ - mkdir -p /etc/postgresql-custom/conf.d && \ chown -R postgres:postgres /etc/postgresql-custom # Remove items from postgresql.conf @@ -253,11 +252,6 @@ ADD --chmod=0755 \ https://github.com/docker-library/postgres/raw/889f9447cd2dfe21cccfbe9bb7945e3b037e02d8/17/bullseye/docker-entrypoint.sh \ /usr/local/bin/docker-entrypoint.sh -RUN sed -i '/03775/a\\ -mkdir -p /etc/postgresql-custom/conf.d\ -chown postgres:postgres /etc/postgresql-custom/conf.d\ -chmod 0755 /etc/postgresql-custom/conf.d' /usr/local/bin/docker-entrypoint.sh - RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/Dockerfile-orioledb-17 b/Dockerfile-orioledb-17 index 91487e4fd..85a3d5a85 100644 --- a/Dockerfile-orioledb-17 +++ b/Dockerfile-orioledb-17 @@ -116,7 +116,7 @@ COPY . /nixpg WORKDIR /nixpg -RUN nix profile install .#psql_orioledb-17/bin +RUN nix profile add path:.#psql_orioledb-17/bin RUN nix store gc @@ -171,7 +171,7 @@ FROM base as groonga WORKDIR /nixpg -RUN nix profile install .#supabase-groonga && \ +RUN nix profile add path:.#supabase-groonga && \ mkdir -p /tmp/groonga-plugins && \ cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/ @@ -213,7 +213,7 @@ COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf -COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/ +COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/conf.d COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts @@ -231,7 +231,6 @@ RUN sed -i \ echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \ echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \ usermod -aG postgres wal-g && \ - mkdir -p /etc/postgresql-custom/conf.d && \ chown -R postgres:postgres /etc/postgresql-custom # Remove items from postgresql.conf @@ -264,11 +263,6 @@ ADD --chmod=0755 \ https://github.com/docker-library/postgres/raw/889f9447cd2dfe21cccfbe9bb7945e3b037e02d8/17/bullseye/docker-entrypoint.sh \ /usr/local/bin/docker-entrypoint.sh -RUN sed -i '/03775/a\\ -mkdir -p /etc/postgresql-custom/conf.d\ -chown postgres:postgres /etc/postgresql-custom/conf.d\ -chmod 0755 /etc/postgresql-custom/conf.d' /usr/local/bin/docker-entrypoint.sh - RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql ENTRYPOINT ["docker-entrypoint.sh"]