Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile-15
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,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/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
Expand All @@ -193,8 +194,8 @@ RUN sed -i \
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
echo 'auto_explain.log_min_duration = 10s' >> /etc/postgresql/postgresql.conf && \
usermod -aG postgres wal-g && \
mkdir -p /etc/postgresql-custom && \
chown postgres:postgres /etc/postgresql-custom
mkdir -p /etc/postgresql-custom/conf.d && \
chown -R postgres:postgres /etc/postgresql-custom

# # Include schema migrations
COPY migrations/db /docker-entrypoint-initdb.d/
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile-17
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,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/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
Expand All @@ -198,8 +199,8 @@ RUN sed -i \
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
echo 'auto_explain.log_min_duration = 10s' >> /etc/postgresql/postgresql.conf && \
usermod -aG postgres wal-g && \
mkdir -p /etc/postgresql-custom && \
chown postgres:postgres /etc/postgresql-custom
mkdir -p /etc/postgresql-custom/conf.d && \
chown -R postgres:postgres /etc/postgresql-custom

# Remove items from postgresql.conf
RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf"
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile-orioledb-17
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,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/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
Expand All @@ -198,8 +199,8 @@ RUN sed -i \
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
echo 'auto_explain.log_min_duration = 10s' >> /etc/postgresql/postgresql.conf && \
usermod -aG postgres wal-g && \
mkdir -p /etc/postgresql-custom && \
chown postgres:postgres /etc/postgresql-custom
mkdir -p /etc/postgresql-custom/conf.d && \
chown -R postgres:postgres /etc/postgresql-custom

# Remove items from postgresql.conf
RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf"
Expand Down
Empty file.
3 changes: 1 addition & 2 deletions ansible/files/postgresql_config/postgresql.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,6 @@ jit_provider = 'llvmjit' # JIT library to use
# default postgresql.conf. Note that these are directives, not variable
# assignments, so they can usefully be given more than once.

#include_dir = '...' # include files ending in '.conf' from
# a directory, e.g., 'conf.d'
#include_if_exists = '...' # include file only if it exists
#include = '...' # include file

Expand All @@ -769,6 +767,7 @@ include = '/etc/postgresql-custom/read-replica.conf'
# supautils specific configurations
#include = '/etc/postgresql-custom/supautils.conf'

include_dir = '/etc/postgresql-custom/conf.d' # include files ending in '.conf' from a directory, e.g., 'conf.d'
#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions ansible/tasks/setup-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
- '/home/postgres'
- '/var/lib/postgresql/data'
- '/var/log/postgresql'
- '/etc/postgresql-custom/conf.d'
loop_control:
loop_var: 'pg_dir_item'

Expand All @@ -137,6 +138,7 @@
loop:
- '/etc/postgresql'
- '/etc/postgresql-custom'
- '/etc/postgresql-custom/conf.d'
loop_control:
loop_var: 'pg_config_dir_item'

Expand Down
10 changes: 10 additions & 0 deletions nix/packages/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
name = "postgresql.conf";
path = ../../ansible/files/postgresql_config/postgresql.conf.j2;
};
configConfDir = builtins.path {
name = "conf.d";
path = ../../ansible/files/postgresql_config/conf.d;
};
supautilsConfigFile = builtins.path {
name = "supautils.conf";
path = ../../ansible/files/postgresql_config/supautils.conf.j2;
Expand Down Expand Up @@ -72,13 +76,19 @@
else
"${pkgs.glibcLocales}/lib/locale/locale-archive";

postgresqlConfigBaseDir = builtins.path {
name = "postgresql_config";
path = ../../ansible/files/postgresql_config;
};

substitutions = {
SHELL_PATH = "${pkgs.bash}/bin/bash";
PGSQL_DEFAULT_PORT = "${defaults.port}";
PGSQL_SUPERUSER = "${defaults.superuser}";
PSQL15_BINDIR = "${psql_15}";
PSQL17_BINDIR = "${psql_17}";
PSQL_CONF_FILE = "${paths.pgconfigFile}";
POSTGRESQL_CONFIG_DIR = "${postgresqlConfigBaseDir}";
PSQLORIOLEDB17_BINDIR = "${psql_orioledb-17}";
PGSODIUM_GETKEY = "${paths.getkeyScript}";
READREPL_CONF_FILE = "${paths.readReplicaConfigFile}";
Expand Down
8 changes: 8 additions & 0 deletions nix/tools/run-server.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ fi
echo "NOTE: patching postgresql.conf files"
cp "$PG_HBA_FILE" "$DATDIR/pg_hba.conf"
cp "$PG_IDENT_FILE" "$DATDIR/pg_ident.conf"
# Copy entire conf.d directory from postgresql_config
POSTGRESQL_CONFIG_DIR="@POSTGRESQL_CONFIG_DIR@"
cp -r "$POSTGRESQL_CONFIG_DIR/conf.d" "$DATDIR/"

# Make conf.d files writable (they're read-only from Nix store)
chmod -R u+w "$DATDIR/conf.d"

cp "$READREPL_CONFIG_FILE" "$DATDIR/read-replica.conf"
mkdir -p "$DATDIR/extension-custom-scripts"
cp -r "$EXTENSION_CUSTOM_SCRIPTS"/* "$DATDIR/extension-custom-scripts"
Expand All @@ -236,6 +243,7 @@ vault.getkey_script = '$PGSODIUM_GETKEY_SCRIPT'" \
-e "s|include = '/etc/postgresql-custom/read-replica.conf'|include = '$DATDIR/read-replica.conf'|" \
-e "\$a\\
session_preload_libraries = 'supautils'" \
-e "s|include_dir = '/etc/postgresql-custom/conf.d'|include_dir = '$DATDIR/conf.d'|" \
"$PSQL_CONF_FILE" > "$DATDIR/postgresql.conf"

# Function to configure OrioleDB specific settings
Expand Down