GitLab Runner (gitlab-ci-multi-runner) on Uberspace

This post describes how to setup gitlab-ci-multi-runner (aka GitLab Runner) on an Uberspace using the shell executor.

Download gitlab-ci-multi-runner

Download the Runner binary into the ~/bin  directory and make it executable:

Create a working directory for the Runner:

Get configuration details for the Runner

In your GitLab project navigate to Settings > CI/CD Pipelines. Find the URL for the runner setup and the registration token as shown in the picture below:

Register the Runner

Provide the configuration details when asked and be careful to choose shell as executor:

Create a daemon to start the Runner

Create a daemon to start your GitLab Runner automatically on reboot and have it supervised. See https://wiki.uberspace.de/system:daemontools for reference.

First, setup your service directory:

Create a script called gitlab-ci  inside your ~/bin  directory. Note the exec command which prevents spawning a new process and allows the daemontools to fully control the Runner:

Make the script executable:

Activate the daemon:

For details on how to manage a daemon see https://wiki.uberspace.de/system:daemontools#wenn_der_daemon_laeuft

That’s it!

Your GitLab Runner should now be ready to process your builds if your project is configured correctly. See https://docs.gitlab.com/ce/ci/ for reference.

Posted in git | Comments Off on GitLab Runner (gitlab-ci-multi-runner) on Uberspace

Chrome 56: Install and use Extensions

Starting with Chrome 56 on Debian you might end up having no Extensions. To re-enable them again you have to start Chrome with

To make this a default add this flag to the default flags in /etc/chromium.d/default-flags:

Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851927

Posted in Debian | Comments Off on Chrome 56: Install and use Extensions

Waiting for server to accept SSH connections

Sometimes you need to wait for a just booted server to accept SSH connections. This can be solved with a one-line bash script:

 

Posted in Debian, Ubuntu | Comments Off on Waiting for server to accept SSH connections

npm install fails with “npm ERR! tar.unpack untar error”

Problem

npm failed randomly while installing packages. It didn’t matter which packages or if running on Debian itself or inside virtual machines using Ubuntu (vagrant). Upgrading npm to the latest version ( sudo npm install -g npm@latest ) and clearing npm’s cache ( npm cache clean ) didn’t help either.

After examining the downloaded temporary packages in /tmp  I realized that they were corrupt. The corrupt packages changed randomly on every download attempt. Changing the temporary directory from /tmp  to another location did not resolve the issue. Every user on the machine was affected by the problem.

Since the issue occured on every platform for every user, inside vagrant-VMs and even on different machines (Laptop, Desktop-PC, …) it was soon clear that the solution probably had nothing to do with npm.

After weeks of troubleshooting without any result I realized that the problem only ocurred when running the command at home. The command executed fine when my Laptop was inside other networks. This led me to the conclusion that the network configuration was the cause of all problems. Since all machines received their settings via DHCP my first try was to manually define the DNS settings.

Et voilà: Everything worked as expected.

Solution

Change the DNS servers you use. You’re probably using the default servers provided by your ISP. There are plenty of other public DNS servers out there. For a quick test you might even use the ones operated by Google:  8.8.8.8  and 8.8.4.4 .

Posted in Debian, Node.js, Ubuntu, Vagrant | Comments Off on npm install fails with “npm ERR! tar.unpack untar error”

Simulate the environment of Cron Jobs

Often you will find yourself in the situation that one of your cron jobs works perfectly if you execute it manually but fails as soon as is gets executed by cron. The root cause might be the different environment. To simulate the environment of a cron job add the following entry to your crontab using crontab -e:

This will create the file cronenv in your root directory and dump all available environment variables into it. Once the file was created remove the entry from your crontab and take a look at its contents:

This pretty much sums up the environment. To enter this environment use the following command:

Now you can execute your cron job command, see what happens and fix your error. Once you’re done simply type exit to leave the environment.

See this Stack Overflow answer for more information.

Posted in Debian, Ubuntu | Comments Off on Simulate the environment of Cron Jobs