-
André Anjos authoredAndré Anjos authored
Deploying a Linux-based CI
This document contains instructions to build and deploy a new bare-OS CI for Linux. Instructions for deployment assume a freshly installed machine, with Idiap's latest Debian distribution running. Our builds use Docker images. We also configure docker-in-docker to enable to run docker builds (and other tests) within docker images.
Warning
Idiap has throttling rules that are typically applied to all machines in the lab network. To avoid issues for newly installed CI nodes, ensure you request throttling to be disabled for new CI machines.
Docker and Gitlab-runner setup
Base docker installation: https://secure.idiap.ch/intranet/system/software/docker
Ensure to add/configure for auto-loading the overlay
kernel module in
/etc/modules
. Then update/create /etc/docker/daemon.json
to contain
the entry "storage-driver": "overlay2"
.
To ensure that you can control memory and CPU usage for launched docker
containers, you'll need to enable "cgroups" on your machine. In essence,
change /etc/default/grub
to contain the line
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
. Then, re-run
update-grub
after such change.
To install docker at Idiap, you also need to follow the security guidelines.
If you do not follow these guidelines, the machine will not be accessible from outside via the login gateway, as the default docker installation conflicts with Idiap's internal setup. You may also find other network connectivity issues.
Also, you want to place /var/lib/docker
on a fast disk. Normally, we
have a scratch partition for this. Follow the instructions at
https://linuxconfig.org/how-to-move-docker-s-default-var-lib-docker-to-another-directory-on-ubuntu-debian-linux
for this step:
$ mkdir /scratch/docker
$ chmod g-rw,o-rw /scratch/docker
$ service docker stop
$ rsync -aqxP /var/lib/docker/ /scratch/docker
$ rm -rf /var/lib/docker
$ vim /etc/docker/daemon.json # add data-root -> /scratch/docker
$ service docker start
Reboot the machine to ensure everything works fine.
Hosts section
We re-direct calls to www.idiap.ch to our internal server, for speed. Just add this to /etc/hosts:
$ echo "" >> /etc/hosts
$ echo "#We fake www.idiap.ch to keep things internal" >> /etc/hosts
$ echo "What is the internal server IPv4 address?"
$ read ipv4add
$ echo "${ipv4add} www.idiap.ch" >> /etc/hosts
$ echo "What is the internal server IPv6 address?"
$ read ipv6add
$ echo "${ipv6add} www.idiap.ch" >> /etc/hosts
Note
You should obtain the values of the internal IPv4 and IPv6 addresses from inside the Idiap network. We cannot replicate them in this manual for security reasons.
Gitlab runner configuration
Once that is setup, install gitlab-runner from https://docs.gitlab.com/runner/install/linux-repository.html, and then register it https://docs.gitlab.com/runner/register/.