From 5b4cf85ec11f5de43af4a4560b22fa94477168e6 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Sat, 24 Feb 2024 18:42:20 -0500 Subject: [PATCH 1/2] Better explain how to integrate Forgejo and Woodpecker CI After fiddling quite a bit with this setup, I think it's only fair if I expand the documentation and explain how to integrate both services. Signed-off-by: Sergio Durigan Junior --- docs/services/forgejo.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/services/forgejo.md b/docs/services/forgejo.md index 70b9301..80b1774 100644 --- a/docs/services/forgejo.md +++ b/docs/services/forgejo.md @@ -57,3 +57,22 @@ Going there, you'll be taken to the initial setup wizard, which will let you ass ## Recommended other services You may also wish to look into [Woodpecker CI](woodpecker-ci.md), which can integrate nicely with Forgejo. + + +## Integration with Woodpecker CI + +If you want to integrate Forgejo with [Woodpecker CI](woodpecker-ci.md), and if you plan to serve Woodpecker CI under a subpath on the same host as Forgejo (e.g., Forgejo lives at `https://mash.example.com` and Woodpecker CI lives at `https://mash.example.com/ci`), then you need to configure Forgejo to use the host's external IP when invoking webhooks from Woodpecker CI. You can do it by setting the following variables: + +```yaml +forgejo_container_add_host_domain_name: "{{ devture_woodpecker_ci_server_hostname }}" +forgejo_container_add_host_domain_ip_address: "{{ ansible_host }}" +``` + +You will also need to edit Forgejo's configuration file (which lives under `/mash/forgejo/config/app.ini` on the host) and allow the service to communicate with your host's IP: + +``` +[webhook] +ALLOWED_HOST_LIST = A.B.C.D +``` + +In the example above, replace `A.B.C.D` with your host's IP address. From 2f75378f7a4fd63d24cbf4b40d30d68ccba8a784 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 25 Feb 2024 17:09:08 +0200 Subject: [PATCH 2/2] Redo webhook.ALLOWED_HOST_LIST in a better way --- docs/services/forgejo.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/services/forgejo.md b/docs/services/forgejo.md index 80b1774..3db6ea0 100644 --- a/docs/services/forgejo.md +++ b/docs/services/forgejo.md @@ -66,13 +66,10 @@ If you want to integrate Forgejo with [Woodpecker CI](woodpecker-ci.md), and if ```yaml forgejo_container_add_host_domain_name: "{{ devture_woodpecker_ci_server_hostname }}" forgejo_container_add_host_domain_ip_address: "{{ ansible_host }}" -``` - -You will also need to edit Forgejo's configuration file (which lives under `/mash/forgejo/config/app.ini` on the host) and allow the service to communicate with your host's IP: +# If ansible_host points to an internal IP address, you may need to allow Forgego to make requests to it. +# By default, requests are only allowed to external IP addresses for security reasons. +# See: https://forgejo.org/docs/latest/admin/config-cheat-sheet/#webhook-webhook +forgejo_container_additional_environment_variables: | + FORGEJO__webhook__ALLOWED_HOST_LIST=external,{{ ansible_host }} ``` -[webhook] -ALLOWED_HOST_LIST = A.B.C.D -``` - -In the example above, replace `A.B.C.D` with your host's IP address.