Skip to content

Instantly share code, notes, and snippets.

@mittsh
Last active October 7, 2018 10:13
Show Gist options
  • Save mittsh/4d2b1058a1bd483dc6b7bc45de618045 to your computer and use it in GitHub Desktop.
Save mittsh/4d2b1058a1bd483dc6b7bc45de618045 to your computer and use it in GitHub Desktop.

Installing GitLab CI on Kimsufi

We've taken the approach of running GitLab Runners inside a Docker container. For more infos, see: Run GitLab Runner in a container (GitLab Docs).

Install Linux

Pick the Linux distribution:

Ubuntu Server 18.04 "Bionic Beaver" LTS

Install Docker

Follow the tutorial: How to Install and Use Docker on Ubuntu 18.04.

Configure GitLab Runner

Register the GitLab Runner

sudo docker run -it -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest register
  • Please enter the gitlab-ci coordinator URL: https://gitlab.com/
  • Please enter the gitlab-ci token for this runner: find token on GitLab
  • Please enter the gitlab-ci description for this runner: test-runner-a (give your runner a name)
  • Tags: leave empty
  • Please enter the executor: docker
  • Please enter the default Docker image: alpine:latest

For more details see: Registering Runners (GitLab Docs)

Adjust concurrency

Edit the config file to adjust concurrency:

sudo vi /srv/gitlab-runner/config/config.toml

Set: concurrent = 8 (it's a good practice to set as much concurrency as we have CPU threads available)

Launch the Runner

sudo docker run --detach --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest

Check if runner is running:

sudo docker ps

Stop runner:

sudo docker stop DOCKER_ID

Configure the Docker Daemon

How to Start/Stop the Daemon

sudo service docker start # or stop

Set where Docker stores large files

On Kimsufi servers, the default disk (/dev/md3) mounted on / is small (20 GB), so we'd better store large files like Docker containers on the larger disk (/dev/md4) mounted on /home which is huge (1.8 TB).

Move the path where docker stores the large files: How to move docker's default /var/lib/docker to another directory on Ubuntu/Debian Linux

By default, the path is /var/lib/docker, we'll change it to: /home/docker.

Edit the Docker Service file:

vi /lib/systemd/system/docker.service

Change this line: ExecStart=/usr/bin/docker daemon -H fd://

To this: ExecStart=/usr/bin/docker daemon -g /home/docker -H fd://

Reload services:

systemctl daemon-reload

Stop docker:

service docker stop

Start docker:

service docker start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment