Bug 1740030 - systemd service unit needs dependencies on socket unit file
Summary: systemd service unit needs dependencies on socket unit file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: fcgiwrap
Version: 29
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Andrew Bauer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-12 06:52 UTC by Kenneth Porter
Modified: 2019-10-21 16:14 UTC (History)
1 user (show)

Fixed In Version: fcgiwrap-1.1.0-12.20181108git99c942c.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-21 16:14:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Example changes needed for service unit file (529 bytes, patch)
2019-08-12 06:52 UTC, Kenneth Porter
no flags Details | Diff

Description Kenneth Porter 2019-08-12 06:52:18 UTC
Created attachment 1602737 [details]
Example changes needed for service unit file

To get the socket to install automatically together with the service, I needed to add additional dependency directives to the .service file.

The attachment shows the edits I needed for the [Unit] and [Install] section to make the socket start when I started the service and to enable the socket unit when I enabled the service.

(I'm using this with CentOS 7 (based on RHEL7) which has a buggy "systemctl enable" command when used with templates, so I needed to manually copy the templates to /etc/systemd/system and expand the %i macro manually.)

Comment 1 Andrew Bauer 2019-08-12 15:45:38 UTC
Yeah, the version of systemd on CentOS 7 is not quite as trouble free as the newer versions found on Fedora.

However, this package was built with the intention of letting the socket auto spawn the service. You should not need to enable the service itself.

See the systemd socket documentation:
https://www.freedesktop.org/software/systemd/man/systemd.socket.html

A socket automagically starts it's service with the same name, and it appears to do so even on CentOS 7.


Just to make sure nothing changed since the last time I tested this, I blew the dust off my CentOS 7 vm.

This is what I did:
> sudo yum install fcgiwrap
> systemctl enable fcgiwrap
> systemctl start fcgiwrap

Observed the socket was started:
> $ systemctl status fcgiwrap
> ● fcgiwrap - fcgiwrap Socket
>    Loaded: loaded (/usr/lib/systemd/system/fcgiwrap@.socket; enabled; vendor preset: disabled)
>    Active: active (running) since Mon 2019-08-12 09:50:15 CDT; 50min ago
>    Listen: /run/fcgiwrap/fcgiwrap-nginx.sock (Stream)

> Aug 12 09:50:15 vcentos systemd[1]: Starting fcgiwrap Socket.
> Aug 12 09:50:15 vcentos systemd[1]: Listening on fcgiwrap Socket.

Observed the service had NOT started yet:
> $ systemctl status fcgiwrap
> ● fcgiwrap - Simple CGI Server
>    Loaded: loaded (/usr/lib/systemd/system/fcgiwrap@.service; bad; vendor preset: disabled)
>    Active: inactive (dead)

I then tested my application with nginx, zoneminder, which streamed video from the web console as expected.

Observed the service had started automatically:
> $ systemctl status fcgiwrap
> ● fcgiwrap - Simple CGI Server
>    Loaded: loaded (/usr/lib/systemd/system/fcgiwrap@.service; bad; vendor preset: disabled)
>    Active: active (running) since Mon 2019-08-12 10:18:38 CDT; 22min ago
>  Main PID: 14214 (fcgiwrap)
>    CGroup: /system.slice/system-fcgiwrap.slice/fcgiwrap
>            └─14214 /usr/sbin/fcgiwrap -f -c 1

> Aug 12 10:18:38 vcentos systemd[1]: Started Simple CGI Server.


I see the SETUP file included with the package incorrectly states to enable the service, rather than the socket. I can update that.

Comment 2 Kenneth Porter 2019-08-13 08:36:27 UTC
Thanks. I removed my edited unit files and issued your commands and the system is working as expected. So it's just a documentation bug and my inexperience with systemd's socket-initiated services.

Comment 3 Fedora Update System 2019-10-06 17:52:29 UTC
FEDORA-EPEL-2019-f2e04e2289 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-f2e04e2289

Comment 4 Fedora Update System 2019-10-07 00:21:07 UTC
fcgiwrap-1.1.0-12.20181108git99c942c.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-f2e04e2289

Comment 5 Kenneth Porter 2019-10-07 01:35:14 UTC
The new text in the SETUP file looks good. I'm blessing this as a fix. (Did anything else change? I pulled the SRPM to inspect the documentation.)

Comment 6 Andrew Bauer 2019-10-07 12:12:57 UTC
No, nothing else needed changing. Now I am in a holding pattern until the fcgi package maintainer builds fcgi package for el8.

Comment 7 Fedora Update System 2019-10-21 16:14:38 UTC
fcgiwrap-1.1.0-12.20181108git99c942c.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.