-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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/gitlab: ensure service started again after dependency restarts #245240
nixos/gitlab: ensure service started again after dependency restarts #245240
Conversation
When a dependency, like postgresql.service or redis-gitlab.service, had been stopped and started at switch-to-configuration time, gitlab.service and its helper units had been stopped but not started again. `multi-user.target` only has a `Wants` relation to gitlab.target, but once gitlab.target has been successfully started once and is not stopped/ restarted again, it does not cause all its dependencies to stay activated the whole time. This commit fixes this by upgrading the dependy relationship of gitlab.service towards gitlab.target from a "Wants" to a "Requires". It should be enough to do this for this single unit part of gitlab.target only, as all other units wantedBy gitlab.target are pulled in by gitlab.service as well or have bindsTo relations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this issue has been bugging me for a while, but I never got around to looking for the issue. thanks for fixing this 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good to me. Thank you for figuring it out ❤️
Successfully created backport PR for |
Upstreaming of flyingcircusio/fc-nixos#707 which is running fine in production for several months now.
Description of changes
When a dependency, like postgresql.service or redis-gitlab.service, had been stopped and started at switch-to-configuration time, gitlab.service and its helper units had been stopped but not started again:
gitlab.service
has aBindsTo=postgresql.service
dependency. This means, that it gets stopped when its dependency service postgresql is stopped. But there is no dependency pulling it back to be started again.multi-user.target
only has aWants
relation to gitlab.target, but once gitlab.target has been successfully started once and is not stopped/ restarted again, it does not cause all its dependencies to stay activated the whole time.This commit fixes this by upgrading the dependy relationship of gitlab.service towards gitlab.target from a "Wants" to a "Requires". It should be enough to do this for this single unit part of gitlab.target only, as all other units wantedBy gitlab.target are pulled in by gitlab.service as well or have bindsTo relations.
Let me know whether I shall add test coverage for the case of dependency stop and start. Constructing a case where a dependency is stopped and started can certainly be done in a NixOS VM test, but I'd like to know whether such an additional test case is desired before approaching thos and potentially blowing up the test runtime any further.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)