Gitlab Stuff
Runner as normal user on Rocky 9
You can run gitlab-runner as a service under a normal user account. We'll add a normal user on the system called testuser
. Then we enable lingering for that user so that systemd units can run
whether or not the user is logged on.
Then you can switch to that user from a root session.
Now that we're running as the new user, we can register gitlab-runner.
Once the runner is registered, we need to create a service file for it in ~/.config/systemd/user/gitlab-runner.service
[Unit]
Description=Gitlab CI Runner
Wants=network-online.target
After=network-online.target
[Service]
Restart=on-failure
ExecStart=/usr/bin/gitlab-runner run
[Install]
WantedBy=default.target
Then we can reload the systemd unit files and start and enable the service.
Now the gitlab runner for that user account will start at boot and be able to run jobs under that account.