github.com/alloyci/alloy-runner@v1.0.1-0.20180222164613-925503ccafd6/docs/install/freebsd.md (about)

     1  ---
     2  last_updated: 2017-10-09
     3  ---
     4  
     5  # Install AlloyCI Runner on FreeBSD
     6  
     7  NOTE: **Note:**
     8  The FreeBSD version is also available as a [bleeding edge](bleeding-edge.md)
     9  release. Make sure that you read the [FAQ](../faq/README.md) section which
    10  describes some of the most common problems with AlloyCI Runner.
    11  
    12  ## Installing AlloyCI Runner
    13  
    14  Here are the steps to install and configure AlloyCI Runner under FreeBSD:
    15  
    16  1. Create the `alloy-runner` user and group:
    17  
    18      ```sh
    19      sudo pw group add -n alloy-runner
    20      sudo pw user add -n alloy-runner -g alloy-runner -s /usr/local/bin/bash
    21      sudo mkdir /home/alloy-runner
    22      sudo chown alloy-runner:alloy-runner /home/alloy-runner
    23      ```
    24  
    25  1. Download the binary for your system:
    26  
    27      ```sh
    28      # For amd64
    29      sudo fetch -o /usr/local/bin/alloy-runner https://alloy-runner-downloads.s3.amazonaws.com/latest/binaries/alloy-runner-freebsd-amd64
    30  
    31      # For i386
    32      sudo fetch -o /usr/local/bin/alloy-runner https://alloy-runner-downloads.s3.amazonaws.com/latest/binaries/alloy-runner-freebsd-386
    33      ```
    34  
    35      You can download a binary for every available version as described in
    36      [Bleeding Edge - download any other tagged release](bleeding-edge.md#download-any-other-tagged-release).
    37  
    38  1. Give it permissions to execute:
    39  
    40      ```sh
    41      sudo chmod +x /usr/local/bin/alloy-runner
    42      ```
    43  
    44  1. Create an empty log file with correct permissions:
    45  
    46      ```sh
    47      sudo touch /var/log/alloy_runner.log && sudo chown alloy-runner:alloy-runner /var/log/alloy_runner.log
    48      ```
    49  
    50  1. Create the `rc.d` directory in case it doesn't exist:
    51  
    52      ```sh
    53      mkdir -p /usr/local/etc/rc.d
    54      ```
    55  
    56  1. Create the `rc.d` script:
    57  
    58      ```sh
    59      sudo bash -c 'cat > /usr/local/etc/rc.d/alloy_runner' << "EOF"
    60      #!/bin/sh
    61      # PROVIDE: alloy_runner
    62      # REQUIRE: DAEMON NETWORKING
    63      # BEFORE:
    64      # KEYWORD:
    65  
    66      . /etc/rc.subr
    67  
    68      name="alloy_runner"
    69      rcvar="alloy_runner_enable"
    70  
    71      load_rc_config $name
    72  
    73      user="alloy-runner"
    74      user_home="/home/alloy-runner"
    75      command="/usr/local/bin/alloy-runner run"
    76      pidfile="/var/run/${name}.pid"
    77  
    78      start_cmd="alloy_runner_start"
    79      stop_cmd="alloy_runner_stop"
    80      status_cmd="alloy_runner_status"
    81  
    82      alloy_runner_start()
    83      {
    84          export USER=${user}
    85          export HOME=${user_home}
    86          if checkyesno ${rcvar}; then
    87              cd ${user_home}
    88              /usr/sbin/daemon -u ${user} -p ${pidfile} ${command} > /var/log/alloy_runner.log 2>&1
    89          fi
    90      }
    91  
    92      alloy_runner_stop()
    93      {
    94          if [ -f ${pidfile} ]; then
    95              kill `cat ${pidfile}`
    96          fi
    97      }
    98  
    99      alloy_runner_status()
   100      {
   101          if [ ! -f ${pidfile} ] || kill -0 `cat ${pidfile}`; then
   102              echo "Service ${name} is not running."
   103          else
   104              echo "${name} appears to be running."
   105          fi
   106      }
   107  
   108      run_rc_command $1
   109      EOF
   110      ```
   111  
   112  1. Make it executable:
   113  
   114      ```sh
   115      sudo chmod +x /usr/local/etc/rc.d/alloy_runner
   116      ```
   117  
   118  1. [Register the Runner](../register/README.md)
   119  1. Enable the `alloy-runner` service and start it:
   120  
   121      ```sh
   122      sudo sysrc -f /etc/rc.conf "alloy_runner_enable=YES"
   123      sudo service alloy_runner start
   124      ```
   125  
   126      If you don't want to enable the `alloy-runner` service to start after a
   127      reboot, use:
   128  
   129      ```sh
   130      sudo service alloy_runner onestart
   131      ```
   132  
   133  ## Upgrading to AlloyCI Runner 1.0
   134  
   135  To upgrade AlloyCI Runner from a version of GitLab Runner prior to 10.0:
   136  
   137  1. Stop the Runner:
   138  
   139      ```sh
   140      sudo service gitlab_runner stop
   141      ```
   142  
   143  1. Optionally, preserve the previous version of the Runner just in case:
   144  
   145      ```sh
   146      sudo mv /usr/local/bin/alloy-ci-multi-runner{,.$(/usr/local/bin/alloy-ci-multi-runner --version| grep Version | cut -d ':' -f 2 | sed 's/ //g')}
   147      ```
   148  
   149  1. Download the new Runner and make it executable:
   150  
   151      ```sh
   152      # For amd64
   153      sudo fetch -o /usr/local/bin/alloy-runner https://alloy-runner-downloads.s3.amazonaws.com/latest/binaries/alloy-runner-freebsd-amd64
   154  
   155      # For i386
   156      sudo fetch -o /usr/local/bin/alloy-runner https://alloy-runner-downloads.s3.amazonaws.com/latest/binaries/alloy-runner-freebsd-386
   157  
   158      sudo chmod +x /usr/local/bin/alloy-runner
   159      ```
   160  
   161  1. Edit `/usr/local/etc/rc.d/alloy_runner` and change:
   162  
   163      ```
   164      command="/usr/local/bin/gitlab-ci-multi-runner run"
   165      ```
   166  
   167      to:
   168  
   169      ```
   170      command="/usr/local/bin/alloy-runner run"
   171      ```
   172  
   173  1. Start the Runner:
   174  
   175      ```sh
   176      sudo service alloy_runner start
   177      ```
   178  
   179  1. After you confirm all is working correctly, you can remove the old binary:
   180  
   181      ```sh
   182      sudo rm /usr/local/bin/gitlab-ci-multi-runner.*
   183      ```