Skip to content

Commit 269f137

Browse files
authored
feat: Ensure postgres conf.d directory is set up (#1961)
* 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. * build: Update Nix install command and Dockerfile configs - Replaced `nix profile install .#<package>` with `nix profile add path:.#<package>` 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.
1 parent d783997 commit 269f137

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

Dockerfile-15

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ COPY . /nixpg
113113

114114
WORKDIR /nixpg
115115

116-
RUN nix profile install .#psql_15/bin
116+
RUN nix profile add path:.#psql_15/bin
117117

118118
RUN nix store gc
119119

@@ -167,7 +167,7 @@ FROM base as groonga
167167

168168
WORKDIR /nixpg
169169

170-
RUN nix profile install .#supabase-groonga && \
170+
RUN nix profile add path:.#supabase-groonga && \
171171
mkdir -p /tmp/groonga-plugins && \
172172
cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/
173173

@@ -209,7 +209,7 @@ COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
209209
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
210210
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf
211211
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf
212-
COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/
212+
COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/conf.d
213213
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf
214214
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
215215
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
@@ -227,7 +227,6 @@ RUN sed -i \
227227
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
228228
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
229229
usermod -aG postgres wal-g && \
230-
mkdir -p /etc/postgresql-custom/conf.d && \
231230
chown -R postgres:postgres /etc/postgresql-custom
232231

233232
# # Include schema migrations

Dockerfile-17

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ COPY . /nixpg
116116

117117
WORKDIR /nixpg
118118

119-
RUN nix profile install .#psql_17/bin
119+
RUN nix profile add path:.#psql_17/bin
120120

121121
RUN nix store gc
122122

@@ -171,7 +171,7 @@ FROM base as groonga
171171

172172
WORKDIR /nixpg
173173

174-
RUN nix profile install .#supabase-groonga && \
174+
RUN nix profile add path:.#supabase-groonga && \
175175
mkdir -p /tmp/groonga-plugins && \
176176
cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/
177177

@@ -213,7 +213,7 @@ COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
213213
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
214214
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf
215215
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf
216-
COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/
216+
COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/conf.d
217217
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf
218218
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
219219
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
@@ -231,7 +231,6 @@ RUN sed -i \
231231
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
232232
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
233233
usermod -aG postgres wal-g && \
234-
mkdir -p /etc/postgresql-custom/conf.d && \
235234
chown -R postgres:postgres /etc/postgresql-custom
236235

237236
# Remove items from postgresql.conf

Dockerfile-orioledb-17

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ COPY . /nixpg
116116

117117
WORKDIR /nixpg
118118

119-
RUN nix profile install .#psql_orioledb-17/bin
119+
RUN nix profile add path:.#psql_orioledb-17/bin
120120

121121
RUN nix store gc
122122

@@ -171,7 +171,7 @@ FROM base as groonga
171171

172172
WORKDIR /nixpg
173173

174-
RUN nix profile install .#supabase-groonga && \
174+
RUN nix profile add path:.#supabase-groonga && \
175175
mkdir -p /tmp/groonga-plugins && \
176176
cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/
177177

@@ -213,7 +213,7 @@ COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
213213
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
214214
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf
215215
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf
216-
COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/
216+
COPY --chown=postgres:postgres ansible/files/postgresql_config/conf.d /etc/postgresql-custom/conf.d
217217
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf
218218
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
219219
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
@@ -231,7 +231,6 @@ RUN sed -i \
231231
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
232232
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
233233
usermod -aG postgres wal-g && \
234-
mkdir -p /etc/postgresql-custom/conf.d && \
235234
chown -R postgres:postgres /etc/postgresql-custom
236235

237236
# Remove items from postgresql.conf

0 commit comments

Comments
 (0)