!vxTmkuJzhGPsMdkAOc:transformierende-gesellschaft.org

NixOS Matrix Subsystem

118 Members
Coordination and discussion about the matrix subsystem in NixOS - https://nixos.wiki/wiki/Matrix61 Servers

Load older messages


SenderMessageTime
10 Sep 2023
@dandellion:dodsorf.asDandellion *

ma27: Could you elaborate on what you meant by

The entire generation of units for workers somehow works around the module-system in a very weird way that I really don't want to maintain.

22:01:23
@dandellion:dodsorf.asDandellion Is it this part? 22:12:43
@dandellion:dodsorf.asDandellionI will reiterate again that my alternative was there to show off a IMO more preferable API, and that I'm open to changing really most implementation details22:17:24
@dandellion:dodsorf.asDandellion * I will reiterate again that my alternative was there to show off an IMO more preferable API, and that I'm open to changing really most implementation details22:17:32
11 Sep 2023
@ma27:nicht-so.sexyma27
In reply to @dandellion:dodsorf.as

ma27: Could you elaborate on what you meant by

The entire generation of units for workers somehow works around the module-system in a very weird way that I really don't want to maintain.

ok I wasn't too precise there. I meant the import of the worker-module which creates these units, sorry.

The module-system consists of functions with certain arguments (defined by _module.args - such as pkgs/lib/config), but all the other stuff should be built with (internal) options. On a destructured attribute-set as argument the attribute names are not lazy, so you depend on at least the bindings already (though the values seem to be unevaluated thunks). However, while evaluating imports of a declaration (synapse.nix in this case) it's possible that too much of config will be unintentionally evaluated at some point causing weird behavior (prime example of a current issue is that specialArgs.nixosModules works whereas config._module.args.nixosModules causes an infinite recursion). Yes, it seems to just evaluate at the moment, but this code working around the design so much seems like a time-bomb to me which will send somebody on a long debugging journey, so I don't want to see that merged (and internals of the module system may change in a subtle way at some point).

additionally, are there that many differences left now? the other PR also did services.matrix-synapse.workers.foobar = { /* workerConfig */ }; (i.e. attrsOf) when I first looked at it which seems to be your main issue. And generally the other PR seemed closer to being mergable (because of dealing with systemd hardening, logger config and using sockets with redis - by default there's no real reason to use a tcp socket here since everything is on the same machine anyways).

fwiw I'm not sure if more opinionated things such as nginx config generation for load-balancing of workers should be in a nixos module (at least as long as we don't have rfc42 for nginx - otherwise I'm not too worried about such an idea) because it's far too easy then to run into a problem that isn't covered by the module and then the config will be very hard to customize from my experience with maintaining nextcloud which actually ships with a full-blown nginx config. I may be wrong though, so if you think you have a good design for that, feel free to file a patch, I'm happy to take a look :)

13:54:16
@ma27:nicht-so.sexyma27Also, I'll take a final look at the PR, but I think it's in a mergeable state now. I'll wait with merging until tonight (in CEST) though because I'd like to hear if you think that there are design flaws that shouldn't be merged.13:55:26
@sophie:catgirl.cloud⛧-440729 [sophie] (it/its) joined the room.14:21:06
@dandellion:dodsorf.asDandellion

Thanks for clarifying.
I agree the import with the function is a little stinky.

I was not aware that this PR does attrsOf now, that's great! I'm not going to block this at all then

The only difference left is probably that I use workers.instances and this one does just pure workers like was suggested. This is fine, I can just use autoWorkers or something for part 2

I'll do a more thourough review, but I generally support merging this more complete implementation

15:54:18
@dandellion:dodsorf.asDandellion I do think the module is growing to becoming kind of unwieldy so it'd be nice if we could figure out how to split it up like I attempted to with the import workers.nix stuff 15:55:37
@ma27:nicht-so.sexyma27

