nixos/postgresql: enrich ensure users and databases support#255961
nixos/postgresql: enrich ensure users and databases support#255961Scrumplex wants to merge 13 commits intoNixOS:masterfrom
Conversation
018e44e to
fb401ad
Compare
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/anybody-wanna-adopt-203474/25524/2 |
fb401ad to
9af7db2
Compare
nixos/tests/hedgedoc.nix
Outdated
There was a problem hiding this comment.
I don't know why the dbname and owner don't match here and why not socket auth is used but I also don't have enough time to also maintain the tests of my packages. sigh. :(
e098c0a to
22e31c0
Compare
marsam
left a comment
There was a problem hiding this comment.
This looks great. Thanks a lot!
There was a problem hiding this comment.
args doesn't seem to be used. What do you think of removing it?
There was a problem hiding this comment.
args is actually used a few lines below in ensureUsers
|
@GrahamcOfBorg test postgresql postgresql-ensure |
Specifically, this commit makes it possible to set various database parameters beside just the name.
This reorganizes the ensure code generation to make the code a bit less dense and also do general cleanups. Most importantly, the order is changed to first create users, then databases, and finally clauses and grants. This allows the database creation to refer to new users as owners. Co-authored-by: Sefa Eyeoglu <contact@scrumplex.net> Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This replaces the explicit database setup script to instead use the PostgreSQL `ensureUsers` and `ensureDatabases` options.
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
22e31c0 to
86f9827
Compare
|
Unfortunately, It looks like this will a bit late for helping us adapt to postgres 15 for 23.11. For now, we'll deprecate I would very much like to give a proper look at this approach for 24.05, especially also look at ways this could tie into system - wide approach towards state management and migrations. Also I'd like to look for a way to get the benefits of ensure-style options, while avoiding the pitfalls of convergent configuration management I wrote out my initial thoughts here: #267365 |
|
I'll close this as I don't really intend on working on this much further. Though feel free to continue this, as we don't have an alternative to convergent configuration management for databases in Nixpkgs atm. |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/what-about-state-management/37082/1 |
Description of changes
Based on #203474
TODOs
ensureClausesThings done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)