pkgxdev / pantry

pkg manifests
https://pkgx.dev/pkgs/
161 stars 112 forks source link

pkgx and systemd unit #6529

Closed tannevaled closed 5 days ago

tannevaled commented 5 days ago

Hi,

i try to use pkgx in a systemd unit for "GitHub Actions Runner Manager"

ubuntu@github-actions-runner-manager:~$ sudo cat /etc/systemd/system/garm.service
[Unit]
Description=GitHub Actions Runner Manager (garm)
After=multi-user.target

[Service]
Type=simple
User=_garm
Group=_garm
RuntimeDirectory=garm
RuntimeDirectoryPreserve=yes
WorkingDirectory=%t
ExecStart=/usr/local/bin/pkgx --verbose=2 +garm^${GARM_VERSION} garm -config ${GARM_CONFIG_PATH}
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target
ubuntu@github-actions-runner-manager:~$ sudo cat /etc/systemd/system/garm.service.d/local.conf
[Service]
Environment="DEBUG=1"
Environment="PKGX_DIR=/var/run/garm/.pkgx"
Environment="PATH=/usr/local/bin:${PATH}"
Environment="GARM_VERSION=0.1.4"
Environment="GARM_CONFIG_PATH=/etc/garm/config.toml"
ubuntu@github-actions-runner-manager:~$ ls -alFh /var/run/garm/
total 0
drwxr-xr-x  3 _garm _garm   60 Jun 27 11:53 ./
drwxr-xr-x 32 root  root  1.1K Jun 27 11:53 ../
drwxr-xr-x  4 _garm _garm   80 Jun 27 11:53 .pkgx/

i got the following Permission error and do not have enough info to troubleshoot. any idea?

ubuntu@github-actions-runner-manager:~$ journalctl -fu garm
...
Jun 27 12:13:14 github-actions-runner-manager systemd[1]: Started garm.service - GitHub Actions Runner Manager (garm).
Jun 27 12:13:16 github-actions-runner-manager pkgx[327472]: × unexpected error
Jun 27 12:13:16 github-actions-runner-manager pkgx[327472]: │ PermissionDenied
Jun 27 12:13:16 github-actions-runner-manager pkgx[327472]: │     at default (file:///home/runner/work/pkgx/pkgx/src/utils/execve.ts:19:15)
Jun 27 12:13:16 github-actions-runner-manager pkgx[327472]: │     at default (file:///home/runner/work/pkgx/pkgx/src/modes/x.ts:39:3)
Jun 27 12:13:16 github-actions-runner-manager pkgx[327472]: │     at eventLoopTick (ext:core/01_core.js:182:7)
Jun 27 12:13:16 github-actions-runner-manager pkgx[327472]: │     at async default (file:///home/runner/work/pkgx/pkgx/src/app.ts:48:11)
Jun 27 12:13:16 github-actions-runner-manager pkgx[327472]: │     at async file:///home/runner/work/pkgx/pkgx/entrypoint.ts:59:3
Jun 27 12:13:16 github-actions-runner-manager pkgx[327472]: ╰─➤ https://github.com/pkgxdev/pkgx/issues/new
Jun 27 12:13:16 github-actions-runner-manager systemd[1]: garm.service: Main process exited, code=exited, status=1/FAILURE
Jun 27 12:13:16 github-actions-runner-manager systemd[1]: garm.service: Failed with result 'exit-code'.
Jun 27 12:13:16 github-actions-runner-manager systemd[1]: garm.service: Consumed 1.788s CPU time.
...
tannevaled commented 5 days ago

argh, you can close the issue i opened it (and resolved) on the good project cf https://github.com/pkgxdev/pkgx/issues/1018