GitLab Runner on QNAP NAS

Andrzej Wojciechowski

QNAP is a popular brand of NAS devices. But it can be made more useful in many ways than just a network drive. Programmers, engineers and such can enable GitLab service via Container Station. That’s quite OK, but what if we want to put our QNAP NAS to actual work and maybe even earn for itself? Apart from the GitLab app, we can also enable GitLab Runner service which will enable the CI/CD (Continuous integration & Continuous Delivery).

While installation of the GitLab app is fairly straightforward, the GitLab Runner service is not as easy to start. So I’ve decided to share my experiences with running the Runner below.

What is GitLab Runner?

Firstly, it’s worth to mention what Gitlab Runner is. It’s simply a service which is used to run jobs specified within GitLab’s CI/CD. At the beginning it gets all necessary data from Gitlab and after completion it sends back the results. So it is a separate service used in conjunction with GitLab to i.e. run tests of the code after each push to a remote repository.

How to run GitLab Runner on QNAP NAS?

In order to install and run GitLab Runner we need to go through the following steps:

  1. Install GitLab app through QNAP’s Container Station.

This point is quite obvious. Without GitLab itself, GitLab Runner would be useless. In order to install GitLab app look for the 3rd section of QNAP’s official support page – it will walk you through.

  1. Edit GitLab app’s configuration file.

In order to enable finding GitLab by GitLab Runner, the GitLab’s address must be set. Go to Container Station>Overview and on the list of services locate “gitlab” and the Edit icon. It should be on the under Actions, close to Stop, Restart and Remove icons.

After clicking the Edit button, a window with YAML file should open containing GitLabs configuration. Edit “GITLAB_HOST” field and put your NAS IP address. Usually it’s something like: 192.168.0.x.

  1. Install GitLab Runner from Container Station.

Go to Container Station>Create and in the search filed type “Gitlab runner”. The first Docker image should be the one you are looking for. Install in by clicking Create button. If you need only very popular tools to run your CI jobs – go with Alpine-based Docker image. It will be lighter and faster. But if you use some non-ubiquitous tools – the Ubuntu-based one might be the way to go.

  1. Register the GitLab Runner in GitLab.

After succesful installation go to Container Station>Overview and locate your GitLab Runner service. It should have the name you specified during installation. Click the Terminal button (it should be in the simmilar plase where Edit icon for GitLab service).

A small window named: Run command should appear. Type in: “gitlab-runner register”. A new tab should open with terminal print-out. From now on you can follow the official GitLabs instructions on Registering the Runners. Just remember to put the address you previously specified during point 2 in GitLab instance URL.

The tokens can be found in GitLab’s project’s settings. The shared tokens (for runners used for many projects) can be found in GitLab’s administrator panel.

As the GitLab Runner is a Docker image itself, I decided to set the Runner executor as “shell”.

This way I managed to setup both Alpine-based and Ubuntu-based GitLab Runners. Have fun!

1 thought on “GitLab Runner on QNAP NAS”

Comments are closed.