Commit graph

62 commits

Author SHA1 Message Date
ajs124 106626b8d7 nixos/tt-rss: add phpPackage option
right now, we have php81 and php (which points to php82), which means that:
- php-fpm uses php81
- the update preStart uses php81
- the actual updater uses php82
2024-02-07 17:41:27 +01:00
ajs124 33ca948d6a
Merge pull request #259604 from sefidel/tt-rss-force-update-schema
nixos/tt-rss: supply --force-yes to update-schema
2024-02-07 17:39:03 +01:00
Maximilian Bosch 48459567ae nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15
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-13 17:16:25 +01:00
Anthony Roussel e30f48be94
treewide: fix redirected and broken URLs
Using the script in maintainers/scripts/update-redirected-urls.sh
2023-11-11 10:49:01 +01:00
sefidel 57dbf4c082
nixos/tt-rss: supply --force-yes to update-schema
This commit fixes the service failing to start for the first time since
the update-schema operation requires human interaction (typing 'yes') in
order to actually perform the schema upgrade.
2023-10-08 01:21:44 +09:00
ajs124 f8df5ffdfe nixos/tt-rss: fix and significantly simplify database setup
the schema files referenced in the current preStart are empty.
other ones exist, but don't apply cleanly either.
calling update.php with --update-schema works for initial setup and
updates. if the database schema is already up to date, it's idempotent.
2023-09-09 19:11:54 +02:00
Thomas Gerbet 796121dc9b tt-rss: unstable-2022-10-15 -> unstable-2023-04-13, module use PHP 8.1
Upstream Docker images also uses PHP 8.1.

Diff:
https://git.tt-rss.org/fox/tt-rss.git/diff/?id=0578bf802571781a0a7e3debbbec66437a7d28b4&id2=602e8684258062937d7f554ab7889e8e02318c96
2023-04-27 11:46:38 +02:00
Daniel Nagy 095269c862
treewide: use types.port in nixos modules 2022-11-10 09:30:00 +01:00
pennae ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae 2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Jörg Thalheim 70b31373b4
tt-rss: downgrade to php 8.0 2022-06-07 14:24:07 +02:00
Mats Rauhala 0eaecd60cb tt-rss-module handle situations without any password 2021-12-11 15:02:27 +02:00
Mats Rauhala de16da59f2 Fix the syntax error on tt-rss config file 2021-12-11 15:02:27 +02:00
Naïm Favier 2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Guillaume Girol 48619f77a4 nixos/tt-rss: make all php files read only
Fixes: #55300
2021-08-08 12:00:00 +00:00
Guillaume Girol 256af6b742
nixos/tt-rss: fix eval 2021-07-31 15:19:00 +00:00
Milo Gertjejansen 7aa2bf302a Added more detail to changelog, updated permissions in directory, and changed restartTriggers 2021-07-28 20:53:38 -04:00
Milo Gertjejansen 70338c53c9 Added release notes and broke date apart 2021-07-25 15:40:33 -04:00
Milo Gertjejansen b1dd02d212 Api didn't seem to work with the systemd envs
I am not sure why it was working for me, but after restarting
phpfpm-tt-rss it quit working.
2021-07-06 18:46:22 -04:00
Milo Gertjejansen 97cb387fb9 tt-rss: 2021-01-29 -> 2021-06-23 and modules/tt-rss: updated config.php creation
The version of tt-rss in nixpkgs was pre-php 8. This updates tt-rss to the most recent version, which uses php 8.

The updates to the module are required changes, per https://community.tt-rss.org/t/rip-config-php-hello-classes-config-php/4337.
2021-07-06 18:46:21 -04:00
talyz 59e0120aa5
treewide: Fix mysql alias deprecation breakage
62733b37b4 broke evaluation in all
places `pkgs.mysql` was used. Fix this by changing all occurrences to
`pkgs.mariadb`.
2021-06-04 21:42:08 +02:00
Florian Klink 962e15aebc nixos: remove StandardOutput=syslog, StandardError=syslog lines
Since systemd 243, docs were already steering users towards using
`journal`:

eedaf7f322

systemd 246 will go one step further, it shows warnings for these units
during bootup, and will [automatically convert these occurences to
`journal`](f3dc6af20f):

> [    6.955976] systemd[1]: /nix/store/hwyfgbwg804vmr92fxc1vkmqfq2k9s17-unit-display-manager.service/display-manager.service:27: Standard output type syslog is obsolete, automatically updating to journal. Please update│······················
 your unit file, and consider removing the setting altogether.

So there's no point of keeping `syslog` here, and it's probably a better
idea to just not set it, due to:

