summary refs log tree commit diff
path: root/nixos/modules/services/databases
AgeCommit message (Collapse)AuthorFilesLines
2023-11-20nixos/postgresql: fix mentioned settings in ensurePermissions warningsSandro1-2/+2
2023-11-17Merge pull request #266270 from Ma27/postgresql-ownership-15Ryan Lahfa1-11/+47
2023-11-17nixos/postgresql: document psql 15 changes (#267238)Herwig Hochleitner1-0/+119
* nixos/postgresql: document psql 15 changes * nixos/postgresql: manual heading ids * nixos/postgresql: reword warning against initialScript Co-authored-by: Ryan Lahfa <masterancpp@gmail.com> * nixos/postgresql: wording PERMISSIONS -> PRIVILEGES Co-authored-by: Ryan Lahfa <masterancpp@gmail.com> * nixos/postgresql: document intermediate oneshot / service user method * nixos/postgresql/docs: clarify security benefits of `ensureDBOwnership` * nixos/postgresql/docs: service type -> serviceConfig.Type --------- Co-authored-by: Ryan Lahfa <masterancpp@gmail.com>
2023-11-13nixos/postgresql: improve the assertions for equality of DB user and DB nameRaito Bezarius1-13/+10
It is hard to figure out which one is offending without the database name.
2023-11-13nixos/postgresql: restore `ensurePermissions` and strong-deprecate itRaito Bezarius1-1/+45
As it is technically a breaking change, we should at least make a strong deprecation of `ensurePermissions` and leave it in the broken state it is, for out of tree users. We give them a 6 months notice to migrate away by doing so, which is honest. In the meantime, we forbid usage of `ensurePermissions` inside of nixpkgs.
2023-11-13nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15Maximilian Bosch1-35/+30
Closes #216989 First of all, a bit of context: in PostgreSQL, newly created users don't have the CREATE privilege on the public schema of a database even with `ALL PRIVILEGES` granted via `ensurePermissions` which is how most of the DB users are currently set up "declaratively"[1]. This means e.g. a freshly deployed Nextcloud service will break early because Nextcloud itself cannot CREATE any tables in the public schema anymore. The other issue here is that `ensurePermissions` is a mere hack. It's effectively a mixture of SQL code (e.g. `DATABASE foo` is relying on how a value is substituted in a query. You'd have to parse a subset of SQL to actually know which object are permissions granted to for a user). After analyzing the existing modules I realized that in every case with a single exception[2] the UNIX system user is equal to the db user is equal to the db name and I don't see a compelling reason why people would change that in 99% of the cases. In fact, some modules would even break if you'd change that because the declarations of the system user & the db user are mixed up[3]. So I decided to go with something new which restricts the ways to use `ensure*` options rather than expanding those[4]. Effectively this means that * The DB user _must_ be equal to the DB name. * Permissions are granted via `ensureDBOwnerhip` for an attribute-set in `ensureUsers`. That way, the user is actually the owner and can perform `CREATE`. * For such a postgres user, a database must be declared in `ensureDatabases`. For anything else, a custom state management should be implemented. This can either be `initialScript`, doing it manual, outside of the module or by implementing proper state management for postgresql[5], but the current state of `ensure*` isn't even declarative, but a convergent tool which is what Nix actually claims to _not_ do. Regarding existing setups: there are effectively two options: * Leave everything as-is (assuming that system user == db user == db name): then the DB user will automatically become the DB owner and everything else stays the same. * Drop the `createDatabase = true;` declarations: nothing will change because a removal of `ensure*` statements is ignored, so it doesn't matter at all whether this option is kept after the first deploy (and later on you'd usually restore from backups anyways). The DB user isn't the owner of the DB then, but for an existing setup this is irrelevant because CREATE on the public schema isn't revoked from existing users (only not granted for new users). [1] not really declarative though because removals of these statements are simply ignored for instance: https://github.com/NixOS/nixpkgs/issues/206467 [2] `services.invidious`: I removed the `ensure*` part temporarily because it IMHO falls into the category "manage the state on your own" (see the commit message). See also https://github.com/NixOS/nixpkgs/pull/265857 [3] e.g. roundcube had `"DATABASE ${cfg.database.username}" = "ALL PRIVILEGES";` [4] As opposed to other changes that are considered a potential fix, but also add more things like collation for DBs or passwords that are _never_ touched again when changing those. [5] As suggested in e.g. https://github.com/NixOS/nixpkgs/issues/206467
2023-11-11treewide: fix redirected and broken URLsAnthony Roussel6-6/+6
Using the script in maintainers/scripts/update-redirected-urls.sh
2023-10-30postgresql_11: removeMaximilian Bosch2-21/+21
As described in the release lifecycle docs from postgresql[1], v11 will stop receiving fixes as of Nov 9 2023. This means it's EOL throughout the entire lifetime of 23.11, so let's drop it now. A lot of examples are also referencing postgresql_11. Where it's sensible, use postgresql_15 as example now to avoid confusion. This is also handy because the LLVM 16 fix for postgresql is not available for postgresql 11 ;-) [1] https://www.postgresql.org/support/versioning/
2023-10-23nixos/ferretdb: fix broken link to documentationJulien Malka1-1/+1
2023-10-20Merge master into staging-nextgithub-actions[bot]4-4/+4
2023-10-20nixos: fix bad mkEnableOption descriptionsBjørn Forsman4-4/+4
Fix descriptions that don't account for (1) the "Whether to enable" prefix or (2) the automatically added trailing dot.
2023-10-16Merge remote-tracking branch 'origin/master' into staging-nextAlyssa Ross1-0/+79
Conflicts: pkgs/development/python-modules/cirq-core/default.nix
2023-10-16nixos/ferretdb: initJulien Malka1-0/+79
2023-10-09Merge master into staging-nextgithub-actions[bot]1-1/+1
2023-10-09nixos/postgresql: fix `identMap` exampleMaximilian Bosch1-1/+1
This was causing the following warning before when building the manual: warning: literalExample is deprecated, use literalExpression instead, or use literalMD for a non-Nix description. Rather than using `literalExpression`, nothing is used. This option expects a string and the example is a string, no special handling required. Both `literalExample` from the docbook ages and `literalExpression` now are only required if the example is a Nix expression rather than a value of the option's type.
2023-10-06Merge branch 'master' into staging-nextJan Tojnar1-1/+1
Conflicts: - pkgs/development/python-modules/xdot/default.nix between 2f244e3647bdf63b8aeca31a2f88091ffb3a9041 and 1a9a257cf753f104b59f19d14d04c148f721dfb2
2023-10-07Merge pull request #152631 from jonringer/pgmanage-use-packageArtturi1-1/+1
2023-09-27Merge staging-next into staginggithub-actions[bot]1-6/+16
2023-09-27postgresql: default to v15 in 23.11Gary Guo1-1/+2
2023-09-18services.postgres: add initialScript exampleMatthieu Coudron1-0/+5
2023-09-18services.postgresql: add identMap exampleMatthieu Coudron1-3/+5
to make things clearer
2023-09-18services.postgres: move the generated statement at the top of the fileMatthieu Coudron1-3/+6
2023-09-07nixos/surrealdb: incorporate beta 10 changeshappysalada1-22/+7
2023-08-23nixos/influxdb2: add org, bucket, users and auth provisioningoddlama1-66/+386
2023-08-18nixos/influxdb2: do not load passwordFile and tokenFile when provisioning is ↵Nick Cao1-1/+1
disabled
2023-08-16nixos/influxdb2: add initial setup automation and nixos testsoddlama1-7/+117
2023-07-27services.postgresql: fix exampleMatthieu Coudron1-2/+2
2023-07-22nixos/pgbouncer: init (#241578)10001011-0/+632
Co-authored-by: Marek Mahut <marek.mahut@gmail.com>
2023-06-08foundationdb: cleanupWeijia Wang1-3/+3
2023-05-19nixos: fix typosfigsoda4-4/+4
2023-05-19nixos/clickhouse: Notify systemd about successful startup (#232443)Yureka1-0/+7
https://github.com/ClickHouse/ClickHouse/pull/43400 https://github.com/ClickHouse/ClickHouse/pull/46613
2023-05-11nixos: Use checks instead of extraDependenciesRobert Hensing1-1/+1
... as appropriate. This drops a few unnecessary store paths from the system closure.
2023-04-29nixos/lldap: initIndeedNotJames1-0/+121
Co-authored-by: LongerHV <46924944+LongerHV@users.noreply.github.com>
2023-04-03remove myself (erictapen) from packages which I don't use anymoreKerstin Humm1-1/+1
2023-03-29Merge pull request #221851 from Ma27/postgresql-jit-supportSandro2-7/+57
postgresql: implement opt-in JIT support
2023-03-29nixos/postgresql: fix enableJITMaximilian Bosch1-2/+11
Make sure that JIT is actually available when using services.postgresql = { enable = true; enableJIT = true; package = pkgs.postgresql_15; }; The current behavior is counter-intuitive because the docs state that `enableJIT = true;` is sufficient even though it wasn't in that case because the declared package doesn't have the LLVM dependency. Fixed by using `package.withJIT` if `enableJIT = true;` and `package.jitSupport` is `false`. Also updated the postgresql-jit test to test for that case.
2023-03-29postgresql: pass through JIT-enabled variant of non-JIT postgres and vice versaMaximilian Bosch2-5/+46
This is useful if your postgresql version is dependant on `system.stateVersion` and not pinned down manually. Then it's not necessary to find out which version exactly is in use and define `package` manually, but just stay with what NixOS provides as default: $ nix-instantiate -A postgresql /nix/store/82fzmb77mz2b787dgj7mn4a8i4f6l6sn-postgresql-14.7.drv $ nix-instantiate -A postgresql_jit /nix/store/qsjkb72fcrrfpsszrwbsi9q9wgp39m50-postgresql-14.7.drv $ nix-instantiate -A postgresql.withJIT /nix/store/qsjkb72fcrrfpsszrwbsi9q9wgp39m50-postgresql-14.7.drv $ nix-instantiate -A postgresql.withJIT.withoutJIT /nix/store/82fzmb77mz2b787dgj7mn4a8i4f6l6sn-postgresql-14.7.drv I.e. you can use postgresql with JIT (for complex queries only[1]) like this: services.postgresql = { enable = true; enableJIT = true; }; Performing a new override instead of re-using the `_jit`-variants for that has the nice property that overlays for the original package apply to the JIT-enabled variant, i.e. with import ./. { overlays = [ (self: super: { postgresql = super.postgresql.overrideAttrs (_: { fnord = "snens"; }); }) ]; }; postgresql.withJIT.fnord still gives the string `snens` whereas `postgresql_jit` doesn't have the attribute `fnord` in its derivation. [1] https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-JIT-ABOVE-COST
2023-03-01dgraph: use --prefix to prefix PATH Sandro1-1/+1
This is more robust in case PATH is empty or otherwise weird.
2023-02-14Merge pull request #186660 from aopom/clickhouse-confMaximilian Bosch1-1/+1
Change clickhouse's module conf directory to permit overrides
2023-01-27nixos/manual: render module chapters with nixos-render-docspennae4-677/+2
this converts meta.doc into an md pointer, not an xml pointer. since we no longer need xml for manual chapters we can also remove support for manual chapters from md-to-db.sh since pandoc converts smart quotes to docbook quote elements and our nixos-render-docs does not we lose this distinction in the rendered output. that's probably not that bad, our stylesheet didn't make use of this anyway (and pre-23.05 versions of the chapters didn't use quote elements either). also updates the nixpkgs manual to clarify that option docs support all extensions (although it doesn't support headings at all, so heading anchors don't work by extension).
2023-01-10nixos/manual: move "edit the MD file" comments to generated XMLpennae4-2/+4
2023-01-10nixos/manual: generate module chapters with md-to-db.shpennae4-20/+16
2023-01-10nixos/manual: enable smart quotes for all MD chapterspennae4-14/+14
2023-01-10nixos/postgresql: convert manual chapter to MDpennae3-160/+354
2023-01-10nixos/foundationdb: convert manual chapter to MDpennae3-376/+667
2023-01-10nixos/manual: normalize <package> -> <literal>pennae1-1/+1
markdown can only do <literal>, so normalize to that. without auto-linking to a package index the distinction is not very useful anyway.
2023-01-10nixos/manual: remove links from program listingspennae1-8/+8
markdown cannot represent those links. remove them all now instead of in each chapter conversion to keep the diff for each chapter small and more understandable.
2023-01-05modules: add mkPackageOptionMDpennae1-1/+1
another transitional option factory, like mkAliasOptionModuleMD.
2022-12-18Merge pull request #206646 from figsoda/typosValentin Gagarin1-1/+1
2022-12-17nixos: fix typosfigsoda1-1/+1