How to run a user systemd service in a GitHub Actions workflow
Here is a mini demo of how to run a web server (nginx) with podman in a user systemd service with Github Actions: https://github.com/eriksjolund/user-systemd-service-actions-workflow I noticed two non obvious things: 1. A short sleep was needed after loginctl enable-linger runner 2. systemctl needs to be run with the environment variable XDG_RUNTIME_DIR=/run/user/$UID
Hi Erik, That's really cool, thanks for sharing! Is it a proof of concept or are you using Podman in systemd in GitHub Actions in production? I think that's a super cool story for www.redhat.com/sysadmin. Are you interested in writing a blog on that topic? Kind regards, Valentin On Sun, Jan 10, 2021 at 6:58 PM Erik Sjölund <erik.sjolund@gmail.com> wrote:
Here is a mini demo of how to run a web server (nginx) with podman in a user systemd service with Github Actions: https://github.com/eriksjolund/user-systemd-service-actions-workflow
I noticed two non obvious things:
1. A short sleep was needed after
loginctl enable-linger runner
2. systemctl needs to be run with the environment variable
XDG_RUNTIME_DIR=/run/user/$UID _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
Hi Valentin, Up til now I have only tried it in this example, but my plan is to start using it. I found out another thing: After running "loginctl enable-linger runner", it seems that you need to use systemctl --user --machine=username@.host if you want to avoid having to add a "sleep 1". At least that is how I interpreted the tip I got on the systemd-devel mailing list. https://lists.freedesktop.org/archives/systemd-devel/2021-January/045861.htm... Here is my summary of the problem: https://github.com/eriksjolund/user-systemd-service-actions-workflow/issues/... Writing a story for www.redhat.com/sysadmin would be fun. I guess the demo would then reach a broader audience than this mailing list. Kind regards, Erik On Mon, Jan 11, 2021 at 9:29 AM Valentin Rothberg <rothberg@redhat.com> wrote:
Hi Erik,
That's really cool, thanks for sharing!
Is it a proof of concept or are you using Podman in systemd in GitHub Actions in production?
I think that's a super cool story for www.redhat.com/sysadmin. Are you interested in writing a blog on that topic?
Kind regards, Valentin
On Sun, Jan 10, 2021 at 6:58 PM Erik Sjölund <erik.sjolund@gmail.com> wrote:
Here is a mini demo of how to run a web server (nginx) with podman in a user systemd service with Github Actions: https://github.com/eriksjolund/user-systemd-service-actions-workflow
I noticed two non obvious things:
1. A short sleep was needed after
loginctl enable-linger runner
2. systemctl needs to be run with the environment variable
XDG_RUNTIME_DIR=/run/user/$UID _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
participants (2)
-
Erik Sjölund -
Valentin Rothberg