about summary refs log tree commit diff
path: root/nixos/tests/pgadmin4.nix
AgeCommit message (Collapse)AuthorFilesLines
2024-01-16python3Packages.flask-security-too: fix for webauth 2Florian Brandes1-2/+1
also removes pydantic (since webauth 2 doesn't use it anymore) Signed-off-by: Florian Brandes <florian.brandes@posteo.de> Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2024-01-13pgadmin: 8.1 -> 8.2Florian Brandes1-0/+6
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2024-01-11nixos/pgadmin: apply review suggestionsFlorian Brandes1-1/+1
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2023-11-29nixos/pgadmin: add passwordLength settingFlorian Brandes1-17/+39
pgadmin by default checks the length of the password and will fail with passwords < 6 characters. The produced error message is buried in python tracebacks and hard to find and debug. Therefore this adds the setting, and also adds a check in the pre-start script of pgadmin. The nixos/pgadmin tests have been modified, also. Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2023-11-13nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15Maximilian Bosch1-8/+0
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-05-15nixosTests.pgadmin4: increase test coverage (#229632)Florian1-4/+8
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2023-02-09pgadmin4: add option to enable desktop modeFlorian Brandes1-0/+57
By default, pgadmin4 uses SERVER_MODE = True. This requires access to system directories (e.g. /var/lib/pgadmin). There is no easy way to change this mode during runtime. One has to change or add config files withing pgadmin's directory structure to change it or add a system-wide config file under `/etc/pgadmin`[1]. This isn't always easy to achive or may not be possible at all. For those usecases this implements a switch in the pgadmin4 derivation and adds a new top-level package `pgadmin4-desktopmode`. This builds in DESKTOP MODE and allows the usage of pgadmin4 without the nixOS module and without access to system-wide directories. pgadmin4 module saves the configuration to /etc/pgadmin/config_system.py pgadmin4-desktopmode tries to read that as well. This normally fails with a PermissionError, as the config file is owned by the user of the pgadmin module. With the check-system-config-dir.patch this will just throw a warning but will continue and not read the file. If we run pgadmin4-desktopmode as root (something one really shouldn't do), it can read the config file and fail, because of the wrong config for desktopmode. [1]https://www.pgadmin.org/docs/pgadmin4/latest/config_py.html Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2023-02-09pgadmin4: move package tests back into the packageFlorian Brandes1-139/+0
We test pgadmin in nixosTests, because it needs a running postgresql instance. This is now unnecessary since we can do so in the package itself. This reduces the complexity of pgadmin and removes the need for the extra nixosTests. Also setting SERVER_MODE in `pkg/pip/setup_pip.py` does not have any effect on the final package, so we remove it. In NixOS, we use the module, which expects SERVER_MODE to be true (which it defaults to). In non-NixOS installations, we will need the directory /var/lib/pgadmin and /var/log/pgadmin Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2023-02-03pgadmin4: 6.18 -> 6.19Florian Brandes1-109/+115
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2022-12-17nixos: fix typosfigsoda1-1/+1
2022-10-01pgadmin4: 6.13 -> 6.14Florian Brandes1-3/+1
include fix for flask-security-too update Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2022-09-22pgadmin4: 6.12 -> 6.13Florian Brandes1-10/+9
- Add update script - Add email options to pgadmin4 nixOS module - Add override for flask 2.2 Co-authored-by: Sandro <sandro.jaeckel@gmail.com> Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2022-07-05pgadmin: 6.10 -> 6.11Florian Brandes1-7/+11
skip failing test caused by postgresql update Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2022-04-28pgadmin4: pass pythonEnv as variableFlorian Brandes1-27/+5
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2022-04-27pgadmin4: fix testsFlorian Brandes1-44/+24
this commit passes the build dependencies to the pgadmin nixos test for package and regression testing. Also added changelog and some clarifying comments. Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2022-04-27pgadmin4: make regression test use the same packagesFlorian Brandes1-47/+78
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2022-03-29pgadimin4: 6.5 -> 6.7Florian Brandes1-0/+1
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2022-02-26pgadmin4: init at 6.3florian on nixos (Florian Brandes)1-0/+142
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>