-
Notifications
You must be signed in to change notification settings - Fork 13
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
Special paths defined as env variables in system files should be mapped as systemd specifiers #53
Comments
Podlet does not currently perform interpolation of compose files like docker compose does. That should probably be on the README. I just started working on a new Rust library to better implement the compose spec and replace the I feel like the proposed solution is out of scope for podlet. What should also be on the README, is that podlet is mostly meant to just get you started with quadlet/systemd. I thought this was kind of implied already but I'll try to make clearer. |
So the idea is to convert all docker-compose to quadlet files and then only modify these quadlet files? I currently thought of it as an adapter for docker-compose, so I can start docker-compose files with podman (quadlets). In other words: I thought it is more a thing built into your "pipeline" that converts your configuration and starts it afterwards.
That sounds awesome! I guess you're also aware of
Yeah…
Mind to explain, why, actually? |
Yup, that was what I was thinking when I added the compose feature and when I created podlet originally. It doesn't really make sense to maintain a compose file if your goal is to transition to using podman and quadlets. If you want to group containers together you can use pods. Podman v5.0.0 will add support for
Yup. By the way, you can also use
Because it feels too much like trying to guess the user's intentions. Besides, you can use a pretty simple sed command for your example: |
Look, if you want a feature for using systemd specifiers I think you are going to have to be more specific because I'm not understanding what it is you want exactly.
I'd also be happy to accept a PR on this. Though how its implemented should be discussed first. It should also probably wait until after I get #52 done as implementing that will require changing the structs in the |
Also, just rereading your response now it sounds like you took my compose spec Rust library to mean that I'm making something like |
Dunno
No, which ones should it?
Replaces unique strings (maybe start with paths only; including variables), with the systemd specifiers defined here.
Yeah, maybe only paths.
Implementation detail. 😜 No just kidding, maybe expand the paths indeed and then find and replace the paths with the specifiers?
Hmm see none? Either a replacement string is found or not. I mean replacing is an optional thing, it's not required. (getting off-topic…)
No, that's obviously clear. Though, of course you can use this project in a pipeline to convert your compose files. After all that's the aim…
Well… depends on your use cases. Anyway, enough off-topic… |
I was thinking maybe a list of specifiers to use? With a default list if the option is given without a list?
I think this feature will have to wait until compose interpolation is in, and to require the
So, from the list, "%C", "%d", "%E", "%h", "%L", "%S", "%t", "%T", and "%V"? Many of those specify environment variables to use for user managers. What should happen if those variables aren't set or are empty? What does systemd do in that case? Should podlet fallback to the ones from the XDG Base Directory Specification? What if Specifically for the temp directories, multiple environment variables and a set directory are listed. In what order should they take precedence?
What if a directory that a specifier is supposed to replace cannot be determined? I think that should be a reported error as podlet won't do what the user expects otherwise. Should this feature work on Linux only? What about other Unix-like OSs (e.g. macOS and FreeBSD)? What about Windows? Should it just error if not supported?
Fair enough, though I'm pretty sure quadlet is here to stay given that it originated out of a need from the automotive industry. Also, I think the "full of people" comment is exaggerating a bit given that there are only 5 (including you) non podman maintainers/contributors in that discussion and 2 of them commented only once. I wish that docker wasn't as completely dominant as it is. Even the compose-spec, which is supposed to be vendor neutral, is very docker heavy. I'm really not trying to be adversarial here. It's just that this feature is perhaps a bit more complicated than you thought. Also, I'm not a systemd expert. I've never tried to make a service that is portable across systems before. |
Probably the most relevant question as this should behave the same. It's just a quick look, but I've found these relevants spots:
From what I read, yes it does, and this is the reason to use such variables in the first place.
I am not so good in C, but apparently, it has some way more complex logic for this case than what I'd expect aka e.g. having hardcoded paths for
Well as I would read the doc always in reading order. The temp dir handling as I saw in source code is more complex though FYI.¹
Yeah maybe. But given you still have a working (non-replaced/special) path, if it is not replaced, it is maybe no big deal.
I have no idea. Only ever used that on Linux. As such, maybe just don't offer that feature there, or as you say, error. You know, this idea was born of me using this tool, just FYI. So I thought this was a good idea. If not, yeah, maybe, I just thought it would be a cool convenience feature at the time when opening the issue. Also maybe I should clarify I would be fine with replacing env variables (that have a defined mapping in systemd) for now, not all file paths or so. I guess (hope), this may ease implementation. I'll correct the title… ¹ Edit: As such, for the reverse mapping issue we have at hand here (from env vars to specifiers), this should not matter as far as I see. |
Blocked on #63 and k9withabone/compose_spec_rs#3. |
Example
E.g. say you have the following YAML:
This currently get's mapped as (
Volume
matters here):Problem
This does not work, as I dunno… some systemd thing…(?) I guess $HOME is not defined in that context.
in any case the error is something like if you want to start this Quadlet with podman:
Solution
It should replace some well-known env variables with their systemd equivalents.
HOME
should be replaced with%h
e.g.Aka the result should be this:
Volume=%h/grocy-data:/config:Z
There are more such variables: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Specifiers
The text was updated successfully, but these errors were encountered: