Skip to content

Conversation

@carlwgeorge
Copy link
Contributor

@carlwgeorge carlwgeorge commented Mar 12, 2021

Initial sd_notify support was added in #3963, but that sent signals from both cmdRun and cmdReload. This approach has two drawbacks:

  • Reloads initiated via the API do not send signals.
  • The signals are sent from different processes, which requires the NotifyAccess=exec directive in the unit file.

This change moves the NotifyReloading and NotifyReadiness invocations to Load, which address both of those drawbacks. It also adds a complimentary NotifyStopping method which is invoked from handleStop. All the notify methods are defined in a notify package to avoid an import loop.

@carlwgeorge carlwgeorge force-pushed the notify-reload-from-run branch 4 times, most recently from f9d889f to ceda5c5 Compare March 12, 2021 17:10
@francislavoie francislavoie added this to the v2.4.0 milestone Mar 13, 2021
@francislavoie francislavoie added the under review 🧐 Review is pending before merging label Mar 13, 2021
@francislavoie
Copy link
Member

I think this looks good now!

@francislavoie
Copy link
Member

https://github.com/carlwgeorge/caddy/blob/f559bb10f64e09e4462591f841a14a2aed0f994d/notify/notify_linux.go#L45 has a typo that #4081 aims to fix, would you mind making the change in here (to avoid the conflict)?

Initial sd_notify support was added in caddyserver#3963, but that sent signals from
both cmdRun and cmdReload.  This approach has two drawbacks:

- Reloads initiated via the API do not send signals.
- The signals are sent from different processes, which requires the
  `NotifyAccess=exec` directive in the unit file.

This change moves the NotifyReloading and NotifyReadiness invocations to
Load, which address both of those drawbacks.  It also adds a
complimentary NotifyStopping method which is invoked from handleStop.
All the notify methods are defined in a notify package to avoid an
import loop.
@carlwgeorge carlwgeorge force-pushed the notify-reload-from-run branch from f559bb1 to d183366 Compare March 22, 2021 15:53
@carlwgeorge
Copy link
Contributor Author

Sure thing, added that typo fix and went ahead and rebased on master.

@francislavoie francislavoie changed the title Send all sd_notify signals from main caddy process notify: Send all sd_notify signals from main caddy process Mar 22, 2021
Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@rumpelsepp Do you have any thoughts about this?

@rumpelsepp
Copy link
Contributor

These adjustments make sense, I would say. 👍

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Great, thank you very much for the enhancement.

@mholt mholt merged commit 45fb720 into caddyserver:master Apr 5, 2021
@mholt mholt removed the under review 🧐 Review is pending before merging label Apr 5, 2021
@carlwgeorge carlwgeorge deleted the notify-reload-from-run branch September 3, 2022 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants