Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/rspamd: worker configuration, socket activation and tests #34562

Merged
merged 2 commits into from Feb 9, 2018

Conversation

griff
Copy link
Contributor

@griff griff commented Feb 3, 2018

Motivation for this change

These two commits add first tests for existing rspamd module and then updated the module so that you have more control over workers configuration and add support for socket activation.

Care has been taken for the updated module to stay compatible with existing configurations with tests to verify that this is the case.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Copy link
Member

@andir andir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Please have a look at the missing description.

description = "The type of this worker";
};
bindSockets = mkOption {
type = types.listOf (types.either types.str (types.submodule bindSocketOpts));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are missing a description here. That is also why @GrahamcOfBorg is reporting a build failure:

Option `services.rspamd.workers.<name>.bindSockets' has no description.
``

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed now

@andir
Copy link
Member

andir commented Feb 5, 2018

@GrahamcOfBorg test rspamd

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

error: attribute ‘x86_64-linux’ in selection path ‘tests.rspamd.x86_64-linux’ not found

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

@griff
Copy link
Contributor Author

griff commented Feb 5, 2018

The test errors seem to be because rspamd has subtests so the selection path should be tests.rspamd.bindports.x86_64-linux.

With a selection path for each of bindports, deprecated, ipv4only, ipv4only-socketActivated, simple, simple-socketActivated and socketActivation

@andir
Copy link
Member

andir commented Feb 7, 2018

@GrahamcOfBorg test rspamd.bindports rspamd.deprecated rspamd.ipv4only rspamd.ipv4only-socketActivated rspamd.simple rspamd.simple-socketActivated rspamd.socketActivated

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

trace: warning: The option `services.rspamd.bindUISocket' defined in `<unknown-file>' has been renamed to `services.rspamd.workers.controller.bindSockets'.
trace: warning: The option `services.rspamd.bindSocket' defined in `<unknown-file>' has been renamed to `services.rspamd.workers.normal.bindSockets'.
error: attribute ‘socketActivated’ in selection path ‘tests.rspamd.socketActivated.x86_64-linux’ not found

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

trace: warning: The option `services.rspamd.bindUISocket' defined in `<unknown-file>' has been renamed to `services.rspamd.workers.controller.bindSockets'.
trace: warning: The option `services.rspamd.bindSocket' defined in `<unknown-file>' has been renamed to `services.rspamd.workers.normal.bindSockets'.
error: attribute 'socketActivated' in selection path 'tests.rspamd.socketActivated' not found

@griff
Copy link
Contributor Author

griff commented Feb 9, 2018

@andir Ups I had inconsistently named the tests. Could I trouble you with redoing the @GrahamcOfBorg test command since the tests are now named consistently.

@andir
Copy link
Member

andir commented Feb 9, 2018

@GrahamcOfBorg test rspamd.bindports rspamd.deprecated rspamd.ipv4only rspamd.ipv4only-socketActivated rspamd.simple rspamd.simple-socketActivated rspamd.socketActivated

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

machine# [   26.373297] rspamd[765]: <4pr1kh>; map; read_map_file: /nix/store/dddvgkwkx31ic2q3wdfx18xsfnqpvy0b-rspamd-1.6.5/etc/rspamd/2tld.inc: read map dat, 8213 bytes
/nix/store/dccvpliw89gfhr5v5qypafz7039p46b5-vm-test-run-rspamd-socketActivated
machine# [   26.375293] rspamd[765]: <4pr1kh>; map; rspamd_map_file_read_callback: rereading map file /var/lib/rspamd/2tld.inc.local
machine: exit status 0
machine# [   26.379489] rspamd[765]: <4pr1kh>; map; read_map_file: /var/lib/rspamd/2tld.inc.local: map file is unavailable for reading
test script finished in 28.00s
cleaning up
killing machine (pid 593)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/tmp/nix-build-vm-test-run-rspamd-ipv4only-socketActivated.drv-0/vde1.ctl': Directory not empty

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

killing machine (pid 627)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/fz5chxdw0bwpbqlzp7liwhh3zx1vkxm7-vm-test-run-rspamd-bindports
/nix/store/6n40vxv5jxg8ppmwi6mgspxyl7w0ljii-vm-test-run-rspamd-deprecated
/nix/store/hfxlhva4hrh2vh75f71hsf8ygqk0dk4b-vm-test-run-rspamd-ipv4only
/nix/store/7zks4mmam1f6p65m9n5jz39wbabnw5pf-vm-test-run-rspamd-ipv4only-socketActivated
/nix/store/n5cpyx9zy07x8rx7plr7s18m7dlmj5b1-vm-test-run-rspamd-simple
/nix/store/abxjhj5zszrk3amfsgmxz738y879c00n-vm-test-run-rspamd-simple-socketActivated
/nix/store/2q6ckm8c512np2051fqz6fmpgs5gd156-vm-test-run-rspamd-socketActivated

};
imports = [
(mkRenamedOptionModule [ "services" "rspamd" "bindSocket" ] [ "services" "rspamd" "workers" "normal" "bindSockets" ])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add some deprecation deadlin from the beginning? Like saying "with 18.09 this will be removed!" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this more you probably also want to write a brief changelog entry about "breaking" changes in regards to rspamd ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well since this does a rename and is backwards compatible it isn't really a breaking change. It works exactly like before when using the old options it just gives you a warning as well.

I also wouldn't add a deadline for removal since having the old option supported has at the moment no downsides and no other usage of mkRenamedOptionModule has such a deadline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know.. It was just my personal opinion that we should probably not carry everything for the remaining time of this project. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants