-
Notifications
You must be signed in to change notification settings - Fork 100
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
Replace spawn-fcgi by systemd socket for wwsympa/sympasoap #799
Comments
Firstly, I think, you'd be better to prove the new method you propose will work properly. If it was proven, your new method may be added to the administrator manual. Older methods should be left so that compatibility to existing environments will be kept. May I transfer this issue to sympa-community.github.io? |
The only proof I can provide for now is a sympa 6.2.48 web interface running over httpd on Fedora 30 installed from RPM works after replacing the stock wwsympa service unit file with the above service and socket unit files. Afaik, there is no incompatibility involved in switching from spawn-cgi to systemd socket, the httpd conf file nor anything else beside the unit files did not need to be altered. About the documentation, while I agree it is important, the systemd units are parts of the code and are generated from templates when building sympa (fcgi and socket path depend on the parameters passed to configure, socket owner/group depends on the webserver used). Imho, there's no reason to write said documentation before the implementation part has been discussed first. My starting point is spawn-fcgi is not needed when using systemd. Specifically, in the case I'm interest in, it is not available for CentOS 8 and will not be. Also, spawn-fcgi is mostly dead upstream, so sympa better not depend on unmaintained code, especially when there is maintained code that serves the same purpose. Actually, spawn-fcgi is likely doomed to disappear from any systemd based distro sooner or later. |
In this way, we will be able to introduce users to new installation/packaging method. Thus, in the first place, you would be better to implement new method for EL8 RPM (step 1. in above) at first. You will not necessarily have to work for subsequent steps. I'll check your unit files for a while. One of my concern is whether these units support automatic restart: The wwsympa.fcgi itself terminates not only when it crashes but also when the executable files has been updafted. |
Actually, I'm in no hurry for getting sympa running on EL8 for my own purpose. I'm working on this because I fell there is a need for sympa itself to be easily available on RHEL/CentOS 8. And there was already someone that requested it actually, both directly to me and in a sympa issue. My assessment of the situation is spawn-fcgi is both not needed and dead upstream, and thus must be replaced by systemd socket. Be it for EL8 or any other systemd-based distro. However, before engaging with such a downstream change, I'd rather have upstream at the very least know about what I will be doing and why I will be doing it. At best, I expect upstream to acknowledge the change and help toward making this change as robust and transparent to users as possible, before it even has a chance to reach any end-user. I'm in no way disagreeing with the steps you are proposing. This definitely is the way I'd like it to be done, but with one difference. I'd rather see upstream sympa host the socket-based unit files for anyone to use if they see fit, than keep them in the Fedora/EPEL garden. About automatic restart, that is a very valid concern. I think the service unit would need to have either |
Quick question: does systemd socket system allows to have more than one wwsympa.fcgi processus running? Because on heavily used Sympa, you may need more than one processus to handle requests. |
@ldidry Yes it does. Proof of Concept: sympa-community/sympa-ansible#61 |
@racke For what I see, it would create multiple sockets ( |
Apache: Using
|
Systemd: Single socket with multiplexer: Using
|
Sounds good to me, let me try that in Ansible. Thanks @ikedas |
Pushing |
Hi! @xavierba We have exchanged some emails a few weeks ago regarding this. What is the status on this issue? I actually have a bunch of RHEL8 (not centos) machines ready for just this purpose right now. @ikedas Is the multiwatch solution still viable? And if so, @xavierba can we push it to the fedora project? I am also a packager there (although rather inactive right now) if you need help for a review. Benjamin |
@BenjaminLefoul if you are happy with what is in my COPR repo [1], that is the conf still using spawn-fcgi, then I can indeed make a real EPEL8 build. [1] https://copr.fedorainfracloud.org/coprs/xavierb/sympa-beta/package/sympa/ |
Hi @BenjaminLefoul , I drafted an instruction using Systemd socket. See sympa-community/sympa-community.github.io#58. If possible, could you please check if it works as expected? |
@xavierba Wouldn't it be easier to start using sockets (and multiwatch?) as soon as possible so we don't have to worry about maintaining spawn-fcgi (and multiwatch) for the rest of rhel8s life? |
And how about a wwsympa@.socket file?
And then use |
Okay how about a systemd target file to allow several wwsympa.fcgi processes on a single socket file, without multiwatch?
And for another webserver:
|
If you think such setting may be useful, please draft instruction for that setting and submit it here. On the other hand, I thought the setting with socket and multiwatch is useful, drafted instruction for that setting and submitted it. Couldn’t you review it?
I don’t know if it works with Apache, lighttpd and the others. Please investigate and, if possible, include it to the instruction you will author! |
Well it would have been nice not having to push and maintain a new package to the Fedora project. I don't know how far @xavierba went with the multiwatch RPM But if all we need are 5 parallel wwsympa.fcgi processes which can try to respawn when they crash and use the same socket, then the systemd solution I described in my last post should be enough. What do you think? |
TMTOWTDI. I submitted what I experienced to share it with the community. Why don’t you submit what you could share with the community? |
@BenjaminLefoul multiwatch rpm is available in my sympa-beta corp repo (for Fedora and EL7/EL8) if you want to give it a try. |
Let me try to recap:
Do we want to support both the single instance mode and multiple instances mode ? Also, the socket(s) need(s) to be owned by the webserver that will be using it/them, so this needs to be properly set out of the box or configurable.
Let me know if I have missed anything and what are your preferred choices from the above. Edit: One cannot use an environment variable and feed it to |
Thanks, @xavierba I have now tested with apache on RHEL8 with both spawn-fcgi and multiwatch. Both work (I can get the web interface). For multiwatch I used @ikedas unit files, changing only the multiwatch path from /usr/local[...] to /usr/bin/multiwatch, and only starting the socket with user "apache" (which in turns starts the wwsympa service). Note that for either case, I had to do a slight SELinux tweak (if you run targeted on the standard red hat policy enforced): /var/run/sympa/wwsympa.socket needs to have target label httpd_var_run_t
I have not tested nginx or lighttpd, but it should be okay when it comes to SELinux (both use the same entrypoint apache does: httpd_exec_t) I have not tested multiwatch on Fedora, but we could start by pushing to EPEL8? Edit: ok, multiwatch works on Fedora 31, but it needs another SElinux refinement (connectto). I simply used this:
|
@xavierba wrote:
IMO, on RPM (Fedora/EPEL), we may support only multiple instances: The greater will serve for the lesser.
My preference is overriding |
@ikedas thanks for your answers. Actually, that is what I have implemented in my test specfile. I have yet to look at lighttpd, which seems to handle the socket on its own and not with spawn-fcgi. I don't know much about lighttpd, that why I kept it for later. However, the questions were actually more targeted at sympa devs in order to propose a PR.
@racke, @ldidry, it would be great to have your opinion too. |
@racke I have some stuff more or less ready to be used allowing to easily tune the number of instances for both sympa itself and the soap server. I will post it tomorrow when I'm in front of my computer rather than on a phone. |
Here are the relevant commits, which include some new systemd unit files
One can set the number of wws and soap instances through the WWS_FCGI_CHILDREN and SOAP_FCGI_CHILDREN envvars in /etc/sysconfig/sympa (which would be /etc/default/sympa in Debian), with a default of 5 instances for both. I welcome any feedback on this and would be happy to help getting this integrated into upstream sympa. |
Yes, I took a similar approach. However I set the default for SOAP to 2. I will align the variable names with yours and check about other differences. Debian uses www-data as user for Nginx and Apache, so I can hardcode that. |
It was the same FCGI_CHILDREN setting for both WWS and SOAP and set to 5 before, so I used that for both, but I guess it makes sense to reduce the number of SOAP instances to only 2. |
Yes, in the rare case someone really uses SOAP frequently it can be increased to more than too, but I think 2 is a better default setting. |
@racke: What do you think about this ? Does that match what you've done for Debian ? The default webserver user is set to |
I've compared the unit files in my tree with what's in Debian 12 package and taken the service/socket descriptions which were better. The different web server user is already addressed in my tree through a configure option. The only meaningful difference seems to be I have
while Debian has
in both the web interface and soap service units. @racke, why |
@xavierba, I actually don't recall that. |
@racke what about Also, would you have a suggestion for a configure option name to accommodate for |
|
Sorry for delayed comment. On sympa-6.2...xavierba:systemd_socket Is I suppose (I've not confirmed yet, though) this can be achieved in either of the following ways. (A) Fill the
and add a file
then start (or reload) the unit. (B) Rename
and, start this unit by
thus I'll confirm these in a few days. |
|
I confirmed.
|
The idea behind the configure option is to provide a way to generate unit files that are tailored to the target distribution. (eg. Debian will use |
I understand that My suggestion is that, instead of new configure option. we'd be better to handle web server users according to the systemd specification: Run
[EDIT] The second way (
Similar suggestion: Handle
n.b.: Since each unit doesn't share the namespace of environment, the same name My suggestions may not be elegant, but they require fewer modifications to our code base. [EDIT] See also: "Editing provided units". |
More on
|
If there are no objection to the PR above, it may be merged. |
In the light of your comment, I guess However, I find the solution to have a configure option for the webserver user to be more elegant than using override files. Admittedly, that doesn't change much for rpm/deb packages which will still have to provide an override file to be able to ship support for several webservers. However, someone building and installing from source will have an additional configuration step to tackle. |
I think in the near future we could rather abandon spawn-fcgi support --- in fact, units for two different methods aren't needed --- and allow multiwatch units to be installed. BTW if that happens, "an additional configuration step to tackle" for people would be to put the override files in place. I feel this would be as simple as specifying an additional configure option at build time. In any case, there would be no need to implement new options right now. |
If no objection to keeping both methods with systemd for now, I'll merge the PR above. |
Having both the spawn-fcgi and multiwatch based unit files is fine by me. Actually, having both installed as well would be fine too, one can enable either one depending on its own preferences, but that can be done in a different commit/PR. And then dropping spawn-fcgi could be done in yet another commit/PR. |
Do you mean the former is required for EPEL7 package you maintain? (EPEL8/9 will adopt the latter.) If you do, you may include a unit file specific to EL7 by your own into the RPM source. In below I'll write why.
There are no preferences. Since the method with spawn-fcgi occationally caused problems, so alternative method had been sought. With the method with multiwatch, no problems have been reported so far. After all, in terms of keeping things simple, the Systemd units with multiwatch is the current best practice for Linux with systemd support, I believe. Reality is not so simple. In reality, old configuration files per distribution (e.g. files in /etc/sysconfig or /etc/default) have to be supported for backward compatibility, for example. Moreover, this is only the case for some variants of many Linux distributions. It is not practical for us to add support for all other distributions --- Gentoo Linux, FreeBSD, macOS, ... --- to the source distribution. To solve problem, I think that Sympa itself may only provide interfaces to other components. In fact, Sympa provides a pipe interface for MTAs and a FastCGI interface for HTTP servers. Extremely say, there is no need to include anything else in Sympa source distribution. Configurations for each OS distribution can be provided in separate project(s). I understand that one of the purposes of the assets repository was It could include the actual configuration files for the methods adopted by individual distributions, as well as those that were not adopted.
Honestly, as for the Systemd unit included in the source tarball, I believe that only the simplest (without EnvironmentFile) one with multiwatch is needed. That is, I prefer not to include actual unit files specific to EL8/9 (also EL7, Debian, ...). Sorry for long comment. |
No, I mean it doesn't hurt to have both. One has to choose which method he wants to use.
I suggested to keep both to ease transition, but this should indeed only be temporary. Remember, I was the one who first suggested to add support for systemd sockets rather than relying on spawn-fcgi to create the socket ;-)
Agreed.
I have no specific knowledge about anything beside SysVInit/systemd or too old to be really useful.
One of the point with systemd is to reduce distributions fragmentation. Indeed, that does not solve everything at once, like the /etc/default vs /etc/sysconfig difference, but having both supported in the unit files is not a huge burden to carry in upstream sympa. Writing unit files is not such an easy task and can have some subtleties. See the part of the above discussion about Restart=OnFailure vs Restart=Always. So I strongly think there is value in shipping unit files. And there would also be value in installing the unit files, rather than have people manually copy the files at the proper location. I believe systemd is the most used init system, so let's at least make it easy for a majority of people, while not making it any more difficult for people using anything else.
No worries :-) |
I agree to the last sentence. However, "upstream" necessarily does not mean the source distribution of Sympa itself. There is no need to cram everything into one tarball.
The issue with the I think that there is no need for Sympa itself to have a role that encompasses all of such "fragmentations". Such a role should be taken up by separate project. I suggest the use of an assets repository. |
Apparently, my explanation seems not understood. I will merge the current PR. However at first I have to update the description about Systemd support in the manual. |
Expected Behavior
On systems using systemd, there is no need to use spawn-fcgi to create the listening socket for wwsympa/sympasoap.
Current Behavior
The wwsympa/sympasoap systemd units are using spawn-fcgi.
Possible Solution
Provide wwsympa.socket/sympasoap.socket and modify wwsympa.service/sympasoap.service to make use of it.
Here are some example units for running wwsympa with httpd on Fedora/CentOS7+.
This is just a quick hack, it needs to be discussed and fine-tuned before a proper PR can be submitted.
wwwsympa.socket:
wwsympa.service:
Context
spawn-fcgi is currently not available for RHEL/CentOS 8. While looking at adding it to EPEL 8, I found out it is not needed at all.
The text was updated successfully, but these errors were encountered: