Skip to content

Commit 14e556b

Browse files
committed
feat(docs): add cache section to docker gitlab
Signed-off-by: Evgeniy Frolov <[email protected]>
1 parent 87ef490 commit 14e556b

2 files changed

Lines changed: 71 additions & 9 deletions

File tree

bin/configurator/static/_includes/en/configurator/partials/ci/gitlab_docker_main_section.md.liquid

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Install GitLab Runner on its dedicated host by following the [official instructi
1616

1717
Follow [official instructions](https://docs.gitlab.com/runner/register/index.html) to register GitLab Runner in GitLab; specify Docker as the executor and any image as the image (e.g. `alpine`).
1818

19-
### Configuring GitLab Runner
19+
### Configuring GitLab Runner without caching
2020

2121
On the GitLab Runner host, open its `config.toml` configuration file and add the following options to the GitLab Runner you registered earlier:
2222

@@ -28,7 +28,40 @@ On the GitLab Runner host, open its `config.toml` configuration file and add the
2828
volumes = ["/home/build/.werf"]
2929
```
3030

31-
If the GitLab Runner host runs Linux kernel version 5.12 or lower, install `fuse` on the host and add an extra option to the `config.toml` file:
31+
### Configuring GitLab Runner with caching support
32+
33+
On the GitLab Runner host, run the following commands:
34+
35+
```bash
36+
# Create necessary directories and set permissions
37+
mkdir -p $HOME/.local/share/containers
38+
sudo chown -R 1000:1000 $HOME/.local/
39+
chmod 755 /home/ubuntu/.local/share/containers
40+
```
41+
42+
Then start the GitLab Runner container:
43+
44+
```bash
45+
docker run -d --name gitlab-runner --restart always \
46+
-v $HOME/.local/share/containers:/home/ubuntu/.local/share/containers \
47+
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
48+
-v /var/run/docker.sock:/var/run/docker.sock \
49+
gitlab/gitlab-runner:latest
50+
```
51+
52+
Open the `config.toml` configuration file and add the following options:
53+
54+
```toml
55+
[[runners]]
56+
name = "<name of the Runner you registered>"
57+
[runners.docker]
58+
security_opt = ["seccomp:unconfined", "apparmor:unconfined"]
59+
volumes = ["/home/build/.werf", "/home/ubuntu/.local/share/containers:/home/build/.local/share/containers"]
60+
```
61+
62+
### Using FUSE on older Linux kernels
63+
64+
If the GitLab Runner host runs Linux kernel version 5.12 or lower, install `fuse` on the host and add the following option to the `config.toml` file:
3265

3366
```toml
3467
[[runners]]
@@ -45,9 +78,8 @@ If needed, perform [additional configuration](https://docs.gitlab.com/runner/con
4578

4679
{% include configurator/partials/ci/cross_platform_note.md.liquid %}
4780

48-
49-
Register emulators on your system using qemu-user-static:
81+
Register emulators on your system using the `qemu-user-static` image:
5082

5183
```shell
5284
docker run --restart=always --name=qemu-user-static -d --privileged --entrypoint=/bin/sh multiarch/qemu-user-static -c "/register --reset -p yes && tail -f /dev/null"
53-
```
85+
```

bin/configurator/static/_includes/ru/configurator/partials/ci/gitlab_docker_main_section.md.liquid

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
Для регистрации GitLab Runner в GitLab следуйте [официальным инструкциям](https://docs.gitlab.com/runner/register/index.html), указав Docker в качестве executor'а и любой образ в качестве image (например, `alpine`).
1818

19-
### Настройка GitLab Runner
19+
### Настройка GitLab Runner без кэширования
2020

21-
На хосте GitLab Runner откройте его конфигурационный файл `config.toml` и добавьте зарегистрированному ранее GitLab Runner следующие опции:
21+
На хосте GitLab Runner откройте его конфигурационный файл `config.toml` и добавьте зарегистрированному ранее GitLab Runner следующие опции:
2222

2323
```toml
2424
[[runners]]
@@ -28,7 +28,37 @@
2828
volumes = ["/home/build/.werf"]
2929
```
3030

31-
Если хост GitLab Runner'а имеет версию ядра Linux 5.12 или ниже, то установите на хост `fuse` и добавьте в файл `config.toml` ещё одну опцию:
31+
### Настройка GitLab Runner с поддержкой кэширования
32+
33+
На хосте GitLab Runner выполните следующие команды:
34+
```bash
35+
# Создание необходимых директорий и прав
36+
mkdir -p $HOME/.local/share/containers
37+
sudo chown -R 1000:1000 $HOME/.local/
38+
chmod 755 /home/ubuntu/.local/share/containers
39+
```
40+
41+
После чего нужно запустить gitlab-runner следующим образом:
42+
```bash
43+
docker run -d --name gitlab-runner --restart always \
44+
-v $HOME/.local/share/containers:/home/ubuntu/.local/share/containers \
45+
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
46+
-v /var/run/docker.sock:/var/run/docker.sock \
47+
gitlab/gitlab-runner:latest
48+
```
49+
50+
На хосте GitLab Runner откройте его конфигурационный файл `config.toml` и добавьте зарегистрированному ранее GitLab Runner следующие опции:
51+
```toml
52+
[[runners]]
53+
name = "<имя зарегистрированного Runner'а>"
54+
[runners.docker]
55+
security_opt = ["seccomp:unconfined", "apparmor:unconfined"]
56+
volumes = ["/home/build/.werf", "/home/ubuntu/.local/share/containers:/home/build/.local/share/containers"]
57+
```
58+
59+
### Использование FUSE на старых ядрах Linux
60+
61+
Если хост GitLab Runner имеет версию ядра Linux 5.12 или ниже, то установите на хост `fuse` и добавьте в файл `config.toml` ещё одну опцию:
3262

3363
```toml
3464
[[runners]]
@@ -37,7 +67,7 @@
3767
devices = ["/dev/fuse"]
3868
```
3969

40-
При желании произведите [дополнительную конфигурацию](https://docs.gitlab.com/runner/configuration/advanced-configuration.html) GitLab Runner.
70+
При желании произведите [дополнительную конфигурацию](https://docs.gitlab.com/runner/configuration/advanced-configuration.html) GitLab Runner.
4171

4272
{% include configurator/partials/ci/configuring_the_container_registry.md.liquid %}
4373

0 commit comments

Comments
 (0)