Compare commits
6 Commits
a4240065e8
...
d4bf867657
| Author | SHA1 | Date | |
|---|---|---|---|
| d4bf867657 | |||
| dc436b3518 | |||
| cc88ad5c05 | |||
| 775ad3fcd6 | |||
| af13a920c8 | |||
| 12d9fa08db |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.runner
|
||||
token.txt
|
||||
91
gitea-runner/README.md
Normal file
91
gitea-runner/README.md
Normal file
@ -0,0 +1,91 @@
|
||||
# Gitea Actions Runner — Hestia
|
||||
|
||||
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 Hestia (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-Hestia` | 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 (Hestia), 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
|
||||
```
|
||||
BIN
gitea-runner/act_runner
Executable file
BIN
gitea-runner/act_runner
Executable file
Binary file not shown.
18
gitea-runner/config.yaml
Normal file
18
gitea-runner/config.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
log:
|
||||
level: info
|
||||
formatting: text
|
||||
|
||||
runner:
|
||||
capacity: 2
|
||||
name: gitea-runner-hestia
|
||||
labels:
|
||||
- gitea-runner-hestia
|
||||
- ubuntu-latest:docker://ubuntu:latest
|
||||
|
||||
cache:
|
||||
enabled: false
|
||||
|
||||
docker:
|
||||
host: unix:///var/run/docker.sock
|
||||
network: ""
|
||||
privileged: false
|
||||
18
gitea-runner/docker-compose.yml
Normal file
18
gitea-runner/docker-compose.yml
Normal file
@ -0,0 +1,18 @@
|
||||
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-hestia
|
||||
- RUNNER_LABELS=gitea-runner-hestia
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./config.yaml:/runner/config.yaml
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
network_mode: host
|
||||
14
gitea-runner/gitea-runner.service
Normal file
14
gitea-runner/gitea-runner.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Gitea Actions Runner
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=iamferreirajp
|
||||
WorkingDirectory=/home/iamferreirajp/homelab/gitea-runner
|
||||
ExecStart=/home/iamferreirajp/homelab/gitea-runner/act_runner daemon
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
34
gitea-runner/register.sh
Executable file
34
gitea-runner/register.sh
Executable 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"
|
||||
Loading…
Reference in New Issue
Block a user