Commit Graph

16 Commits

Author SHA1 Message Date
shivaraj-bh
12e74823f4 fix(postgres): stop init on error in sql scripts
From psql docs (https://www.postgresql.org/docs/current/app-psql.html):

> psql returns 0 to the shell if it finished normally, 1 if a fatal
error of its own occurs (e.g., out of memory, file not found), 2 if the
connection to the server went bad and the session was not interactive,
and 3 if an error occurred in a script and the variable ON_ERROR_STOP
was set.

Also resolves https://github.com/juspay/services-flake/issues/107
2024-06-06 20:47:29 +05:30
John Hampton
4d363b6d22 test(postgres): set socketDir with empty listen_addresses
Test a postgres service with socketDir set and empty listen_addresses.
2024-04-14 08:57:42 +05:30
John Hampton
6c9b34f0b1 fix(postgres): fix pg_isready issue with empty listen_addresses
This commit resolves the issue where `pg_isready` would fail when
`socketDir` is set and `listen_addresses` is empty. `pg_isready` is now
modified to leverage `socketDir` when it is available.
2024-04-14 08:57:42 +05:30
shivaraj-bh
ecc409436c chore(postgres): default value for listen_addresses is already localhost
This is true after https://github.com/juspay/services-flake/pull/160
2024-03-27 12:43:35 +05:30
Shivaraj B H
18d5c1d168
fix(postgres): empty socketDir by default (#160)
resolves #139 

> empty `unix_socket_directories` means not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server.

see: https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES

* use TCP/IP by default for health check
2024-03-26 18:44:11 +05:30
Shivaraj B H
18f9decf13
refactor(postgres): replace string argument with attrset for connectionURI (#146)
for justification, see:
https://github.com/juspay/services-flake/pull/143#discussion_r1521290361
2024-03-13 00:40:13 +05:30
Shivaraj B H
8c25972cfb
feat(postgres): add connectionURI option (#143)
resolves #141
2024-03-12 14:24:28 +05:30
Adrian
f8cd3fbcb5
postgres init: use -U ${config.superuser} with psql if superuser != null (#106) 2024-02-21 23:36:56 +05:30
Shivaraj B H
9b806b53f3
postgres: always create socketDir during init if not already present (#88)
If the socketDir is in tmpfs, or if it is deleted by some other process, we would want the socketDir to be created, if not already present, on restarts.
2024-01-31 18:47:52 +05:30
John A. Lotoski
eb8361b9ab
postgres ensure socketDir mktemp init succeeds (#81)
* fix: ensure socketDir mktemp succeeds when path does not exist yet

* postgres: test socketDir with a multi-level non-existing path
2024-01-20 00:20:08 +05:30
John A. Lotoski
1a3f2d1936
postgres: add socketDir option (#77) 2024-01-18 23:10:16 +05:30
Shivaraj B H
bf3a582502
[Postgres]: Fix test process not starting (#78)
* needn't copy depends_on option, demonstrated in example/flake.nix

* postgres: test process must depend on both pg1 and pg2
2024-01-18 11:28:15 +05:30
Shivaraj B H
62e13715f8
[Postgres]: Use schemas in-place of initialDumps (#73)
* (postgres) rename schema to schemas; rm initialDumps, use schemas instead
2024-01-13 22:48:46 +05:30
Rohit Singh
2211042f3e
Postgres: Added option depends_on (#71)
* Added option depends_on which will be useful to append extra depends_on configuration to the <name>-init process.

* more meaningful `depends_on` option's description

---------

Co-authored-by: shivaraj-bh <sbh69840@gmail.com>
2023-12-28 20:44:32 +05:30
Rohit Singh
d6b73e401e
Adding option initialDumps to Postgres (#67)
---------

Co-authored-by: Shivaraj B H <sbh69840@gmail.com>
2023-12-26 15:15:32 +05:30
Rohit Singh
22e121b246
Using psql command instead of postgres in initialScript (#66)
* Use psql instead of postgres, as a result, use `pg_ctl` to temporarily start the postgres server in `${name}-init` process.
* Avoid creating a custom `postgresPkg` with extensions by using `apply` attribute provided by `mkOption`
* Refactor setup script, use `writeShellApplication` and resolve shell-check errors

---------

Co-authored-by: shivaraj-bh <sbh69840@gmail.com>
2023-12-25 00:35:03 +05:30