I don't think it's that bad: I mean, if we'd talk about the sizes of *-packages.nix, then I'd agree (because most editors and LSPs are getting horribly slow then), but this doesn't seem to be the case here. Also, in languages with rather underdeveloped editor integrations I think splitting things off prematurely only makes it harder to find stuff IMHO. I think there's a reasonable boundary though: the current module is responsible for setting up synapse itself (including workers) which is tightly coupled (because e.g. the systemd units are quite similar). If we come up with a good design for setting up load balancing w/ nginx of HTTP locations to workers and/or the main process, then we'd have something that clearly belongs into its own file. Also, if the module becomes too complex eventually, we can also consider moving the options into its own file (right now we wouldn't gain much from it because the majority of the file consists of options).

The only difference left is probably that I use workers.instances and this one does just pure workers like was suggested. This is fine, I can just use autoWorkers or something for part 2

It used to be a level deeper, but I suggested to remove it (there was an enable option as well, but instead workers != {} is used as enable condition now).
And yeah, autoWorkers for more fancy / high-level stuff seems reasonable, that makes the distinction quite clear: one is there to actually define a worker, the other is there to declare what kinds of workers you need (i.e. one level higher) if I understood your proposal correctly. Not sure if there's better naming, but that'd be a detail to figure out then.

I'm still interested in your additional patches (just declaring that one needs N workers doing X and M workers doing Y seems pretty cool. Not sure if we'll find a reasonable abstraction for the nginx part w/o rfc42 for nginx, but we'll see and I'm happy to discuss this in a github issue first if you're not sure - asynchronous discussion is preferred over chat for that).

I think this is a very big step forward now (after supporting synapse for a long time, one can trivially set up workers on NixOS now without knowledge about the inner workings of the synapse module - knowing how to write Nix and (basic) knowledge about synapse configuration is sufficient; it's type-checked, validated & well-documented) and these kinds of ideas are clearly follow-up work, so I'll stick to my plan and merge.

19:27:53
16 Sep 2023
@hexa:lossy.networkhexaTIL: https://github.com/matrix-org/synapse/blob/develop/flake.nix17:18:04
@hexa:lossy.networkhexacreated by anoadragon45317:18:38
@sumner:nevarro.spaceSumner EvansYeah. It's kinda a weird setup for dev tbh. But if you modify a couple things it's usable.17:31:45
18 Sep 2023
@hexa:lossy.networkhexaworker support 👏17:54:49
@hexa:lossy.networkhexathanks everyone17:55:09
@hexa:lossy.networkhexanow, who will manage that nasty nginx vhost for me? 🤡17:55:35
@ma27:nicht-so.sexyma27I'm sure there are at least three people with config for that :>17:59:07
@dandellion:dodsorf.asDandellion

I think Ma27 seemed quite negative about this generally, But personally I think just putting the maps inside services.nginx.commonHttpConfig is more than adequate even without RFC-42 nginx (Which I think is basically impossible without introducing some kind of DAG system similar to home-manager)

But I'll be changing my module to match the nixpkgs implementation and work towards upstreaming the autoconfig stuff

18:01:57
@hexa:lossy.networkhexaI think it is much more straightforward than nextcloud 😄 18:02:44
@hexa:lossy.networkhexaand maintaining the map in nixpkgs would require a fair amount of testing and attention when updating the package18:03:22
@dandellion:dodsorf.asDandellionworst case it just falls back to the main process18:03:51
@dandellion:dodsorf.asDandellionit'd be additive in any case really18:04:04
@hexa:lossy.networkhexa Oh yeah, that should work for most cases, except for enable_media_repo = false or send_federation = false 18:04:43
@hexa:lossy.networkhexaalso stream writers are a bit more complex with the different types they can be configured to handle18:05:58
@dandellion:dodsorf.asDandellionstream writers are problematic yep18:06:17
@dandellion:dodsorf.asDandellionor, at least, slightly annoying18:06:31
@hexa:lossy.networkhexaevents can be striped across multiple workers, most other things (typing, to_device, account_data, receipts, presence) cannot18:07:06
@hexa:lossy.networkhexasynapse will fail to boot when you configure a list where it expects a string, ask me how I know18:07:55
@hexa:lossy.networkhexa * synapse will fail to boot when you configure a list of workers where it expects a just a single one, ask me how I know18:08:13
@dandellion:dodsorf.asDandellionthat's right, it's also why my module only supports event persisters for now18:09:00

Show newer messages


Back to Room ListRoom Version: 4