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

     1  # AlloyCI Runner FAQ
     2  
     3  Some Frequently Asked Questions about AlloyCI Runner.
     4  
     5  ## What does `coordinator` mean?
     6  
     7  The `coordinator` is the AlloyCI installation from which a job is requested.
     8  
     9  In other words, runners are isolated (virtual) machines that pick up jobs
    10  requested by their `coordinator`.
    11  
    12  ## Where are logs stored when run as a service?
    13  
    14  + If the AlloyCI Runner is run as service on Linux/OSX  the daemon logs to syslog.
    15  + If the AlloyCI Runner is run as service on Windows it logs to System's Event Log.
    16  
    17  ## Run in `--debug` mode
    18  
    19  Is it possible to run AlloyCI Runner in debug/verbose mode. From a terminal, do:
    20  
    21  ```
    22  alloy-runner --debug run
    23  ```
    24  
    25  ## I get a PathTooLongException during my builds on Windows
    26  
    27  This is caused by tools like `npm` which will sometimes generate directory structures
    28  with paths more than 260 characters in length. There are two possible fixes you can
    29  adopt to solve the problem.
    30  
    31  ### a) Use Git with core.longpaths enabled
    32  
    33  You can avoid the problem by using Git to clean your directory structure, first run
    34  `git config --system core.longpaths true` from the command line and then set your
    35  project to use *git fetch* from the AlloyCI CI project settings page.
    36  
    37  ### b) Use NTFSSecurity tools for PowerShell
    38  
    39  The [NTFSSecurity](https://ntfssecurity.codeplex.com/) PowerShell module provides
    40  a *Remove-Item2* method which supports long paths. The Gitlab CI Multi Runner will
    41  detect it if it is available and automatically make use of it.
    42  
    43  ## I'm seeing `x509: certificate signed by unknown authority`
    44  
    45  Please [See the self-signed certificates](../configuration/tls-self-signed.md)
    46  
    47  ## I get `Permission Denied` when accessing the `/var/run/docker.sock`
    48  
    49  If you want to use Docker executor,
    50  and you are connecting to Docker Engine installed on server.
    51  You can see the `Permission Denied` error.
    52  The most likely cause is that your system uses SELinux (enabled by default on CentOS, Fedora and RHEL).
    53  Check your SELinux policy on your system for possible denials.
    54  
    55  ## The Docker executor gets timeout when building Java project.
    56  
    57  This most likely happens, because of the broken AUFS storage driver:
    58  [Java process hangs on inside container](https://github.com/docker/docker/issues/18502).
    59  The best solution is to change the [storage driver](https://docs.docker.com/engine/userguide/storagedriver/selectadriver/)
    60  to either OverlayFS (faster) or DeviceMapper (slower).
    61  
    62  Check this article about [configuring and running Docker](https://docs.docker.com/engine/articles/configuring/)
    63  or this article about [control and configure with systemd](https://docs.docker.com/engine/articles/systemd/).
    64  
    65  ## I get 411 when uploading artifacts.
    66  
    67  This happens due to fact that runner uses `Transfer-Encoding: chunked` which is broken on early version of Nginx (http://serverfault.com/questions/164220/is-there-a-way-to-avoid-nginx-411-content-length-required-errors).
    68  
    69  Upgrade your Nginx to newer version. For more information see this issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/1031
    70  
    71  ## I can't run Windows BASH scripts; I'm getting `The system cannot find the batch label specified - buildscript`.
    72  
    73  You need to prepend `call` to your batch file line in .alloy-ci.json so that it looks like `call C:\path\to\test.bat`. Here
    74  is a more complete example:
    75  
    76  ```json
    77  {
    78    "before_script": [
    79      "call C:\path\to\test.bat"
    80    ]
    81  }
    82  ```
    83  
    84  Additional info can be found under issue [#1025](https://gitlab.com/gitlab-org/gitlab-runner/issues/1025).
    85  
    86  ## My alloy runner is on Windows. How can I get colored output on the web terminal?
    87  
    88  **Short answer:**
    89  
    90  Make sure that you have the ANSI color codes in your program's output. For the purposes of text formatting, assume that you're
    91  running in a UNIX ANSI terminal emulator (because that's what the webUI's output is).
    92  
    93  **Long Answer:**
    94  
    95  The web interface for alloy-ci emulates a UNIX ANSI terminal (at least partially). The `alloy-runner` pipes any output from the build
    96  directly to the web interface. That means that any ANSI color codes that are present will be honored.
    97  
    98  Windows' CMD terminal (before Win10 ([source](http://www.nivot.org/blog/post/2016/02/04/Windows-10-TH2-(v1511)-Console-Host-Enhancements)))
    99  does not support ANSI color codes - it uses win32 ([`ANSI.SYS`](https://en.wikipedia.org/wiki/ANSI.SYS)) calls instead which are **not** present in
   100  the string to be displayed. When writing cross-platform programs, a developer will typically use ANSI color codes by default and convert
   101  them to win32 calls when running on a Windows system (example: [Colorama](https://pypi.python.org/pypi/colorama)).
   102  
   103  If your program is doing the above, then you need to disable that conversion for the CI builds so that the ANSI codes remain in the string.
   104  
   105  See issue [#332](https://gitlab.com/gitlab-org/gitlab-runner/issues/332) for more information.
   106  
   107  ## `"launchctl" failed: exit status 112, Could not find domain for`
   108  
   109  This message may occur when you try to install AlloyCI Runner on OSX. Make sure
   110  that you manage AlloyCI Runner service from the GUI Terminal application, not
   111  the SSH connection.
   112  
   113  ## `Failed to authorize rights (0x1) with status: -60007.`
   114  
   115  If your Runner is stuck on the above message when using OSX, there are two
   116  causes to why this happens:
   117  
   118  1. Make sure that your user can perform UI interactions:
   119  
   120      ```bash
   121      DevToolsSecurity -enable
   122      sudo security authorizationdb remove system.privilege.taskport is-developer
   123      ```
   124  
   125      The first command enables access to developer tools for your user.
   126      The second command allows the user who is member of the developer group to
   127      do UI interactions, e.g., run the iOS simulator.
   128  
   129      ---
   130  
   131  2. Make sure that your Runner service doesn't use `SessionCreate = true`.
   132     Previously, when running AlloyCI Runner as a service, we were creating
   133     `LaunchAgents` with `SessionCreate`. At that point (**Mavericks**), this was
   134     the only solution to make Code Signing work. That changed recently with
   135     **OSX El Capitan** which introduced a lot of new security features that
   136     altered this behavior.
   137     Since AlloyCI Runner 1.1, when creating a `LaunchAgent`, we don't set
   138     `SessionCreate`. However, in order to upgrade, you need to manually
   139     reinstall the `LaunchAgent` script:
   140  
   141      ```
   142      alloy-runner uninstall
   143      alloy-runner install
   144      alloy-runner start
   145      ```
   146  
   147      Then you can verify that `~/Library/LaunchAgents/alloy-runner.plist` has
   148      `SessionCreate` set to `false`.
   149  
   150  ## `The service did not start due to a logon failure` error when starting service on Windows
   151  
   152  When installing and starting the AlloyCI Runner service on Windows you can
   153  meet with such error:
   154  
   155  ```
   156  $ alloy-runner install --password WINDOWS_MACHINE_PASSWORD
   157  $ alloy-runner start
   158  $ FATA[0000] Failed to start AlloyCI Runner: The service did not start due to a logon failure.
   159  ```
   160  
   161  This error can occur when the user used to execute the service doesn't have
   162  the `SeServiceLogonRight` permission. In such case you need to add this
   163  permission for the chosen user and then try to start the service again.
   164  
   165  You can add `SeServiceLogonRight` in two ways:
   166  
   167  1. Manually using Administrative Tools:
   168     - Go to _Control Panel > System and Security > Administrative Tools_,
   169     - open the _Local Security Policy_ tool,
   170     - chose the _Security Settings > Local Policies > User Rights Assignment_ on the
   171       list on the left,
   172     - open the _Log on as a service_ on the list on the right,
   173     - click on the _Add User or Group..._ button,
   174     - add the user ("by hand" or using _Advanced..._ button) and apply the settings.
   175  
   176       > **Notice:** According to [Microsoft's documentation][microsoft-manually-set-seservicelogonright]
   177       > this should work for: Windows Vista, Windows Server 2008, Windows 7, Windows 8.1,
   178       > Windows Server 2008 R2, Windows Server 2012 R2, Windows Server 2012, Windows 8
   179  
   180       > **Notice:** The _Local Security Policy_ tool may be not available in some
   181       > Windows versions - for example in "Home Edition" variant of each version.
   182  
   183  1. From command line, using the `Ntrights.exe` tool:
   184     - Download tools from [Microsoft's download site][microsoft-ntrights-download],
   185     - execute `ntrights.exe ntrights +r SeServiceLogonRight -u USER_NAME_HERE` (remember,
   186       that you should provide a full path for `ntrights.exe` executable **or** add that
   187       path to system's `PATH` environment variable).
   188  
   189       > **Notice:** The tool was created in 2003 and was initially designed to use
   190       > with Windows XP and Windows Server 2003. On [Microsoft sites][microsoft-ntrights-usage-on-win7]
   191       > you can find an example of usage `Ntrights.exe` that applies to Windows 7 and Windows Server 2008 R2.
   192       > This solution is not tested and because of the age of the software **it may not work
   193       > on newest Windows versions**.
   194  
   195  After adding the `SeServiceLogonRight` for the user used in service configuration,
   196  the command `alloy-runner start` should finish without failures
   197  and the service should be started properly.
   198  
   199  [microsoft-manually-set-seservicelogonright]: https://technet.microsoft.com/en-us/library/dn221981
   200  [microsoft-ntrights-download]: https://www.microsoft.com/en-us/download/details.aspx?id=17657
   201  [microsoft-ntrights-usage-on-win7]: https://technet.microsoft.com/en-us/library/dd548356(WS.10).aspx
   202  
   203  ## `zoneinfo.zip: no such file or directory` error when using `OffPeakTimezone`
   204  
   205  It is possible to configure the timezone in which `OffPeakPeriods`
   206  are described. This feature should work on most Unix systems out of the box. However on some
   207  Unix systems, and probably on most non-Unix systems (including Windows, for which we're providing
   208  Runner's binaries), when used, the Runner will crash at start with an error similar to:
   209  
   210  ```
   211  Failed to load config Invalid OffPeakPeriods value: open /usr/local/go/lib/time/zoneinfo.zip: no such file or directory
   212  ```
   213  
   214  The error is caused by the `time` package in Go. Go uses the IANA Time Zone database to load
   215  the configuration of the specified timezone. On most Unix systems, this database is already present on
   216  one of well-known paths (`/usr/share/zoneinfo`, `/usr/share/lib/zoneinfo`, `/usr/lib/locale/TZ/`).
   217  Go's `time` package looks for the Time Zone database in all those three paths. If it doesn't find any
   218  of them, but the machine has a configured Go development environment (with a proper `$GOPATH`
   219  present for Runner's process), then it will fallback to the `$GOROOT/lib/time/zoneinfo.zip` file.
   220  
   221  If none of those paths are present (for example on a production Windows host) the above error is thrown.
   222  
   223  In case your system has support for the IANA Time Zone database, but it's not available by default, you
   224  can try to install it. For Linux systems it can be done for example by:
   225  
   226  ```bash
   227  # on Debian/Ubuntu based systems
   228  sudo apt-get install tzdata
   229  
   230  # on RPM based systems
   231  sudo yum install tzdata
   232  
   233  # on Linux Alpine
   234  sudo apk add -U tzdata
   235  ```
   236  
   237  If your system doesn't provide this database in a _native_ way, then you can make `OffPeakTimezone`
   238  working by following the steps below:
   239  
   240  1. Downloading the [`zoneinfo.zip`][zoneinfo-file]. Starting with version v9.1.0 you can download
   241     the file from a tagged path. In that case you should replace `latest` with the tag name (e.g., `v9.1.0`)
   242     in the `zoneinfo.zip` download URL.
   243  
   244  1. Store this file in a well known directory. We're suggesting to use the same directory where
   245     the `config.toml` file is present. So for example, if you're hosting Runner on Windows machine
   246     and your config file is stored at `C:\alloy-runner\config.toml`, then save the `zoneinfo.zip`
   247     at `C:\alloy-runner\zoneinfo.zip`.
   248  
   249  1. Set the `ZONEINFO` environment variable containing a full path to the `zoneinfo.zip` file. If you
   250     are starting the Runner using the `run` command, then you can do this with:
   251  
   252      ```bash
   253      ZONEINFO=/etc/alloy-runner/zoneinfo.zip alloy-runner run [other options ...]
   254      ```
   255  
   256      or if using Windows:
   257  
   258      ```powershell
   259      C:\alloy-runner> set ZONEINFO=C:\alloy-runner\zoneinfo.zip
   260      C:\alloy-runner> alloy-runner run [other options ...]
   261      ```
   262  
   263      If you are starting the Runner as a system service then you will need to update/override
   264      the service configuration in a way that is provided by your service manager software
   265      (unix systems) or by adding the `ZONEINFO` variable to the list of environment variables
   266      available for Runner's user through System Settings (Windows).
   267  
   268  [zoneinfo-file]: https://gitlab-runner-downloads.s3.amazonaws.com/latest/zoneinfo.zip