-
Notifications
You must be signed in to change notification settings - Fork 68
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
Initial implementation for service sharing #192
base: master
Are you sure you want to change the base?
Conversation
This is a very basic implementation of service sharing between strata, it simply forwards systemd services to /bedrock/cross/services/<stratum-name> and replaces the Start commands in them with strat-using ones. Somehow, the security features of "systemd" seem to not bother it now, even though previously in my testing they did. After symlinking a service from cross to /etc/systemd/ it works in the main stratum.
c812505
to
eca69b7
Compare
There is now a foundation for cross-stratum service translation. For now, just the most simple translation is implemented. That is, runit to systemd. Services are created on the fly and stored in memory cache, served from there when needed and updated if the original service file changes. As before, these need to be linked to the init stratum actual service directory to be used, but it is currently already possible to run the simples runit services with systemd.
There is now a foundation for cross-stratum service translation. For |
I took a bit of a liberty and separated things to several files to keep it a bit easier for me to work with. Most of As for services, I have implemented generation of most things runit can do, that is start (of course), finish (something to do after the service is stopped) and conf (a file with environmental variables read before the service starts). runit also has a concept of "check", healthchecks, however systemd has no easy way of running arbitary scripts as healthcheck so I omited that moment from the systemd generator (the value is still read and saved). With that, most runit services should be able to run fine. The next thing I will work on will probably be OpenRC translation. The last thing that will be left is translation to init systems that are not systemd, as it's a bit harder to work on them when it's not a native init system of my distro, though they can probably be set up to run as non-pid-1 processes for testing, so that should not be a big problem. |
systemd service generator now understands runit finish and conf. The general service model aquired a few new fields for the aforementioned things, plus a field for the healthchecking (which is not generated for systemd, because systemd can't do healthchecks with arbitary scripts easily). Overall, this should cover most of runit services. log from runit is left unimplemented, as other service daemons have their own means of logging.
acdbb67
to
0b3f46c
Compare
After a bit of digging with openrc it seems like the way to run it is:
Hopefully this will work well enough for most things. |
Breaking it up into multiple files is fine. That's something I probably should have been doing already. When this effort is done (so we don't fight over merging conflicts) I might refactor more into separate files. You're clearly doing this with an eye towards maintaining the preexisting style. Things like using using I haven't had time to what you've done so far in depth, but it looks like you're caching generated services so you don't have to regenerate on a re-read. Not a bad idea in general, but I'd prefer that be left out of this effort and PR:
|
OpenRC is a bit tricky.. it's more complex than sv and it seems to be easier to just use openrc-run directly, however for that to work softlevel file has to exist and the openrc command has to be run at least once so it could create /var/run/openrc stuff. Otherwise, setting a specific PIDFile for systemd and starting openrc-run seems to work.
Sorry for taking a bit too long and not responding with anything. I understand your concerns about caching and I have removed it. Maybe it could be done sometime in the future. As for OpenRC implementation, it is a bit tricky.. it's more complex than sv and it seems to be The next open question now is how to handle dependencies. |
No worries at all! Bedrock is entirely volunteer work, and I fully understand people have other things going on in their lives. No rush on anything here. I didn't expect to get to this myself in 2020, or see anyone else volunteer to do so. We're way ahead of where I expected to be on this topic.
As long as we're careful to document it, I'm perfectly okay with the first release of this having caveats like it failing to work with OpenRC that create their own pidfiles. We can slowly improve these things over time, especially as they get attention from people who know the given init system well.
I've not thought this through well at all. Feel free to disagree here or propose alternatives. That having been said, here are my current thoughts:
|
I thought of two other open issues we need to figure out: (1) All of the consumers of existing crossfs resources can be configured to look at
One way we could work around this is (2) It's not clear to me how we should make the The existing
which worked great for past resources, but is a bit clumsy here. Currently, crossfs cannot merge
That's easily fixed by just having the
would create
I think that's close to what you're doing. The bigger problem is how to figure out what the input is. If we put it in the
However, crossfs does not support multiple identical
However, there we run into the possible issue of different distros having the different service managers at the same path. We might in the future run into something like:
in which case crossfs has to figure out if a given stratum is using OpenRC or SysV. In that case, it gives us little over just always detecting the input type automatically. We could have crossfs hard-code assumptions about what service type is at what input file path. I think this might be what you're doing now. In that case, though, things fall apart if the user ever tries another path, which wouldn't be unreasonable of them, or if we find something like multiple inits that use the same path (which might already be the case with SysV and OpenRC). The last option I have in mind is to have crossfs automatically detect the service type from what it's reading when it reads inputs. Something like:
This adds performance overhead I'm not super happy about, and has the potential to mis-detect something. I'm not sure which, if any, of these I like. I'm certainly open to ideas here. |
4099fe1
to
fc27745
Compare
Sorry for lack of any.. anything. The situation in my country of residence is uneasy right now, and the internet connection is unstable, so I have to pause the work for an undetermined amount of time. Hopefully I can return to this soon. |
I absolutely understand. No rush on this effort. Take care of yourself. |
12e1061
to
524beae
Compare
This is a very basic implementation of service sharing between strata,
it simply forwards systemd services to
/bedrock/cross/services/ and replaces the Start commands
in them with strat-using ones. Somehow, the security features of
"systemd" seem to not bother it now, even though previously in my
testing they did. After symlinking a service from cross to
/etc/systemd/ it works in the main stratum. The plan, as discussed in #190,
is to have services from different init systems translated to the other systems via
a universal service format on the fly.
I wanted to open a PR early so the progress could be followed easily.