github.com/ssube/gitlab-ci-multi-runner@v1.2.1-0.20160607142738-b8d1285632e6/docs/install/freebsd.md (about)

     1  ### Install on FreeBSD
     2  
     3  Create gitlab-runner user and group:
     4  
     5  ```bash
     6  sudo pw group add -n gitlab-runner
     7  sudo pw user add -n gitlab-runner -g gitlab-runner -s /usr/local/bin/bash
     8  sudo mkdir /home/gitlab-runner
     9  sudo chown gitlab-runner:gitlab-runner /home/gitlab-runner
    10  ```
    11  
    12  Download the binary for your system:
    13  
    14  ```bash
    15   sudo wget -O /usr/local/bin/gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-freebsd-amd64
    16   sudo wget -O /usr/local/bin/gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-freebsd-386
    17  ```
    18  
    19  Give it permissions to execute:
    20  
    21  ```bash
    22  sudo chmod +x /usr/local/bin/gitlab-ci-multi-runner
    23  ```
    24  
    25  Create empty log file with correct permissions:
    26  
    27  ```bash
    28  sudo touch /var/log/gitlab_runner.log && sudo chown gitlab-runner:gitlab-runner /var/log/gitlab_runner.log
    29  ```
    30  
    31  Create rc.d script:
    32  
    33  ```bash
    34  cat > /etc/rc.d/gitlab_runner << "EOF"
    35  #!/bin/sh
    36  # PROVIDE: gitlab_runner
    37  # REQUIRE: DAEMON NETWORKING
    38  # BEFORE:
    39  # KEYWORD:
    40  
    41  . /etc/rc.subr
    42  
    43  name="gitlab_runner"
    44  rcvar="gitlab_runner_enable"
    45  
    46  load_rc_config $name
    47  
    48  user="gitlab-runner"
    49  user_home="/home/gitlab-runner"
    50  command="/usr/local/bin/gitlab-ci-multi-runner run"
    51  pidfile="/var/run/${name}.pid"
    52  
    53  start_cmd="gitlab_runner_start"
    54  stop_cmd="gitlab_runner_stop"
    55  status_cmd="gitlab_runner_status"
    56  
    57  gitlab_runner_start()
    58  {
    59      export USER=${user}
    60      export HOME=${user_home}
    61      if checkyesno ${rcvar}; then
    62          cd ${user_home}
    63          /usr/sbin/daemon -u ${user} -p ${pidfile} ${command} > /var/log/gitlab_runner.log 2>&1
    64      fi
    65  }
    66  
    67  gitlab_runner_stop()
    68  {
    69      if [ -f ${pidfile} ]; then
    70          kill `cat ${pidfile}`
    71      fi
    72  }
    73  
    74  gitlab_runner_status()
    75  {
    76      if [ ! -f ${pidfile} ] || kill -0 `cat ${pidfile}`; then
    77          echo "Service ${name} is not running."
    78      else
    79          echo "${name} appears to be running."
    80      fi
    81  }
    82  
    83  run_rc_command $1
    84  EOF
    85  ```
    86  
    87  Make it executable:
    88  
    89  ```bash
    90  sudo chmod +x /etc/rc.d/gitlab_runner
    91  ```
    92  
    93  
    94  Register the runner:
    95  
    96  ```bash
    97  sudo -u gitlab-runner -H /usr/local/bin/gitlab-ci-multi-runner register
    98  
    99  Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci):
   100  
   101  Please enter the gitlab-ci token for this runner:
   102  
   103  Please enter the gitlab-ci description for this runner:
   104  [name]:
   105  Please enter the gitlab-ci tags for this runner (comma separated):
   106  
   107  Registering runner... succeeded
   108  Please enter the executor: virtualbox, ssh, shell, parallels, docker, docker-ssh:
   109  shell
   110  Runner registered successfully. Feel free to start it, but if it\'s running already the config should be automatically reloaded!
   111  ```
   112  
   113  Enable gitlab-runner service and start it:
   114  
   115  ```bash
   116  sudo sysrc -f /etc/rc.conf "gitlab_runner_enable=YES" 
   117  sudo service gitlab_runner start
   118  ```
   119  
   120  If you don't want to enable gitlab-runner server to restart after reboot, you can start it:
   121  
   122  ```bash
   123  sudo service gitlab_runner onestart
   124  ```
   125  
   126  **The FreeBSD version is also available from [Bleeding edge](bleeding-edge.md)**
   127  
   128  Make sure that you read the [FAQ](../faq/README.md) section which describes
   129  some of the most common problems with GitLab Runner.