> This setting defaults to the value set with DefaultStandardOutput= in
> systemd-system.conf(5), which defaults to journal.
2020-08-13 18:49:15 +02:00
Symphorien Gibol 8fc8eec0e7 nixos/tt-rss.service: set syslogidentifier 2020-05-08 12:00:00 +00:00
Symphorien Gibol e96c52efdb tt-rss: restart on failure
as should be the default with all long-running services
2020-05-08 12:00:00 +00:00
Symphorien Gibol c7db8c1927 tt-rss: make less insanely verbose.
Fixes #74427
2020-05-08 12:00:00 +00:00
volth 432a2d73be
nixos/tt-rss: fix string escape 2019-09-17 00:23:51 +00:00
volth 7b8fb5c06c treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
Frederik Rietdijk 5061fe0c2c Merge staging-next into staging 2019-08-28 08:26:42 +02:00
volth 35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
Aaron Andersen 400c6aac71 nixos/phpfpm: deprecate extraConfig options in favor of settings options 2019-08-23 07:56:27 -04:00
Aaron Andersen 62b774a700 nixos/phpfpm: add socket option to replace the listen option 2019-08-23 07:56:21 -04:00
Aaron Andersen 1cd3b98c3a nixos/tt-rss: remove deprecated usage of PermissionsStartOnly, specify a group to run service as, and fix local pgsql database creation 2019-07-05 22:04:56 -04:00
Aaron Andersen 278d867a9b Revert "Merge pull request #63156 from Izorkin/phpfpm-rootless"
This reverts commit b5478fd1a2, reversing
changes made to dbb00bfcbf.
2019-06-28 21:47:43 -04:00
Elis Hirwing b5478fd1a2
Merge pull request #63156 from Izorkin/phpfpm-rootless
phpfpm: do not run anything as root
2019-06-27 19:13:53 +02:00
Izorkin 6093c04b67 nixos/tt-rss: fix work with phpfpm-rootless mode 2019-06-17 09:15:48 +03:00
volth f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Bob van der Linden f09fb4d4dd
nixos/tt-rss: /var/run -> /run 2019-03-24 21:15:32 +01:00
Robert Irelan 7ae4b4897a
tt-rss: Fix syntax error in config.php DB_PASS field
Empty password case would write `define('DB_PASS', )` instead of `define('DB_PASS', '')`.
2019-02-19 16:24:17 -08:00
Torsten Schmits 97bb693927 nixos/tt-rss: fix syntax error in pre-start script 2019-02-17 10:50:24 +01:00
Silvan Mosberger 8a5925b7eb
Merge pull request #55301 from telotortium/tt-rss_disable_automatic_updates
Remove option config.services.tt-rss.checkForUpdates (forced to false)
2019-02-14 21:15:30 +01:00
Jörg Thalheim f636bb2016
tt-rss: read listen socket from pool
This allows to use a different socket.
The configuration was tested on my server.
2019-02-08 07:08:13 +00:00
Jörg Thalheim 367b1e10cb
tt-rss: add database.passwordFile option 2019-02-08 07:08:10 +00:00
Robert Irelan eab69d998b Remove option config.services.tt-rss.checkForUpdates (forced to false)
Force this option to false. Leaving this as true (currently the default)
is dangerous. If the TT-RSS installation upgrades itself to a newer
version requiring a schema update, the installation will break the next
time the TT-RSS systemd service is restarted.

Ideally, the installation itself should be immutable (see
https://github.com/NixOS/nixpkgs/issues/55300).
2019-02-05 23:05:23 -08:00
Janne Heß be6e995085 nixos/tt_rss: Give a proper UID 2018-09-18 21:46:52 +02:00
Florian Klink fff5923686 nixos/modules: users.(extraUsers|extraGroup->users|group) 2018-06-30 03:02:58 +02:00
Janne Heß 31714e44b7 nixos/tt-rss: Support plugins and themes
The extra config is required to configure some plugins.
2018-06-04 14:14:57 +02:00
Gabriel Ebner d91caac6c3 services.tt-rss: do not unnecessarily start nginx 2018-04-17 11:44:52 +02:00
Yegor Timoshenko 5905fe069b
tt-rss: use proper user and package for MySQL 2018-03-06 03:10:24 +00:00
Robin Gloster cfed96ca51 nixos/service.tt-rss: improve pgsql support, do not use static uid/gid 2018-01-05 14:47:54 +01:00
Jaakko Luttinen c26ff43905 nixos/service.tt-rss: improve mysql automatic setup
If the user chooses MySQL, it is enabled by default. Also, the used database is
created automatically along with the user and permissions.
2018-01-05 14:47:54 +01:00