Install GitLab Runner on FreeBSD
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
The FreeBSD version is also available as a bleeding edge release. Make sure that you read the FAQ section which describes some of the most common problems with GitLab Runner.
Installing GitLab Runner
Here are the steps to install and configure GitLab Runner under FreeBSD:
Create the
gitlab-runneruser and group:sudo pw group add -n gitlab-runner sudo pw user add -n gitlab-runner -g gitlab-runner -s /usr/local/bin/bash sudo mkdir /home/gitlab-runner sudo chown gitlab-runner:gitlab-runner /home/gitlab-runnerDownload the binary for your system:
# For amd64 sudo fetch -o /usr/local/bin/gitlab-runner https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-freebsd-amd64 # For i386 sudo fetch -o /usr/local/bin/gitlab-runner https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-freebsd-386You can download a binary for every available version as described in Bleeding Edge - download any other tagged release.
Give it permissions to execute:
sudo chmod +x /usr/local/bin/gitlab-runnerCreate an empty log file with correct permissions:
sudo touch /var/log/gitlab_runner.log && sudo chown gitlab-runner:gitlab-runner /var/log/gitlab_runner.logCreate the
rc.ddirectory in case it doesn’t exist:mkdir -p /usr/local/etc/rc.dCreate the
gitlab_runnerscript insiderc.d:Bash users can do the following:
sudo bash -c 'cat > /usr/local/etc/rc.d/gitlab_runner' << "EOF" #!/bin/sh # PROVIDE: gitlab_runner # REQUIRE: DAEMON NETWORKING # BEFORE: # KEYWORD: . /etc/rc.subr name="gitlab_runner" rcvar="gitlab_runner_enable" user="gitlab-runner" user_home="/home/gitlab-runner" command="/usr/local/bin/gitlab-runner" command_args="run" pidfile="/var/run/${name}.pid" start_cmd="gitlab_runner_start" gitlab_runner_start() { export USER=${user} export HOME=${user_home} if checkyesno ${rcvar}; then cd ${user_home} /usr/sbin/daemon -u ${user} -p ${pidfile} ${command} ${command_args} > /var/log/gitlab_runner.log 2>&1 fi } load_rc_config $name run_rc_command $1 EOFIf you are not using bash, create a file named
/usr/local/etc/rc.d/gitlab_runnerand include the following content:#!/bin/sh # PROVIDE: gitlab_runner # REQUIRE: DAEMON NETWORKING # BEFORE: # KEYWORD: . /etc/rc.subr name="gitlab_runner" rcvar="gitlab_runner_enable" user="gitlab-runner" user_home="/home/gitlab-runner" command="/usr/local/bin/gitlab-runner" command_args="run" pidfile="/var/run/${name}.pid" start_cmd="gitlab_runner_start" gitlab_runner_start() { export USER=${user} export HOME=${user_home} if checkyesno ${rcvar}; then cd ${user_home} /usr/sbin/daemon -u ${user} -p ${pidfile} ${command} ${command_args} > /var/log/gitlab_runner.log 2>&1 fi } load_rc_config $name run_rc_command $1Make the
gitlab_runnerscript executable:sudo chmod +x /usr/local/etc/rc.d/gitlab_runnerEnable the
gitlab-runnerservice and start it:sudo sysrc gitlab_runner_enable=YES sudo service gitlab_runner startIf you don’t want to enable the
gitlab-runnerservice to start after a reboot, use:sudo service gitlab_runner onestart