feat: add Gitea Actions runner configuration
Some checks failed
Picsur Deploy / Validate Picsur Compose (pull_request) Has been cancelled
Picsur Deploy / Deploy Picsur to Dockerino (pull_request) Has been cancelled

- docker-compose.yml for act_runner
- config.yaml template
- register.sh script
- README with installation instructions
This commit is contained in:
gaia 2026-04-09 01:46:28 -03:00
parent a4240065e8
commit a99f10c006
4 changed files with 173 additions and 0 deletions

91
gitea-runner/README.md Normal file
View File

@ -0,0 +1,91 @@
# Gitea Actions Runner — Dockerino
Este diretório contém a configuração do runner de Gitea Actions para executar workflows CI/CD.
## Visão Geral
O **act_runner** é o agente que executa os jobs definidos nos workflows `.gitea/workflows/*.yml`. Ele roda no Dockerino (10.0.0.50) usando Docker.
## Arquivos
```
gitea-runner/
├── docker-compose.yml # Serviço do runner
├── config.yaml # Configuração (gerado no registro)
├── register.sh # Script de registro
└── data/ # Dados persistentes do runner
```
## Instalação
### 1. Obter Token de Registro
Acesse o Gitea como admin:
```
https://gitea.hackerfortress.cc/admin/runners
```
Clique em **"New Runner"** e copie o token.
### 2. Registrar o Runner
```bash
cd gitea-runner
export RUNNER_TOKEN="seu-token-aqui"
./register.sh
```
### 3. Iniciar o Runner
```bash
docker compose up -d
```
### 4. Verificar
Acesse:
```
https://gitea.hackerfortress.cc/admin/runners
```
O runner deve aparecer como **"Active"**.
## Labels Disponíveis
| Label | Descrição |
|-------|-----------|
| `gitea-runner-dockerino` | Runner principal |
| `ubuntu-latest` | Container Ubuntu para jobs |
## Troubleshooting
### Runner não aparece como active
```bash
# Ver logs
docker compose logs -f act_runner
# Verificar configuração
cat config.yaml
```
### Docker socket permission denied
```bash
# No host (Dockerino), adicionar usuário ao grupo docker
sudo usermod -aG docker $USER
```
### Jobs ficam em "Pending"
- Verificar se runner está online
- Verificar se o token está correto
- Verificar se o runner tem labels necessárias
## Atualização
```bash
cd gitea-runner
docker compose pull
docker compose up -d
```

25
gitea-runner/config.yaml Normal file
View File

@ -0,0 +1,25 @@
log:
level: info
formatting: text
runner:
capacity: 2
name: gitea-runner-dockerino
labels:
- gitea-runner-dockerino
- ubuntu-latest:docker://ubuntu:latest
- ubuntu-latest:host
cache:
enabled: true
dir: ""
backend: local
docker:
host: unix:///var/run/docker.sock
network: homelab-network
privileged: false
macos:
disabled: true
windows:
disabled: true

View File

@ -0,0 +1,23 @@
version: '3.8'
services:
act_runner:
image: gitea/act_runner:latest
container_name: gitea-runner
restart: unless-stopped
environment:
- CONFIG_FILE=/runner/config.yaml
- INSTANCE_URL=https://gitea.hackerfortress.cc
- RUNNER_TOKEN=${RUNNER_TOKEN}
- RUNNER_NAME=gitea-runner-dockerino
- RUNNER_LABELS=gitea-runner-dockerino
volumes:
- ./data:/data
- ./config.yaml:/runner/config.yaml
- /var/run/docker.sock:/var/run/docker.sock
networks:
- homelab-network
networks:
homelab-network:
external: true

34
gitea-runner/register.sh Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
# ============================================
# Gitea Runner Registration Script
# ============================================
# Usage:
# 1. Get token from Gitea Admin > Runners
# 2. Run: RUNNER_TOKEN="your-token" ./register.sh
set -e
GITEA_URL="${INSTANCE_URL:-https://gitea.hackerfortress.cc}"
TOKEN="${RUNNER_TOKEN}"
if [ -z "$TOKEN" ]; then
echo "❌ RUNNER_TOKEN not set"
echo " Get token from: ${GITEA_URL}/admin/runners"
exit 1
fi
echo "📡 Registering runner with Gitea at ${GITEA_URL}..."
# Register and get the runner config
docker compose run --rm act_runner \
act_runner generate-config \
--instance "${GITEA_URL}" \
--token "${TOKEN}" \
--name "gitea-runner-dockerino" \
> config.yaml
echo "✅ Runner registered successfully!"
echo ""
echo "Next steps:"
echo "1. Review config.yaml"
echo "2. Run: docker compose up -d"