[go: nahoru, domu]

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

Support systemd notify protocol #17062

Merged
merged 1 commit into from
May 2, 2023
Merged

Conversation

WGH-
Copy link
Contributor
@WGH- WGH- commented Apr 21, 2023

Description

Add support for systemd notification protocol (https://www.freedesktop.org/software/systemd/man/sd_notify.html)

Motivation and Context

This will allow to set Type=notify in systemd service.

Thanks to this, systemctl start will actually wait for the ready notification instead of exiting when process has just started.

This will also allow to use After=minio.service for proper startup ordering. If some other service depends on MinIO, it will wait until MinIO is actually up and listening on its port.

Unfortunately, Server.Serve function has some additional setup going on instead of just launching serving goroutines, so in some cases systemd may report success with MinIO failing shortly after. Thankfully, listening sockets are still bound before, so proper startup ordering will still be achieved.

"Stopping" notification is mostly decorative, and will be reported in systemctl status.

If not running under systemd, or running without Type=notify, these changes have no effect.

How to test this PR?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

Copy link
Member
@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

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

This needs more than what is being done in the PR @WGH- are you intending to add more things here?

@WGH-
Copy link
Contributor Author
WGH- commented Apr 21, 2023 via email

cmd/signals.go Outdated Show resolved Hide resolved
This will allow to set Type=notify in systemd service.

Thanks to this, 'systemctl start' will actually wait for
the ready notification instead of exiting when process has just
started.

This will also allow to use After=minio.service for proper
startup ordering. If some other service depends on MinIO,
it will wait until MinIO is actually up and listening on its port.

Unfortunately, `Server.Serve` has some additional setup going on
instead of just launching serving goroutines, so in some cases systemd
may report success with MinIO failing shortly after. Thankfully,
listening sockets are still bound before, so proper startup ordering
will still be achieved.

"Stopping" and "reloading" notifications are mostly decorative,
and will be reported in 'systemctl status'.

If not running under systemd, or running without Type=notify,
these changes have no effect.
@harshavardhana harshavardhana requested a review from krisis May 1, 2023 19:12
@harshavardhana harshavardhana merged commit ab34f00 into minio:master May 2, 2023
WGH- added a commit to WGH-/minio-service that referenced this pull request May 2, 2023
This tells systemd that minio supports startup notification protocol,
and will wait until it tells it's ready before launching dependent
(After=) services.

See minio/minio#17062
WGH- added a commit to WGH-/minio-service that referenced this pull request May 3, 2023
This tells systemd that minio supports startup notification protocol,
and will wait until it tells it's ready before launching dependent
(After=) services.

See minio/minio#17062
harshavardhana pushed a commit to minio/minio-service that referenced this pull request May 3, 2023
This tells systemd that minio supports startup notification protocol,
and will wait until it tells it's ready before launching dependent
(After=) services.

See minio/minio#17062
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.

3 participants