The system services of GitLab Runner
GitLab Runner uses the Go service
library
to detect the underlying OS and eventually install the service file based on
the init system.
service
will install / un-install, start / stop, and run a program as a
service (daemon). Currently supports Windows XP+, Linux/(systemd | Upstart | SysV),
and OSX/Launchd.Once GitLab Runner is installed, the service file will be automatically be created:
-
systemd:
/etc/systemd/system/gitlab-runner.service
-
upstart:
/etc/init/gitlab-runner
Overriding the default service files
In some cases, you might want to override the default behavior of the service.
For example, when upgrading the Runner, you’ll want it to stop gracefully until all running jobs are finished, but systemd, upstart, or some other service may almost immediately restart the process without even noticing.
So, when upgrading the Runner, the installation script will kill and restart the Runner’s process which would most probably be handling some new jobs at that time.
Overriding systemd
For Runners that use systemd create
/etc/systemd/system/gitlab-runner.service.d/kill.conf
with the following
content:
[Service]
TimeoutStopSec=7200
KillSignal=SIGQUIT
After adding these two settings to the systemd unit configuration, you can
stop the Runner and systemd will use SIGQUIT
as the kill signal, to stop the
process. Additionally, a 2h timeout is set for the stop command, which
means that if any jobs don’t terminate gracefully before this timeout, systemd
will just SIGKILL
the process.
Overriding upstart
For Runners that use upstart create /etc/init/gitlab-runner.override
with the
following content:
kill signal SIGQUIT
kill timeout 7200
After adding these two settings to the upstart unit configuration, you can stop the Runner and upstart will do exactly the same as systemd above.
Help and feedback
If there's something you don't like about this feature
To propose functionality that GitLab does not yet offer
To further help GitLab in shaping new features
If you didn't find what you were looking for
If you want help with something very specific to your use case, and can use some community support
POST ON GITLAB FORUM
If you have problems setting up or using this feature (depending on your GitLab subscription)
REQUEST SUPPORT
To view all GitLab tiers and features or to upgrade
If you want to try all features available in GitLab.com
If you want to try all features available in GitLab self-managed
If you spot an error or a need for improvement and would like to fix it yourself in a merge request
EDIT THIS PAGE
If you would like to suggest an improvement to this doc