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
Reloadable containers #28465
Reloadable containers #28465
Conversation
…r template instances This makes declarative containers truly reloadable. Current code already declares it: https://github.com/NixOS/nixpkgs/blob/56904d7c423f2b13b37fbd29f39bbb4b52bc7824/nixos/modules/virtualisation/containers.nix#L488 ``` restartIfChanged = false; ``` https://github.com/NixOS/nixpkgs/blob/56904d7c423f2b13b37fbd29f39bbb4b52bc7824/nixos/modules/virtualisation/containers.nix#L540 ``` reloadIfChanged = true; ``` Original author: @chrisfarms in NixOS@6e36619 Most of stuff from that commit has already been ported.
…ig changes are applied on `nixos-rebuild switch` invocations.
cc @volth @kampfschlaefer @fpletz who run containers I'm not going to address "pitfalls" problems in this PR. I'd rather say that current PR is a compromise of usefulness VS correctness. Also, pitfalls 1 and 2 are present already, so the only real problem is slower activation time when many containers are running. It may also start failing, because of real problems in container configuration. |
So, I've done some research which templated services will be affected. Here is a list of all templated:
and here is list of reloadable templated services:
That |
Cool! Thanks a lot! |
Motivation for this change
This makes declarative containers truly reloadable (container config changes are applied on
nixos-rebuild switch
). Current code already declares it:nixpkgs/nixos/modules/virtualisation/containers.nix
Line 488 in 56904d7
nixpkgs/nixos/modules/virtualisation/containers.nix
Line 540 in 56904d7
Original author: @chrisfarms in 6e36619
Most of stuff from that commit has already been ported.
Details
There is indeed a bug in how
switch-to-configuraiton.pl
detects template instances. That's why systemd units for containers were never considered as changed and so never where reloaded.This obviously doesn't do anything to imperative containers.
Pitfalls
In current state containers suffer from the long-running problem - when to restart and when to reload. Because this change makes containers "reloadable-only" (was "never restart, never reload"), it imposes several problems:
journalctl
won't show container reload logs without-M $container_name_here
Things done
[x] Test in production
[x] Nixos test for this stuff
[ ] Release notes update