-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
FCGIwrap Overhaul: Unified Socket Activation #919
Comments
I'll test this tonight on software.virtualmin.com, so we can see if maybe it resolves the "hanging" issue we've seen with the old long-running service. It looks great. |
Great! Thanks, Joe! That will be really helpful! |
As we just discovered with Joe, these file names will conflict with the packaged version of Also, Jamie, why didn’t we use |
Oh this is very interesting, I didn't realize that templeatable systemd services could exist! But does this still mean that we need to create a socket for each domain, and also a per-domain fcgiwrap@$user.socket service for each domain? Also, is the advantage of this over the current approach that the fcgiwrap server only gets launched when it is needed? |
You don't create anything. You just enable/start it. Only one file for the socket and one for the service ever exists, no matter how many users get an instance of it. The advantage of template units is we can ship one socket and one service unit file in our packages, and never touch them again, and Virtualmin doesn't need to create/manage those files. Just start/stop/enable/disable the service as appropriate. The templated units can still be managed like actual individual units, they just don't need their own unit files. This is the right way to do user owned services and sockets in systemd; the way we're currently doing it is pretty messy (lots of files, generated and managed by Virtualmin, when we should be outsourcing as much process management as possible to systemd). The advantage of socket activation is that it doesn't start fcgiwrap until needed, the process is completely managed by systemd, and it may fix the problem with fcgiwrap freezing up periodically. The fcgiwrap documentation uses socket activation, and the RPM package includes a socket-activated system configuration. I believe we can say with confidence the author of fcgiwrap would like it to be socket-activated. It's been running socket-activated on Even if it doesn't fix the periodic freezing problem (which I'm hopeful it will), this is still a cleaner implementation that takes advantage of features of systemd to make it easier to use and more in line with how everybody else is doing things (many services work this way, so it is familiar and documented and will become more familiar as people get more experience with systemd). We should know in another couple days if the freezing problem is fixed. I think with current traffic we were freezing at least once a day before, so we should have seen it already, but I won't commit to saying it's definitely fixed for at least another couple days. |
OK I think it should be pretty simple to implement this, as the Apache-side config is still mostly the same. Let me know how it goes on virtualmin.com, and I'll look into adding support for it in Virtualmin. |
I've been running additional cross-platform tests and made a few small fixes, specifically adding the
The socket in webserver should be called as domain owner user for both top-level and sub-server domains. The sub-domains will use the logs path for the main user. However, sadly it seems impossible not to hardcode
The reason for this, I believe, is that logs are written as the root user by default, and Most probably, the best and cleanest solution would be to write logs to the journal, like this:
I haven’t changed it yet, but let’s discuss it. |
I would rather we use the journal by default. We should try to be like the systems we support, and they've all moved most stuff to the journal. And, lots of good stuff falls out of the decision for free...if you're ingesting logs into something like Grafana Loki or Splunk or whatever, you don't have to micromanage it, you just grab the journal. |
Agreed. I modified my initial suggestion. |
Where are we at with this? What’s the plan moving forward? |
Are we confident enough in this CGI mode that I should add support for it in Virtualmin? |
I think we do. It’s much simpler and more reliable this way. I don’t think we need to overcomplicate it either. We can pre-create those systemd-related files somewhere in the |
Ok I'll take a look at this for a future release |
↑ |
Now that 7.30.0 is out, I will take a look at this. |
Great, thanks! Please let me know if you have any questions about FCGIWrap templates. |
I have updated the original instructions to use |
I'm bumping this up so it won't be buried. |
Hey Jamie!
As we discussed earlier in the chat, it would be better and simpler to use socket activation for FCGIwrap.
I’ve spent some time looking into this and searching for the best approach, and here’s what I’ve found.
Please check these suggested changes:
During Virtualmin installation (package) time we create:
1.1. The file named
[email protected]
in/usr/lib/systemd/system
with the following content:1.2. File named
[email protected]
in/usr/lib/systemd/system
with the following content:1.3. File named
fcgiwrap
in/etc/webmin/virtual-server/
with the following content:We stop creating individual
fcgiwrap-domain.com.service
files as we do now;We slightly change the socket name in Apache/Nginx to include domain owner username only:
Disabling FCGIWrap for a specific domain can be done as simply as:
With templated systemd units for FCGIwrap, we’re making things way easier by cutting out the need for separate service files for each domain. Instead, socket activation kicks in, starting FCGIwrap only when it’s needed, which saves resources; plus, the
RuntimeMaxSec=300
setting ensures idle services don’t hang around forever, wasting system resources. The clear, consistent socket names tied to usernames also make management simpler.The text was updated successfully, but these errors were encountered: