-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Use systemd-tmpfiles to handle required directories at runtime when possible. #21243
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
base: master
Are you sure you want to change the base?
Conversation
This pushes handling of permissions and ownership of our required directories to systemd-tmpfiles when possible, which helps persistently ensure that they are correct, and allows us to make at least some Netdata service files both simpler and more reliable.
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.
Pull Request Overview
This PR adds systemd tmpfiles.d configuration support to automate the creation of runtime directories for Netdata. Instead of manually creating and setting permissions on directories at startup, the system leverages systemd-tmpfiles to handle directory creation with proper ownership and permissions.
Key Changes:
- Introduced a new tmpfiles.d configuration file (
tmpfiles.conf.in) that defines directory creation rules for/run/netdata, cache, lib, and log directories - Updated systemd service files to depend on
systemd-tmpfiles-setup.service - Modified installation scripts to use
systemd-tmpfiles --createwhen available, with fallback to manual directory creation
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| system/systemd/tmpfiles.conf.in | New tmpfiles.d configuration defining directory creation rules |
| system/systemd/netdata.service.v235.in | Added dependency on systemd-tmpfiles-setup.service |
| system/systemd/netdata.service.in | Added tmpfiles dependency and removed manual directory creation commands |
| system/openrc/init.d/netdata.in | Added systemd-tmpfiles-setup dependency for OpenRC |
| packaging/makeself/install-or-update.sh | Integrated tmpfiles installation with fallback to manual chown |
| packaging/installer/netdata-uninstaller.sh | Added cleanup of tmpfiles.d configuration |
| packaging/installer/functions.sh | Added install_netdata_tmpfiles function |
| netdata.spec.in | Added tmpfiles.d configuration to RPM package |
| netdata-installer.sh | Replaced manual directory creation with tmpfiles approach |
| CMakeLists.txt | Configured and installed tmpfiles.d configuration file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This adds new entries for the cloud.d and registry directories to be created, as well as adding entries to apply correct permissions and ownership for database files, claiming configuration, and a handful of other files.
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.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
The PR was tested in the following scenarios:
- Debian package (Ubuntu 20.04)
- RPMs (CentOS 9 Stream)
- Compilation from scratch (Slackware Linux)
In all scenarios files were present with correct permission. LGTM!
Summary
This pushes handling of permissions and ownership of our required directories to systemd-tmpfiles when possible, which helps persistently ensure that they are correct, and allows us to make at least some Netdata service files both simpler and more reliable.
Test Plan
Requires manual testing on systemd systems.