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
systemd and packaging (RPM) improvments from discussion in #213 #212
Closed
Closed
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e741014
switch systemd unit type from forking to simple
remicollet aa9122c
Improve systemd dependencies
remicollet 575d6d4
Drop /etc/sysconfig/unit configuration file for systemd distributions
remicollet b0fe828
move log to dedicated directory
remicollet 9eedfb9
move unit.pid and control.sock to /var/run/unit
remicollet 2dc791b
use --control option instead of build options
remicollet 11a49d6
minor cleanup, duplicated BR
remicollet f8057cc
Revert "use --control option instead of build options"
remicollet d6ad732
rename /etc/sysconfig/unit to unitd as in service script
remicollet 1dcab35
missing BR (not more installed in default buildroot, since F29)
remicollet 79c6b00
provide logrotate configuration
remicollet File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
# Modifying this file in-place is not recommended, because changes | ||
# will be overwritten during package upgrades. To customize the | ||
# behaviour, run "systemctl edit unit" to create an override unit. | ||
|
||
# For example, to change options given to the unitd binary at startup, | ||
# create an override unit (as is done by systemctl edit) and enter | ||
# the following: | ||
|
||
# [Service] | ||
# Environment="UNITD_OPTIONS=--control unix:/run/unit/control.sock --log /var/log/unit/unit.log --pid /run/unit/unit.pid" | ||
|
||
[Unit] | ||
Description=NGINX Unit | ||
Wants=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=forking | ||
PIDFile=/run/unit.pid | ||
EnvironmentFile=-/etc/sysconfig/unit | ||
ExecStart=/usr/sbin/unitd $UNITD_OPTIONS | ||
Type=simple | ||
Environment="UNITD_OPTIONS=--control unix:/run/unit/control.sock --log /var/log/unit/unit.log --pid /run/unit/unit.pid" | ||
ExecStart=/usr/sbin/unitd $UNITD_OPTIONS --no-daemon | ||
ExecReload= | ||
RuntimeDirectory=unit | ||
RuntimeDirectoryMode=0755 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
UNITD_OPTIONS="--log /var/log/unit.log --pid /run/unit.pid" | ||
UNITD_OPTIONS="--control unix:/var/run/unit/control.sock --log /var/log/unit/unit.log --pid /var/run/unit/unit.pid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# distribution specific definitions | ||
%define use_systemd (0%{?rhel} && 0%{?rhel} >= 7) || (0%{?suse_version} >= 1315) | ||
%define use_systemd (0%{?rhel} >= 7 || 0%{?fedora} >= 19 || 0%{?suse_version} >= 1315) | ||
%define bdir %{_builddir}/%{name}-%{version} | ||
%define dotests 0 | ||
|
||
|
@@ -8,18 +8,24 @@ Requires: initscripts >= 8.36 | |
BuildRequires: openssl-devel | ||
%endif | ||
|
||
%if 0%{?rhel} == 7 | ||
Requires: systemd | ||
BuildRequires: systemd-units | ||
%if %{use_systemd} | ||
BuildRequires: systemd | ||
Requires(post): systemd | ||
Requires(preun): systemd | ||
Requires(postun): systemd | ||
%endif | ||
|
||
%if 0%{?rhel}%{?fedora} | ||
BuildRequires: openssl-devel | ||
%endif | ||
|
||
%if 0%{?rhel} | ||
%if 0%{?amzn} == 0 | ||
%define dist .el7 | ||
%define dist .el%{?rhel} | ||
%endif | ||
%endif | ||
|
||
%if 0%{?suse_version} >= 1315 | ||
BuildRequires: systemd | ||
Requires: systemd | ||
BuildRequires: libopenssl-devel | ||
%endif | ||
|
||
|
@@ -103,9 +109,13 @@ DESTDIR=%{buildroot} make unitd-install libunit-install | |
%{__mkdir} -p %{buildroot}%{_libdir}/unit/modules | ||
%{__mkdir} -p %{buildroot}%{_libdir}/unit/debug-modules | ||
%{__mkdir} -p %{buildroot}%{_sharedstatedir}/unit | ||
%{__mkdir} -p %{buildroot}%{_localstatedir}/log/unit | ||
%{__mkdir} -p %{buildroot}%{_localstatedir}/run/unit | ||
%if ! %{use_systemd} | ||
%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig | ||
%{__install} -m 644 -p %{SOURCE3} \ | ||
%{buildroot}%{_sysconfdir}/sysconfig/unit | ||
%endif | ||
%{__mkdir} -p %{buildroot}%{_sysconfdir}/unit | ||
%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit/examples | ||
%{__install} -m 644 -p %{SOURCE4} \ | ||
|
@@ -185,18 +195,21 @@ fi | |
%defattr(-,root,root,-) | ||
%attr(0755,root,root) %{_sbindir}/unitd | ||
%attr(0755,root,root) %{_sbindir}/unitd-debug | ||
%config(noreplace) %{_sysconfdir}/sysconfig/unit | ||
%dir %{_sysconfdir}/unit | ||
%if %{use_systemd} | ||
%{_unitdir}/unit.service | ||
%dir %attr(0755,root,root) %ghost %{_localstatedir}/run/unit | ||
%else | ||
%config(noreplace) %{_sysconfdir}/sysconfig/unit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @remicollet it seems like this one is mistakenly reverted here from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nop, simply move lower (to avoid multiple conditions) |
||
%dir %attr(0755,root,root) %{_localstatedir}/run/unit | ||
%{_initrddir}/unit | ||
%endif | ||
%dir %{_datadir}/doc/unit | ||
%{_datadir}/doc/unit/* | ||
%dir %{_libdir}/unit/modules | ||
%dir %{_libdir}/unit/debug-modules | ||
%dir %{_sharedstatedir}/unit | ||
%dir %attr(0700,root,root) %{_localstatedir}/log/unit | ||
|
||
%files devel | ||
%{_libdir}/libunit.a | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ghosted directory is enough, will be created during service startup by systemd