4 ms·
Any examples of this? I got an application, I want to specify where the internal /etc/foo and /data lives outside the "systemd-container" and I want to map som
by magicalhippo 4y ago
Any examples of this?
I got an application, I want to specify where the internal /etc/foo and /data lives outside the "systemd-container" and I want to map some ports to the internal IP.
How do I set this up with systemd?
- xorcist 4y agoThere is plenty of examples in the documentation. The man page (man systemd-nspawn) is short and to the point. As for your example,for regular daemons you probably want to use plain old unit files. You map ports with "Port=" and bind filesystems with "Bind=" ("/outside/data:/data" in your example). Again, plenty of examples in the documentation and in the Gentoo/Arch wikis which are excellent. It also includes examples working with (not against) SELinux. Lots of other parts of the systemd family is nasty and full of surprises but this one pretty straightforward. systemd was built on cgroups from the ground up and it makes administering them fairly trivial.
- magicalhippo 4y agoThanks, hadn't heard about systemd-nspawn. Arch wiki to the rescue again, as you say.
- exabrial 4y agoI post a gist for you. This is filtered through our maven build where variables are substituted, so you'll see a bunch of placeholders that get replaced during compilation: https://gist.github.com/exabrial/fbda5ebceb94ae2397aac16f586e70fd https://gist.github.com/exabrial/fbda5ebceb94ae2397aac16f586... This particular template we're not really worried about mem/cpu limits so that isn't in there. Authbind is in there to allow it to grab lower ports, but this particular app does not. I would recommend reading these as well: * https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04 https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db... * https://www.opensourcerers.org/2022/04/25/optimizing-a-systemd-service-for-security/ https://www.opensourcerers.org/2022/04/25/optimizing-a-syste...
- magicalhippo 4y agoThanks, that's really helpful.