Commit graph

16 commits

Author SHA1 Message Date
CTO
8dffba2c52 fix(forgejo-runner): pin to nodes with docker installed (DEV-498)
Rolling OS updates removed docker.io from all workers, breaking the
runner's hostPath mount of /var/run/docker.sock (type=Socket check).

- Install docker.io on all 5 worker nodes and enable the systemd unit.
- Label the nodes basicstack.de/docker=true so the dependency is explicit.
- Add nodeSelector to the Deployment so scheduling fails fast on
  non-labeled nodes instead of hanging in ContainerCreating.
- Document the node prerequisite in the README.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-08-16 20:15:16 +00:00
CTO Agent
8c389f7082 fix: revert to Deployment with host Docker socket (dind approach abandoned)
dind sidecar had networking issue: host-networked job containers can't reach
the dind daemon inside the pod. Back to host socket with docker binary
bind-mounted into job containers via container.options.
2026-07-18 16:47:05 +00:00
CTO Agent
747e6935b7 fix: install Docker CLI in forgejo-runner container
The forgejo-runner image doesn't include Docker CLI by default, causing
the startup script to hang waiting for Docker to be ready. Install
docker-cli via apk during startup to enable Docker socket access.

This completes the DinD setup for the runner.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 16:43:56 +00:00
CTO Agent
27397fe859 feat: migrate Forgejo runner to StatefulSet with Docker-in-Docker
Replaces the Deployment-based runner with a StatefulSet using a proper
Docker-in-Docker sidecar for improved isolation and state management.

Key changes:
- StatefulSet deployment for stable pod identity and persistent storage
- Docker-in-Docker init container (privileged) providing isolated Docker daemon
- Two persistent volumes: runner-data (1Gi) for config, docker-data (20Gi) for image cache
- Uses hcloud-volumes storage class for durability
- Each replica gets its own Docker daemon and image cache

This addresses the workflow failure where job containers (node:24-bookworm)
couldn't access Docker because the CLI was missing. The DinD sidecar provides
a complete Docker environment for all job containers.

Fixes: DEV-335

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 16:41:20 +00:00
CTO Agent
d74a72c130 fix: bind-mount host docker binary into job containers 2026-07-18 16:40:32 +00:00
CTO Agent
d41a24be2b debug: enable debug logging in runner config 2026-07-18 16:36:58 +00:00
CTO Agent
4bc564152e fix: remove duplicate docker socket mount from runner container options
act_runner v4.0.1 automatically propagates the docker socket when
DOCKER_HOST env var is set. Adding the socket via 'container.options'
caused duplicate bind mounts which made Docker fail container creation.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 16:28:27 +00:00
CTO Agent
3dbf0758d1 fix: mount Docker socket into job containers via runner container options
Job containers need access to the host Docker socket to run docker
build/push commands. Adding -v /var/run/docker.sock:/var/run/docker.sock
to container options so docker CLI in job containers can reach the
host Docker daemon.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 16:15:04 +00:00
1d525e6f5a apps/forgejo-runner/README.md aktualisiert 2026-07-18 16:12:11 +00:00
CTO Agent
2f006b6359 fix: register runner with external URL so job containers can resolve Forgejo
Docker containers launched by the runner on the host cannot resolve
forgejo.forgejo.svc.cluster.local (k8s cluster DNS is not available
from host Docker containers). Switching to https://forgejo.basicstack.de
for runner registration so GITHUB_SERVER_URL in job context uses the
externally reachable URL, fixing git fetch in actions/checkout.

Also adds detection to force re-registration if a pod starts with the
old internal-URL .runner file still present.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 16:10:57 +00:00
CTO Agent
e86b9fa29c fix: remove user restriction from runner containers to allow apt-get
Remove --user 1000:1000 option to allow workflow containers to run as root.
This is needed for the Docker CLI installation step which requires root
permissions for apt-get commands.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 15:56:38 +00:00
CTO Agent
46fa658a4e fix: use host network for runner containers to access cluster DNS
Change runner container network from bridge to host to allow workflow
containers to resolve Kubernetes service DNS names. With bridge network,
containers couldn't resolve forgejo.forgejo.svc.cluster.local.

Using host network gives containers access to the cluster's DNS resolver.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 15:52:20 +00:00
CTO Agent
65a293999f fix: add DNS resolution for Forgejo service in runner containers
Add --add-host mapping for forgejo.forgejo.svc.cluster.local to the
Forgejo service ClusterIP (10.102.251.20) in the runner container options.

This fixes the DNS resolution issue where workflow containers created by
the runner (via Docker-in-Docker) cannot resolve Kubernetes service DNS
names, causing the actions/checkout step to fail with "Could not resolve
host: forgejo.forgejo.svc.cluster.local".

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 15:49:28 +00:00
CTO Agent
0c66aa5eb6 fix: add security context to Forgejo runner for Docker socket access
Run the forgejo-runner container as root (uid 0) to allow access to the
Docker socket. This is required for Docker-in-Docker functionality needed
by Forgejo Actions workflows.

Without this, the runner fails with "permission denied" when trying to
access /var/run/docker.sock.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 15:46:54 +00:00
CTO Agent
64ce55d21f feat: add Forgejo runner registration token secret
Create sealed secret for forgejo-runner-token to enable Forgejo Actions
runner deployment. This token allows the runner to register with the
Forgejo instance and execute CI/CD workflows.

Fixes basicstack.org workflow failures (DEV-335) caused by missing runner.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 15:45:33 +00:00
CTO Agent
2ad8fc67b8 Add Forgejo Actions runner deployment configuration
Create runner deployment with:
- ServiceAccount and RBAC for runner pod
- ConfigMap for runner configuration
- Deployment using code.forgejo.org/forgejo/runner:4.0.1
- Argo CD application for automated deployment

Note: Runner requires a sealed secret with registration token.
See apps/forgejo-runner/README.md for setup instructions.

Part of DEV-334 CI/CD workflow implementation.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-18 14:21:57 +00:00