runner/examples/docker-compose/compose-forgejo-and-runner.yml

95 lines
3 KiB
YAML
Raw Normal View History

# Copyright 2024 The Forgejo Authors.
2023-08-24 12:28:17 +02:00
# SPDX-License-Identifier: MIT
#
# Create a secret with:
#
# openssl rand -hex 20
#
# Replace all occurrences of {SHARED_SECRET} below with the output.
#
# NOTE: a token obtained from the Forgejo web interface cannot be used
# as a shared secret.
#
# Replace {ROOT_PASSWORD} with a secure password
#
volumes:
docker_certs:
2023-08-24 12:28:17 +02:00
services:
docker-in-docker:
image: code.forgejo.org/oci/docker:dind
hostname: docker # Must set hostname as TLS certificates are only valid for docker or localhost
2024-08-13 08:37:52 +02:00
privileged: true
environment:
DOCKER_TLS_CERTDIR: /certs
DOCKER_HOST: docker-in-docker
volumes:
- docker_certs:/certs
2023-08-24 12:28:17 +02:00
forgejo:
image: code.forgejo.org/forgejo/forgejo:11.0
2023-08-24 12:28:17 +02:00
command: >-
bash -c '
/usr/bin/s6-svscan /etc/s6 &
2023-08-24 12:28:17 +02:00
sleep 10 ;
su -c "forgejo forgejo-cli actions register --secret {SHARED_SECRET}" git ;
su -c "forgejo admin user create --admin --username root --password {ROOT_PASSWORD} --email root@example.com" git ;
2023-08-24 12:28:17 +02:00
sleep infinity
'
environment:
FORGEJO__security__INSTALL_LOCK: "true"
FORGEJO__log__LEVEL: "debug"
FORGEJO__repository__ENABLE_PUSH_CREATE_USER: "true"
FORGEJO__repository__DEFAULT_PUSH_CREATE_PRIVATE: "false"
FORGEJO__repository__DEFAULT_REPO_UNITS: "repo.code,repo.actions"
volumes:
- /srv/forgejo-data:/data
ports:
- 8080:3000
runner-register:
Update code.forgejo.org/forgejo/runner Docker tag to v7 (#704) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [code.forgejo.org/forgejo/runner](https://forgejo.org) ([source](https://code.forgejo.org/forgejo/runner)) | major | `6.3.1` -> `7.0.0` | --- ### Release Notes <details> <summary>forgejo/runner (code.forgejo.org/forgejo/runner)</summary> ### [`v7.0.0`](https://code.forgejo.org/forgejo/runner/blob/HEAD/RELEASE-NOTES.md#700) [Compare Source](https://code.forgejo.org/forgejo/runner/compare/v6.4.0...v7.0.0) - Breaking change: [forgejo-runner exec --forgejo-instance replaces --gitea-instance](https://code.forgejo.org/forgejo/runner/pulls/652). - [fix a v6.4.0 regression that fail a job when if: false](https://code.forgejo.org/forgejo/runner/issues/660). - [forge.FORGEJO\_\* can be used instead of github.GITHUB\_\*](https://code.forgejo.org/forgejo/act/pulls/171), e.g. `forge.FORGEJO_REPOSITORY` is the same as `github.GITHUB_REPOSITORY`. The `GITHUB_*` environment variables are preserved indefinitely for backward compatibiliy with existing workflows and actions. - [support for forgejo-runner exec --var](https://code.forgejo.org/forgejo/runner/pulls/645). - [do not force WORKING\_DIR in service containers](https://code.forgejo.org/forgejo/runner/issues/304). - [remove the local action cache if the remote has changed](https://code.forgejo.org/forgejo/act/pulls/142), e.g. when [DEFAULT\_ACTIONS\_URL](https://forgejo.org/docs/next/admin/config-cheat-sheet/#actions-actions) is modified in the forgejo configuration. ### [`v6.4.0`](https://code.forgejo.org/forgejo/runner/blob/HEAD/RELEASE-NOTES.md#640) [Compare Source](https://code.forgejo.org/forgejo/runner/compare/v6.3.1...v6.4.0) **Do not use, it [contains a regression](https://code.forgejo.org/forgejo/runner/issues/660) fixed in 7.0.0.** - [Update code.forgejo.org/forgejo/act](https://code.forgejo.org/forgejo/runner/pulls/571) to v1.26.0. This brings [several security updates](https://code.forgejo.org/forgejo/act/compare/v1.25.1...v1.26.0), as well as [offline action caching](https://code.forgejo.org/forgejo/act/commit/613090ecd71f75e6200ded4c9d5424b26a792755). - [Remove unused x-runner-version header](https://code.forgejo.org/forgejo/runner/pulls/496). - [Upgrade lxc-systemd using a URL instead of a version](https://code.forgejo.org/forgejo/runner/pulls/520). - [Correctly use HTTP proxy if insecure is true](https://code.forgejo.org/forgejo/runner/pulls/535). - [Update golang.org/x/crypto](https://code.forgejo.org/forgejo/runner/pulls/562) to a version that is not susceptible to DOS attack. - [Update golang.org/x/net](https://code.forgejo.org/forgejo/runner/pulls/563) to a version with several security fixes. </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4zMi4xIiwidXBkYXRlZEluVmVyIjoiNDEuMzIuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/704 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Co-authored-by: Renovate Bot <bot@kriese.eu> Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-07-16 08:01:17 +00:00
image: code.forgejo.org/forgejo/runner:7.0.0
2023-08-24 12:28:17 +02:00
links:
- docker-in-docker
- forgejo
environment:
DOCKER_HOST: tcp://docker-in-docker:2376
2023-08-24 12:28:17 +02:00
volumes:
- /srv/runner-data:/data
user: 0:0
command: >-
bash -ec '
2023-08-24 12:28:17 +02:00
while : ; do
forgejo-runner create-runner-file --connect --instance http://forgejo:3000 --name runner --secret {SHARED_SECRET} && break ;
2023-08-24 12:28:17 +02:00
sleep 1 ;
done ;
sed -i -e "s|\"labels\": null|\"labels\": [\"docker-cli:docker://code.forgejo.org/oci/docker:cli\",\"node-bookworm:docker://code.forgejo.org/oci/node:20-bookworm\"]|" .runner ;
2023-08-24 12:28:17 +02:00
forgejo-runner generate-config > config.yml ;
sed -i -e "s| level: info| level: debug|" config.yml ;
sed -i -e "s|network: .*|network: host|" config.yml ;
sed -i -e "s|^ envs:$$| envs:\n DOCKER_HOST: tcp://docker:2376\n DOCKER_TLS_VERIFY: 1\n DOCKER_CERT_PATH: /certs/client|" config.yml ;
sed -i -e "s|^ options:| options: -v /certs/client:/certs/client|" config.yml ;
sed -i -e "s| valid_volumes: \[\]$$| valid_volumes:\n - /certs/client|" config.yml ;
2023-08-24 12:28:17 +02:00
chown -R 1000:1000 /data
'
runner-daemon:
Update code.forgejo.org/forgejo/runner Docker tag to v7 (#704) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [code.forgejo.org/forgejo/runner](https://forgejo.org) ([source](https://code.forgejo.org/forgejo/runner)) | major | `6.3.1` -> `7.0.0` | --- ### Release Notes <details> <summary>forgejo/runner (code.forgejo.org/forgejo/runner)</summary> ### [`v7.0.0`](https://code.forgejo.org/forgejo/runner/blob/HEAD/RELEASE-NOTES.md#700) [Compare Source](https://code.forgejo.org/forgejo/runner/compare/v6.4.0...v7.0.0) - Breaking change: [forgejo-runner exec --forgejo-instance replaces --gitea-instance](https://code.forgejo.org/forgejo/runner/pulls/652). - [fix a v6.4.0 regression that fail a job when if: false](https://code.forgejo.org/forgejo/runner/issues/660). - [forge.FORGEJO\_\* can be used instead of github.GITHUB\_\*](https://code.forgejo.org/forgejo/act/pulls/171), e.g. `forge.FORGEJO_REPOSITORY` is the same as `github.GITHUB_REPOSITORY`. The `GITHUB_*` environment variables are preserved indefinitely for backward compatibiliy with existing workflows and actions. - [support for forgejo-runner exec --var](https://code.forgejo.org/forgejo/runner/pulls/645). - [do not force WORKING\_DIR in service containers](https://code.forgejo.org/forgejo/runner/issues/304). - [remove the local action cache if the remote has changed](https://code.forgejo.org/forgejo/act/pulls/142), e.g. when [DEFAULT\_ACTIONS\_URL](https://forgejo.org/docs/next/admin/config-cheat-sheet/#actions-actions) is modified in the forgejo configuration. ### [`v6.4.0`](https://code.forgejo.org/forgejo/runner/blob/HEAD/RELEASE-NOTES.md#640) [Compare Source](https://code.forgejo.org/forgejo/runner/compare/v6.3.1...v6.4.0) **Do not use, it [contains a regression](https://code.forgejo.org/forgejo/runner/issues/660) fixed in 7.0.0.** - [Update code.forgejo.org/forgejo/act](https://code.forgejo.org/forgejo/runner/pulls/571) to v1.26.0. This brings [several security updates](https://code.forgejo.org/forgejo/act/compare/v1.25.1...v1.26.0), as well as [offline action caching](https://code.forgejo.org/forgejo/act/commit/613090ecd71f75e6200ded4c9d5424b26a792755). - [Remove unused x-runner-version header](https://code.forgejo.org/forgejo/runner/pulls/496). - [Upgrade lxc-systemd using a URL instead of a version](https://code.forgejo.org/forgejo/runner/pulls/520). - [Correctly use HTTP proxy if insecure is true](https://code.forgejo.org/forgejo/runner/pulls/535). - [Update golang.org/x/crypto](https://code.forgejo.org/forgejo/runner/pulls/562) to a version that is not susceptible to DOS attack. - [Update golang.org/x/net](https://code.forgejo.org/forgejo/runner/pulls/563) to a version with several security fixes. </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4zMi4xIiwidXBkYXRlZEluVmVyIjoiNDEuMzIuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/704 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Co-authored-by: Renovate Bot <bot@kriese.eu> Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-07-16 08:01:17 +00:00
image: code.forgejo.org/forgejo/runner:7.0.0
2023-08-24 12:28:17 +02:00
links:
- docker-in-docker
- forgejo
environment:
DOCKER_HOST: tcp://docker:2376
DOCKER_CERT_PATH: /certs/client
DOCKER_TLS_VERIFY: "1"
2023-08-24 12:28:17 +02:00
volumes:
- /srv/runner-data:/data
- docker_certs:/certs
command: >-
bash -c '
while : ; do test -w .runner && forgejo-runner --config config.yml daemon ; sleep 1 ; done
'