|
276 | 276 | # Start a version of the server.
|
277 | 277 | start-server =
|
278 | 278 | let
|
279 |
| - configFile = ./nix/tests/postgresql.conf.in; |
| 279 | + pgconfigFile = builtins.path { |
| 280 | + name = "postgresql.conf"; |
| 281 | + path = ./ansible/files/postgresql_config/postgresql.conf.j2; |
| 282 | + }; |
| 283 | + supautilsConfigFile = builtins.path { |
| 284 | + name = "supautils.conf"; |
| 285 | + path = ./ansible/files/postgresql_config/supautils.conf.j2; |
| 286 | + }; |
| 287 | + loggingConfigFile = builtins.path { |
| 288 | + name = "logging.conf"; |
| 289 | + path = ./ansible/files/postgresql_config/postgresql-csvlog.conf; |
| 290 | + }; |
| 291 | + readReplicaConfigFile = builtins.path { |
| 292 | + name = "readreplica.conf"; |
| 293 | + path = ./ansible/files/postgresql_config/custom_read_replica.conf.j2; |
| 294 | + }; |
| 295 | + pgHbaConfigFile = builtins.path { |
| 296 | + name = "pg_hba.conf"; |
| 297 | + path = ./ansible/files/postgresql_config/pg_hba.conf.j2; |
| 298 | + }; |
| 299 | + pgIdentConfigFile = builtins.path { |
| 300 | + name = "pg_ident.conf"; |
| 301 | + path = ./ansible/files/postgresql_config/pg_ident.conf.j2; |
| 302 | + }; |
280 | 303 | getkeyScript = ./nix/tests/util/pgsodium_getkey.sh;
|
| 304 | + localeArchive = if pkgs.stdenv.isDarwin |
| 305 | + then "${pkgs.darwin.locale}/share/locale" |
| 306 | + else "${pkgs.glibcLocales}/lib/locale/locale-archive"; |
281 | 307 | in
|
282 | 308 | pkgs.runCommand "start-postgres-server" { } ''
|
283 |
| - mkdir -p $out/bin |
| 309 | + mkdir -p $out/bin $out/etc/postgresql-custom $out/etc/postgresql |
| 310 | + cp ${supautilsConfigFile} $out/etc/postgresql-custom/supautils.conf || { echo "Failed to copy supautils.conf"; exit 1; } |
| 311 | + cp ${pgconfigFile} $out/etc/postgresql/postgresql.conf || { echo "Failed to copy postgresql.conf"; exit 1; } |
| 312 | + cp ${loggingConfigFile} $out/etc/postgresql-custom/logging.conf || { echo "Failed to copy logging.conf"; exit 1; } |
| 313 | + cp ${readReplicaConfigFile} $out/etc/postgresql-custom/read-replica.conf || { echo "Failed to copy read-replica.conf"; exit 1; } |
| 314 | + cp ${pgHbaConfigFile} $out/etc/postgresql/pg_hba.conf || { echo "Failed to copy pg_hba.conf"; exit 1; } |
| 315 | + cp ${pgIdentConfigFile} $out/etc/postgresql/pg_ident.conf || { echo "Failed to copy pg_ident.conf"; exit 1; } |
| 316 | + echo "Copy operation completed" |
| 317 | + chmod 644 $out/etc/postgresql-custom/supautils.conf |
| 318 | + chmod 644 $out/etc/postgresql/postgresql.conf |
| 319 | + chmod 644 $out/etc/postgresql-custom/logging.conf |
| 320 | + chmod 644 $out/etc/postgresql/pg_hba.conf |
284 | 321 | substitute ${./nix/tools/run-server.sh.in} $out/bin/start-postgres-server \
|
285 | 322 | --subst-var-by 'PGSQL_DEFAULT_PORT' '${pgsqlDefaultPort}' \
|
286 | 323 | --subst-var-by 'PGSQL_SUPERUSER' '${pgsqlSuperuser}' \
|
287 | 324 | --subst-var-by 'PSQL15_BINDIR' '${basePackages.psql_15.bin}' \
|
288 |
| - --subst-var-by 'PSQL_CONF_FILE' '${configFile}' \ |
289 |
| - --subst-var-by 'PGSODIUM_GETKEY' '${getkeyScript}' |
290 |
| -
|
| 325 | + --subst-var-by 'PSQL_CONF_FILE' $out/etc/postgresql/postgresql.conf \ |
| 326 | + --subst-var-by 'PGSODIUM_GETKEY' '${getkeyScript}' \ |
| 327 | + --subst-var-by 'READREPL_CONF_FILE' "$out/etc/postgresql-custom/read-replica.conf" \ |
| 328 | + --subst-var-by 'LOGGING_CONF_FILE' "$out/etc/postgresql-custom/logging.conf" \ |
| 329 | + --subst-var-by 'SUPAUTILS_CONF_FILE' "$out/etc/postgresql-custom/supautils.conf" \ |
| 330 | + --subst-var-by 'PG_HBA' "$out/etc/postgresql/pg_hba.conf" \ |
| 331 | + --subst-var-by 'PG_IDENT' "$out/etc/postgresql/pg_ident.conf" \ |
| 332 | + --subst-var-by 'LOCALES' '${localeArchive}' |
| 333 | + |
291 | 334 | chmod +x $out/bin/start-postgres-server
|
292 | 335 | '';
|
293 | 336 |
|
|
0 commit comments