Skip to content

Commit

Permalink
gitlab: adding working runner
Browse files Browse the repository at this point in the history
  • Loading branch information
tomMoulard committed Nov 30, 2019
1 parent 6df7cae commit b63052b
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 16 deletions.
54 changes: 49 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ $ docker-compose up -d

Now you have my own server configuration


## TODO
### New ideas
- [X] traefik
- [X] gitlab
- [ ] CI/CD worker(s)
- [X] CI/CD worker(s)
- [X] nextcloud
- [X] nginx
- [X] weechat
Expand Down Expand Up @@ -62,8 +61,8 @@ Now you have my own server configuration
### Configuration files
- [ ] have default configuration files
- [X] traefik
- [ ] gitlab
- [ ] gitlab runner
- [X] gitlab
- [X] gitlab runner
- [ ] transmission
- [ ] pastebin
- [ ] nextcloud
Expand Down Expand Up @@ -106,4 +105,49 @@ docker-compose scale nginx=2
| [X] | ${SITE2} | 80, 443 (redirect 80 to 443) |

### Gitlab runner
Find your runner registration token ($REGISTRATION_TOKEN) at `http://GITLAB_HOST/$PROJECT_GROUP/$PROJECT_NAME/settings/ci_cd`.
#### Get the Registration Token
Find your runner registration token ($REGISTRATION_TOKEN) at `http://GITLAB_HOST/$PROJECT_GROUP/$PROJECT_NAME/settings/ci_cd`.

There is **two** way to register the runner:

##### Register via config file
Register the Registration Token to have a Runner Token
```bash
curl -X POST 'http://gitlab.${SITE}/api/v4/runners' --form 'token=$REGISTRATION_TOKEN' --form 'description=The Best Runner'
```

###### Change runner configuration
Now change the token in the [configuration file](https://github.com/tomMoulard/make-my-server/blob/master/gitlab/runner/config.toml).
```toml
[[runners]]
token = "XXXXXXXXXXXXXXXXXXXX"
```
and run the runner
```bash
docker-compose up -d runner
```

##### Register via CLI
Steps:
- up the runner `docker-compose up -d runner`
- register the runner
```bash
docker-compose exec runner gitlab-runner register \
--non-interactive \
--executor "docker" \
--docker-image alpine:latest \
--url "http://gitlab/" \
--registration-token "$REGISTRATION_TOKEN" \
--description "The Best Runner" \
--tag-list "docker,aws" \
--run-untagged="true" \
--locked="false" \
--access-level="not_protected"
```

# Authors
Main author:
- [Tom](tom.moulard.org)

Gitlab helper:
- [michel_k](mailto:thomas.michelot@epita.fr)
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ services:
- gitlab
labels:
- 'traefik.enable=false'
environment:
- 'GITLAB_URL=https://gitlab.${SITE}/'
- 'GITLAB_TOKEN=_p9fW2gr4GiqAP6zrsaT'

nginx:
image: nginx:stable-alpine
Expand Down
31 changes: 23 additions & 8 deletions gitlab/runner/config.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
concurrent = 10
check_interval = 1
log_level = "info"
log_format = "json"
log_level = "warning"

[session_server]
session_timeout = 1800

[[runners]]
url = "http://gitlab/"
name = "runner #1"
limit = 0
executor = "docker"
environment = ["ENV=value", "LC_ALL=en_US.UTF-8"]
[runners.docker]
image = "ubuntu:19.04"
token = ""
name = "The Best Runner"
url = "http://gitlab/"
executor = "docker"
[runners.custom_build_dir]
[runners.docker]
tls_verify = false
image = "ubuntu:19.04"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.custom]
run_exec = ""

0 comments on commit b63052b

Please sign in to comment.