This repository defines the configuration of the MIMUW students Discourse forum. It's in a very early stage of development and at the moment it's more of a proof of concept than a working solution.
The core of this repo is a Nix flake that defines the system configuration of a Discourse server instance. Usage of Nix flakes is dictated by the desire to have a reproducible, declarative and transparent configuration of the forum. Everybody can see what the forum is configured to, propose changes and see the effects of those changes using the local development environment.
Requirements:
- GNU/Linux (or maybe macOS?) system.
- Nix package manager installed.
- Flakes enabled in your Nix installation.
Let's say that you just changed some site setting in flake.nix
and you want to see how it affects the forum.
The easiest way to do that is to run a local development instance of the forum, and observe the changes from your browser.
To do so, you can use the vm
package output defined in flake.nix
.
The following command will build and run a virtual machine image with the properly configured Discourse service:
nix run '.#vm' # It also works without the ''
After the VM boots up, you can access the forum at http://localhost:8080
.
You may need to wait some time after boot for the Discourse service startup to finish.
- Invoking
journalctl -f
in the VM will show you the system logs. - Invoking
systemctl status discourse
will also show you the status of the Discourse service e.g. Whether it completed the startup process.
To check if the flake evaluates correctly, run:
nix flake check --no-build
The repository contains integration tests that check if the Discourse service defined in the flake's modules is configured correctly.
Tests use the NixOS testing framework and are defined in the tests
directory.
They setup client + server virtual machines and run Selenium & API-based acceptance tests.
Although it sounds complicated, running these tests is as simple as:
nix flake check -L
To format the Nix code in this repository, run:
nix fmt