|
342 | 342 | name = "pg_ident.conf";
|
343 | 343 | path = ./ansible/files/postgresql_config/pg_ident.conf.j2;
|
344 | 344 | };
|
| 345 | + postgresqlExtensionCustomScriptsPath = builtins.path { |
| 346 | + name = "extension-custom-scripts"; |
| 347 | + path = ./ansible/files/postgresql_extension_custom_scripts; |
| 348 | + }; |
345 | 349 | getkeyScript = ./nix/tests/util/pgsodium_getkey.sh;
|
346 | 350 | localeArchive = if pkgs.stdenv.isDarwin
|
347 | 351 | then "${pkgs.darwin.locale}/share/locale"
|
348 | 352 | else "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
349 | 353 | in
|
350 | 354 | pkgs.runCommand "start-postgres-server" { } ''
|
351 |
| - mkdir -p $out/bin $out/etc/postgresql-custom $out/etc/postgresql |
| 355 | + mkdir -p $out/bin $out/etc/postgresql-custom $out/etc/postgresql $out/extension-custom-scripts |
352 | 356 | cp ${supautilsConfigFile} $out/etc/postgresql-custom/supautils.conf || { echo "Failed to copy supautils.conf"; exit 1; }
|
353 | 357 | cp ${pgconfigFile} $out/etc/postgresql/postgresql.conf || { echo "Failed to copy postgresql.conf"; exit 1; }
|
354 | 358 | cp ${loggingConfigFile} $out/etc/postgresql-custom/logging.conf || { echo "Failed to copy logging.conf"; exit 1; }
|
355 | 359 | cp ${readReplicaConfigFile} $out/etc/postgresql-custom/read-replica.conf || { echo "Failed to copy read-replica.conf"; exit 1; }
|
356 | 360 | cp ${pgHbaConfigFile} $out/etc/postgresql/pg_hba.conf || { echo "Failed to copy pg_hba.conf"; exit 1; }
|
357 | 361 | cp ${pgIdentConfigFile} $out/etc/postgresql/pg_ident.conf || { echo "Failed to copy pg_ident.conf"; exit 1; }
|
| 362 | + cp -r ${postgresqlExtensionCustomScriptsPath}/* $out/extension-custom-scripts/ || { echo "Failed to copy custom scripts"; exit 1; } |
358 | 363 | echo "Copy operation completed"
|
359 | 364 | chmod 644 $out/etc/postgresql-custom/supautils.conf
|
360 | 365 | chmod 644 $out/etc/postgresql/postgresql.conf
|
|
371 | 376 | --subst-var-by 'SUPAUTILS_CONF_FILE' "$out/etc/postgresql-custom/supautils.conf" \
|
372 | 377 | --subst-var-by 'PG_HBA' "$out/etc/postgresql/pg_hba.conf" \
|
373 | 378 | --subst-var-by 'PG_IDENT' "$out/etc/postgresql/pg_ident.conf" \
|
374 |
| - --subst-var-by 'LOCALES' '${localeArchive}' |
| 379 | + --subst-var-by 'LOCALES' '${localeArchive}' \ |
| 380 | + --subst-var-by 'EXTENSION_CUSTOM_SCRIPTS_DIR' "$out/extension-custom-scripts" |
375 | 381 |
|
376 | 382 | chmod +x $out/bin/start-postgres-server
|
377 | 383 | '';
|
378 | 384 |
|
379 |
| - # Start a version of the client. |
380 |
| - start-client = pkgs.runCommand "start-postgres-client" { } '' |
381 |
| - mkdir -p $out/bin |
382 |
| - substitute ${./nix/tools/run-client.sh.in} $out/bin/start-postgres-client \ |
383 |
| - --subst-var-by 'PGSQL_DEFAULT_PORT' '${pgsqlDefaultPort}' \ |
384 |
| - --subst-var-by 'PGSQL_SUPERUSER' '${pgsqlSuperuser}' \ |
385 |
| - --subst-var-by 'PSQL15_BINDIR' '${basePackages.psql_15.bin}' |
386 |
| - chmod +x $out/bin/start-postgres-client |
387 |
| - ''; |
388 |
| - |
389 | 385 | # Start a version of the client and runs migrations script on server.
|
390 |
| - start-client-and-migrate = |
| 386 | + start-client = |
391 | 387 | let
|
392 | 388 | migrationsDir = ./migrations/db;
|
393 | 389 | postgresqlSchemaSql = ./nix/tools/postgresql_schema.sql;
|
394 | 390 | pgbouncerAuthSchemaSql = ./ansible/files/pgbouncer_config/pgbouncer_auth_schema.sql;
|
395 | 391 | statExtensionSql = ./ansible/files/stat_extension.sql;
|
396 | 392 | in
|
397 |
| - pkgs.runCommand "start-postgres-client-migrate" { } '' |
| 393 | + pkgs.runCommand "start-postgres-client" { } '' |
398 | 394 | mkdir -p $out/bin
|
399 |
| - substitute ${./nix/tools/run-client-migrate.sh.in} $out/bin/start-postgres-client-migrate \ |
| 395 | + substitute ${./nix/tools/run-client.sh.in} $out/bin/start-postgres-client \ |
400 | 396 | --subst-var-by 'PGSQL_DEFAULT_PORT' '${pgsqlDefaultPort}' \
|
401 | 397 | --subst-var-by 'PGSQL_SUPERUSER' '${pgsqlSuperuser}' \
|
402 | 398 | --subst-var-by 'PSQL15_BINDIR' '${basePackages.psql_15.bin}' \
|
403 | 399 | --subst-var-by 'MIGRATIONS_DIR' '${migrationsDir}' \
|
404 | 400 | --subst-var-by 'POSTGRESQL_SCHEMA_SQL' '${postgresqlSchemaSql}' \
|
405 | 401 | --subst-var-by 'PGBOUNCER_AUTH_SCHEMA_SQL' '${pgbouncerAuthSchemaSql}' \
|
406 | 402 | --subst-var-by 'STAT_EXTENSION_SQL' '${statExtensionSql}'
|
407 |
| - chmod +x $out/bin/start-postgres-client-migrate |
| 403 | + chmod +x $out/bin/start-postgres-client |
408 | 404 | '';
|
409 | 405 |
|
410 | 406 | # Migrate between two data directories.
|
|
559 | 555 | {
|
560 | 556 | start-server = mkApp "start-server" "start-postgres-server";
|
561 | 557 | start-client = mkApp "start-client" "start-postgres-client";
|
562 |
| - start-client-and-migrate = mkApp "start-client-and-migrate" "start-postgres-client-migrate"; |
563 | 558 | start-replica = mkApp "start-replica" "start-postgres-replica";
|
564 | 559 | migration-test = mkApp "migrate-tool" "migrate-postgres";
|
565 | 560 | sync-exts-versions = mkApp "sync-exts-versions" "sync-exts-versions";
|
|
0 commit comments