Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#40322 - [nginx] [.service] Integrate better with systemd and journald
Attached to Project:
Arch Linux
Opened by ajskhfkjdg (ajskhfkjdg) - Monday, 12 May 2014, 12:40 GMT
Last edited by Sébastien Luttringer (seblu) - Monday, 02 June 2014, 21:22 GMT
Opened by ajskhfkjdg (ajskhfkjdg) - Monday, 12 May 2014, 12:40 GMT
Last edited by Sébastien Luttringer (seblu) - Monday, 02 June 2014, 21:22 GMT
|
Details* Remove After=syslog.target (deprecated and unnecessary)
* "master_process on" is already the default, remove it * Use "daemon off", Type=simple * "error_log stderr", SyslogLevelPrefix=off, SyslogLevel=err so errors land in journald * Simplify ExecReload * Instead of "ExitStop=... -s quit", use KillSignal=SIGQUIT, KillMode=mixed directly * Remove PrivateDevices=yes, which always causes "Failed at step NAMESPACE spawning /usr/bin/nginx: Invalid argument" for me |
This task depends upon
Closed by Sébastien Luttringer (seblu)
Monday, 02 June 2014, 21:22 GMT
Reason for closing: Implemented
Additional comments about closing: 1.6.0-4
Monday, 02 June 2014, 21:22 GMT
Reason for closing: Implemented
Additional comments about closing: 1.6.0-4
nginx.service
* Replace Restart=always with a more measured Restart=on-abort
* Removed SyslogLevelPrefix=off. I feared that a remotely supplied string could set the syslog level, but that's impossible because of the way ngx_log_error_core() structures the messages.
The free version of nginx does not seem to support syslog at all: http://nginx.org/en/docs/ngx_core_module.html says "Logging to syslog is available as part of our commercial subscription." But this does not a apply to error_log, which can log to file descriptor 2.
As to access_log (which cannot use an fd, go figure...), I hack it into journald using a second .service:
mkfifo /var/log/nginx/access.log
systemctl enable nginx-access
journalctl -f --unit nginx-access
(And while we're at it, my reasoning for removing the ExecStartPre config check is that it would only make sense as a hypothetical ExecRestartPre. As it stands right now, "systemctl restart nginx" checks the config *after* stopping nginx...)
Using Type=daemon and PID file allow correct nginx startup detection, as nginx doesn't support Type=nofify or Type=dbus.
PrivateDevices is indeed causing more trouble that I expected and I'm likely to revert it and set PrivateTmp instead. I plan to simplify ExecStartPre to something like /usr/sbin/nginx -t and ExecStart to /usr/sbin/nginx. We can handle ExecReload and ExecStop by sending HUP and QUIT signals respectively.
FS#39873.Do these tools parse the *error*_log? Because that's what would be redirected into journald. (nginx-access.service wasn't really intended to be packaged, just for context.)
ExecStartPre AFAIK only makes sense to initialize something, or to run a configuration check that the daemon itself neglects to do. Neither applies to nginx. If systemd ever implements ExecRestartPre, that would be the right place for nginx -t.
@Daniel:
I'm not 100% sure if my kernel is to blame. It's actually the Arch Linux ARM linux-am33x-3.14.1-1 package, which of course is unsupported from the point of view of Arch Linux proper, but it has all the relevant CONFIG_*_NS=y options.
one suggestion wasn't applied:
Type=simple
with 'daemon off'
nginx-1.6.0-3 dont' start properly if
Type=forking
is used with 'daemon off' in nginx.service, it simply fails without any valuable information ('systemctl status nginx' or 'journalctl -xn' don't give any hint). I changed nginx.service as it was suggested:
Type=simple
with 'daemon off'
and nginx starts fine.