From 4edf82d596f075f147b0c77cad3a71f769e59785 Mon Sep 17 00:00:00 2001 From: Mika Bomm Date: Sat, 29 Mar 2025 16:45:43 +0100 Subject: [PATCH] add woodpecker ci --- caddy/services/woodpecker-ci.caddy | 8 ++-- git-server/forgejo/compose.yml | 1 + git-server/woodpecker/.env.example | 15 +++++++ git-server/woodpecker/compose.yml | 67 ++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 git-server/woodpecker/.env.example create mode 100644 git-server/woodpecker/compose.yml diff --git a/caddy/services/woodpecker-ci.caddy b/caddy/services/woodpecker-ci.caddy index e880e4f..d42cdb2 100644 --- a/caddy/services/woodpecker-ci.caddy +++ b/caddy/services/woodpecker-ci.caddy @@ -1,6 +1,6 @@ # External - -# Internal ci.mixel.cloud { - reverse_proxy 192.168.178.4:8151 -} \ No newline at end of file + reverse_proxy 192.168.178.230:3334 +} + +# Internal \ No newline at end of file diff --git a/git-server/forgejo/compose.yml b/git-server/forgejo/compose.yml index 0e2f971..52d91da 100644 --- a/git-server/forgejo/compose.yml +++ b/git-server/forgejo/compose.yml @@ -38,6 +38,7 @@ services: networks: forgejo: + name: forgejo external: false volumes: diff --git a/git-server/woodpecker/.env.example b/git-server/woodpecker/.env.example new file mode 100644 index 0000000..b1fbc31 --- /dev/null +++ b/git-server/woodpecker/.env.example @@ -0,0 +1,15 @@ +# Configures the public Host of Woodpecker e.g. https://ci.mixel.cloud +WOODPECKER_HOST= +# Configures the admin username for Woodpecker e.g. mixel +WOODPECKER_ADMIN= +# Also authorize these organizations in forgejo +WOODPECKER_ORGS= +# Configures where the forgejo instance is publicly available at https://git.mixel.cloud +FORGEJO_URL= + +# These 2 Values have to be generated in the forgejo instance +FORGEJO_CLIENT= +FORGEJO_CLIENT_SECRET= + +# Secret used by the Agent +WOODPECKER_AGENT_SECRET= \ No newline at end of file diff --git a/git-server/woodpecker/compose.yml b/git-server/woodpecker/compose.yml new file mode 100644 index 0000000..ad8ec1a --- /dev/null +++ b/git-server/woodpecker/compose.yml @@ -0,0 +1,67 @@ +services: + woodpecker-server: + image: woodpeckerci/woodpecker-server:v3 + container_name: woodpecker-server + restart: always + ports: + - 3334:3334 # server port - default 8000 + - 3335:3335 # gRPC port - default 9000 + volumes: + # Setup Woodpecker using SQLite (default option) + - woodpecker-server-data:/var/lib/woodpecker/ + environment: + # Wether the instance allowes users to register + - WOODPECKER_OPEN=false + # Public address of the Woodpecker instance + - WOODPECKER_HOST=${WOODPECKER_HOST} + # Enable Forgejo driver + - WOODPECKER_FORGEJO=true + # Configure publicly available Forgejo URL + - WOODPECKER_FORGEJO_URL=${FORGEJO_URL} + # Authorize values for Woodpecker to get redirects from forgejo and authorization + - WOODPECKER_FORGEJO_CLIENT=${FORGEJO_CLIENT} + - WOODPECKER_FORGEJO_SECRET=${FORGEJO_CLIENT_SECRET} + - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET} + # The default admin user for the Woodpecker instance + - WOODPECKER_ADMIN=${WOODPECKER_ADMIN} + # also allow this organization to use woodpecker + - WOODPECKER_ORGS=${WOODPECKER_ORGS} + # redefine ports + - WOODPECKER_SERVER_ADDR=:3334 + - WOODPECKER_GRPC_ADDR=:3335 + networks: + - forgejo + + + woodpecker-agent: + image: woodpeckerci/woodpecker-agent:v3 + container_name: woodpecker-agent + command: agent + restart: always + user: "0:0" + depends_on: + - woodpecker-server + volumes: + - woodpecker-agent-config:/etc/woodpecker + - /var/run/docker.sock:/var/run/docker.sock + environment: + - WOODPECKER_SERVER=woodpecker-server:3335 # where to reach the woodpecker server + # Add the needed secret to the agent + - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET} + # Tell it to search for the forgejo instance in the specific docker network + - WOODPECKER_BACKEND_DOCKER_NETWORK=forgejo + # max tasks per agent + - WOODPECKER_MAX_WORKFLOWS=2 + # gRPC settings for security + #- WOODPECKER_GRPC_VERIFY=true # default + #- WOODPECKER_GRPC_SECURE=true # defaults to false + networks: + - forgejo + +volumes: + woodpecker-server-data: + woodpecker-agent-config: + +networks: + forgejo: + external: true \ No newline at end of file