Discourse module for NixOS

As Matthew Bauer (doesn’t look like he has an account here yet) mentioned on the mailing list, it would be nice to have a NixOS module for setting up Discourse forums.

I’ve got a NixOS module that I use for my WoW guild’s forums (in a failed
attempt to get them to migrate away from Discord :/):

https://gist.github.com/teozkr/ae017b89d4a0179ec211757aa92ff3a1

That said, it’s pretty hacky since Discourse uses a complicated docker-based
setup with their own auto-updates, and stores all settings in the database.
A proper NixOS module would probably have to break up each container,
as well as provide something similar to Jenkins Job Builder to declaratively
specify settings.

Another problem with my setup is the slow rebuild times: expect to spend
10-15 minutes waiting for it to rebuild and start. Letting Nix handle this
rebuilding would (hopefully) at least provide some sensible caching.

4 Likes

I agree in principle that it would be nice to have Discourse packaged with NixOS.

Gitlab is quite similar in that it’s a Rails-based project that also needs a bunch of dependencies like Nginx, Postgresql and Redis to run properly. Gitlab is distributed in nixpkgs and has been quite maintainer-heavy. Every ruby or gitlab release tends to break things as they make too many assumptions about the system and it’s packaged as one big tangle of files.

Until they see the light the more practical approach would be to run the Docker container which is well tested by their QA. Maybe it’s possible to run that image in the nixos-containers? Both services could probably still benefit from the declarative approach for the configuration files and the container setup.

2 Likes

Oh, so nixos-container supports OCI images these days? That’s interesting to know.

Either way, I’m afraid Discourse would still need some tweaking to work with that, since AFAIK its auto-update process interacts directly with the host’s Docker instance.

1 Like

I don’t know. It assume that it would be less work to implement that than packaging Discourse.

Will have to tackle this myself as well so here’s a couple links for future reference:

1 Like

Can’t edit my post above and just found a the gitlab upgrade PR and a HN thread

Apparently, this is already done, thanks!

1 Like