61 lines
2.6 KiB
Markdown
61 lines
2.6 KiB
Markdown
# Forgejo runner
|
|
|
|
> The Forgejo Runner is a daemon that fetches workflows to run from a Forgejo instance, executes them, sends back with the logs and ultimately reports its success or failure.
|
|
|
|
!! WARNING: This recipe should be used with great caution, since it has access to the docker daemon. We recommend running it in a seperate vm or host !!
|
|
|
|
<!-- metadata -->
|
|
* **Category**: Utilities
|
|
* **Status**: testing
|
|
* **LICENSE**: [GPLv3-or-later](https://code.forgejo.org/forgejo/runner/src/branch/main/LICENSE)
|
|
* **Maintainer**: [@p4u1](https://git.coopcloud.tech/p4u1)
|
|
* **Repository**: [code.forgejo.org/forgejo/runner](https://code.forgejo.org/forgejo/runner)
|
|
* **Documentation**: [forgejo.org/docs/next/admin/actions/](https://forgejo.org/docs/next/admin/actions/)
|
|
* **Image**: [`runner`](https://code.forgejo.org/forgejo/-/packages/container/runner/11), 4, upstream
|
|
* **Healthcheck**: Yes
|
|
* **Backups**: N/A
|
|
* **Email**: N/A
|
|
* **Tests**: 0
|
|
* **SSO**: N/A
|
|
<!-- endmetadata -->
|
|
|
|
## Registering
|
|
|
|
The forgejo runner needs to be registered at the forgejo instance. For that see the [official documentation](https://forgejo.org/docs/latest/admin/runner-installation/#standard-registration) on how to create a token.
|
|
|
|
```
|
|
abra app cmd --chaos <app> app register_runner <host> <name> <token>
|
|
```
|
|
|
|
## Enabling caching
|
|
|
|
To enable [caching](https://forgejo.org/docs/latest/admin/runner-installation/#cache-configuration) set `CACHE_ENABLED` to `true`:
|
|
```
|
|
CACHE_ENABLED=true
|
|
CACHE_HOST="app"
|
|
```
|
|
|
|
If you want to use the caching of the runner itself, you have to specify "app" as the `CACHE_HOST` and make sure to use the `default` in `CONTAINER_NETWORK` (see below), so the actions containers can access the runner.
|
|
|
|
|
|
## Docker in Docker (in Docker)
|
|
|
|
Per default, the action container has the ability to access the docker socket of the host machine via the socket proxy in this recipe. Keep this in mind, since this is a security concern!
|
|
|
|
If you don't set anything in the `CONTAINER_NETWORK` env, the runner is configured to their own dedicated network and so can't reach the docker socket proxy.
|
|
|
|
If you set `CONTAINER_NETWORK` to `default`, the runner attaches the started containers to the internal network of this recipe, so the socket proxy can be reached (via it's dns name).
|
|
|
|
This allows you to access the docker host at "tcp://socket-proxy:2375". See this part of an action workflow on how to access the docker host.
|
|
```
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
endpoint: tcp://socket-proxy:2375
|
|
platforms: linux/amd64
|
|
- name: run api tests
|
|
run: |
|
|
export DOCKER_HOST="tcp://socket-proxy:2375"
|
|
make test-api
|
|
```
|