-
Notifications
You must be signed in to change notification settings - Fork 103
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
upgrade watchdog service to scheduled task #1951
Conversation
// RunWatchdogTask is typically run as a check to determine the health of launcher and restart if required. | ||
// it is installed as an exec action via windows scheduled task. e.g. C:\path\to\launcher.exe watchdog -config <path>. | ||
// you can alternatively run this subcommand to install or remove the scheduled task via the --install-task or --remove-task flags | ||
func RunWatchdogTask(systemSlogger *multislogger.MultiSlogger, args []string) error { |
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.
note that this file was renamed and looks new but most of what has changed here is just the options parsing logic. the rest is a much simpler version (no power event watching, no polling) of what the service version did before
…ations and cleanup
189035c
to
7af2d45
Compare
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.
LGTM overall, just a couple questions
binDirBase = fmt.Sprintf(`C:\Program Files\Kolide\Launcher-%s\bin`, identifier) | ||
launcherExeName = "launcher.exe" | ||
default: | ||
binDirBase = fmt.Sprintf(`/usr/local/%s/bin`, identifier) |
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.
Ahhh can you throw a quick comment here or in the docblock that this won't work for NixOS, just so we don't forget if we try to use it for Linux in the future?
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.
ahh yep! or do you think it make more sense to just add this to pkg_utils_windows.go
? it is only in use for these windows tasks currently
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.
added a comment but happy to move this over if you think that's more appropriate
…alLauncherExecutablePath
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.
LGTM! 🔥
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.
Thank you for documenting so well 🔥
The current watchdog implementation installs a lightweight service to periodically check the launcher's service state, and restart if required. The main issue we've found with this in testing is that this service is subject to many of the same power management/sleep state transitions issues that impact the launcher service itself.
These changes alter this pattern to instead utilize a short-lived task that will perform the same state checking and restarts, driven instead by the windows task scheduler service. This is beneficial for a few reasons:
We still make use of much of the same log buffering, service restart, and controller + flag logic that was initially added for watchdog. This primarily includes the following changes:
--install-task
and--remove-task
options to the watchdog subcommand, this was something I had wanted for the original watchdog and it should allow us to easily install or remove on demand while testing