Enhance runner configurations by adding Docker registry authentication to avoid rate limits; update example environment file with Docker Hub credentials; include new documentation for Docker rate limit solutions in structure.txt.
Some checks failed
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 3s
LabFusion CI/CD Pipeline / api-docs (push) Failing after 3s
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 2s
LabFusion CI/CD Pipeline / frontend (push) Failing after 2s
LabFusion CI/CD Pipeline / security-scan (push) Has been skipped
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
Docker Build and Push / build-and-push (push) Failing after 3m33s
Docker Build and Push / security-scan (push) Has been skipped
Docker Build and Push / deploy-staging (push) Has been skipped
Docker Build and Push / deploy-production (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 2s
Integration Tests / performance-tests (push) Has been skipped
Some checks failed
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 3s
LabFusion CI/CD Pipeline / api-docs (push) Failing after 3s
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 2s
LabFusion CI/CD Pipeline / frontend (push) Failing after 2s
LabFusion CI/CD Pipeline / security-scan (push) Has been skipped
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
Docker Build and Push / build-and-push (push) Failing after 3m33s
Docker Build and Push / security-scan (push) Has been skipped
Docker Build and Push / deploy-staging (push) Has been skipped
Docker Build and Push / deploy-production (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 2s
Integration Tests / performance-tests (push) Has been skipped
This commit is contained in:
@@ -98,8 +98,11 @@ container:
|
||||
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
|
||||
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
||||
docker_host: ""
|
||||
# Docker registry authentication to avoid rate limits
|
||||
docker_username: gschrooyen
|
||||
docker_password: ${DOCKER_PASSWORD}
|
||||
# Pull docker image(s) even if already present
|
||||
force_pull: true
|
||||
force_pull: false
|
||||
# Rebuild docker image(s) even if already present
|
||||
force_rebuild: false
|
||||
# Always require a reachable docker daemon, even if not required by act_runner
|
||||
|
||||
@@ -99,8 +99,11 @@ container:
|
||||
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
|
||||
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
||||
docker_host: ""
|
||||
# Docker registry authentication to avoid rate limits
|
||||
docker_username: gschrooyen
|
||||
docker_password: ${DOCKER_PASSWORD}
|
||||
# Pull docker image(s) even if already present
|
||||
force_pull: true
|
||||
force_pull: false
|
||||
# Rebuild docker image(s) even if already present
|
||||
force_rebuild: false
|
||||
# Always require a reachable docker daemon, even if not required by act_runner
|
||||
|
||||
@@ -99,8 +99,11 @@ container:
|
||||
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
|
||||
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
||||
docker_host: ""
|
||||
# Docker registry authentication to avoid rate limits
|
||||
docker_username: gschrooyen
|
||||
docker_password: ${DOCKER_PASSWORD}
|
||||
# Pull docker image(s) even if already present
|
||||
force_pull: true
|
||||
force_pull: false
|
||||
# Rebuild docker image(s) even if already present
|
||||
force_rebuild: false
|
||||
# Always require a reachable docker daemon, even if not required by act_runner
|
||||
|
||||
@@ -98,8 +98,11 @@ container:
|
||||
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
|
||||
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
||||
docker_host: ""
|
||||
# Docker registry authentication to avoid rate limits
|
||||
docker_username: gschrooyen
|
||||
docker_password: ${DOCKER_PASSWORD}
|
||||
# Pull docker image(s) even if already present
|
||||
force_pull: true
|
||||
force_pull: false
|
||||
# Rebuild docker image(s) even if already present
|
||||
force_rebuild: false
|
||||
# Always require a reachable docker daemon, even if not required by act_runner
|
||||
|
||||
@@ -12,3 +12,8 @@ GITEA_RUNNER_TOKEN=your_runner_registration_token_here
|
||||
# GITEA_RUNNER_NAME_LIGHT=labfusion-runner-light
|
||||
# GITEA_RUNNER_NAME_DOCKER=labfusion-runner-docker
|
||||
# GITEA_RUNNER_NAME_SECURITY=labfusion-runner-security
|
||||
|
||||
# Docker Hub credentials (to avoid rate limits)
|
||||
# Create a free Docker Hub account at https://hub.docker.com
|
||||
DOCKER_USERNAME=your_dockerhub_username
|
||||
DOCKER_PASSWORD=your_dockerhub_password
|
||||
208
runners/manage-runners.ps1
Normal file
208
runners/manage-runners.ps1
Normal file
@@ -0,0 +1,208 @@
|
||||
# LabFusion Gitea Runners Management Script (PowerShell)
|
||||
# Usage: .\scripts\manage-runners.ps1 [start|stop|restart|status|logs|clean]
|
||||
|
||||
param(
|
||||
[Parameter(Position=0)]
|
||||
[ValidateSet("start", "stop", "restart", "status", "logs", "clean", "help")]
|
||||
[string]$Command = "help",
|
||||
|
||||
[Parameter(Position=1)]
|
||||
[string]$RunnerName = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$ComposeFile = "docker-compose.runners.yml"
|
||||
$EnvFile = ".env.runners"
|
||||
|
||||
# Helper functions
|
||||
function Write-Info {
|
||||
param([string]$Message)
|
||||
Write-Host "[INFO] $Message" -ForegroundColor Blue
|
||||
}
|
||||
|
||||
function Write-Success {
|
||||
param([string]$Message)
|
||||
Write-Host "[SUCCESS] $Message" -ForegroundColor Green
|
||||
}
|
||||
|
||||
function Write-Warning {
|
||||
param([string]$Message)
|
||||
Write-Host "[WARNING] $Message" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
function Write-Error {
|
||||
param([string]$Message)
|
||||
Write-Host "[ERROR] $Message" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Check if .env.runners exists
|
||||
function Test-EnvFile {
|
||||
if (-not (Test-Path $EnvFile)) {
|
||||
Write-Error "Environment file $EnvFile not found!"
|
||||
Write-Info "Please copy env.runners.example to $EnvFile and configure it:"
|
||||
Write-Info " Copy-Item env.runners.example $EnvFile"
|
||||
Write-Info " # Edit $EnvFile with your Gitea instance URL and runner token"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Start runners
|
||||
function Start-Runners {
|
||||
Write-Info "Starting LabFusion Gitea runners..."
|
||||
Test-EnvFile
|
||||
|
||||
docker-compose -f $ComposeFile --env-file $EnvFile up -d
|
||||
|
||||
Write-Success "Runners started successfully!"
|
||||
Write-Info "Runners:"
|
||||
Write-Info " - Heavy (Java/Python): labfusion-runner-heavy"
|
||||
Write-Info " - Light (Node.js/Frontend): labfusion-runner-light"
|
||||
Write-Info " - Docker (Integration): labfusion-runner-docker"
|
||||
Write-Info " - Security (Scans): labfusion-runner-security"
|
||||
|
||||
# Wait a moment for health checks
|
||||
Start-Sleep -Seconds 5
|
||||
Show-Status
|
||||
}
|
||||
|
||||
# Stop runners
|
||||
function Stop-Runners {
|
||||
Write-Info "Stopping LabFusion Gitea runners..."
|
||||
|
||||
docker-compose -f $ComposeFile down
|
||||
|
||||
Write-Success "Runners stopped successfully!"
|
||||
}
|
||||
|
||||
# Restart runners
|
||||
function Restart-Runners {
|
||||
Write-Info "Restarting LabFusion Gitea runners..."
|
||||
Stop-Runners
|
||||
Start-Sleep -Seconds 2
|
||||
Start-Runners
|
||||
}
|
||||
|
||||
# Show runner status
|
||||
function Show-Status {
|
||||
Write-Info "LabFusion Gitea Runners Status:"
|
||||
Write-Host ""
|
||||
|
||||
# Check if compose file exists
|
||||
if (-not (Test-Path $ComposeFile)) {
|
||||
Write-Error "Docker Compose file $ComposeFile not found!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Show container status
|
||||
docker-compose -f $ComposeFile ps
|
||||
|
||||
Write-Host ""
|
||||
Write-Info "Runner Health Status:"
|
||||
|
||||
# Check each runner's health
|
||||
$runners = @("labfusion-runner-heavy", "labfusion-runner-light", "labfusion-runner-docker", "labfusion-runner-security")
|
||||
|
||||
foreach ($runner in $runners) {
|
||||
$container = docker ps --format "table {{.Names}}\t{{.Status}}" | Select-String $runner
|
||||
if ($container) {
|
||||
try {
|
||||
$health = docker inspect --format='{{.State.Health.Status}}' $runner 2>$null
|
||||
if ($health) {
|
||||
switch ($health) {
|
||||
"healthy" { Write-Success "$runner`: $health" }
|
||||
"unhealthy" { Write-Error "$runner`: $health" }
|
||||
"starting" { Write-Warning "$runner`: $health" }
|
||||
default { Write-Warning "$runner`: $health" }
|
||||
}
|
||||
} else {
|
||||
Write-Warning "$runner`: health check not available"
|
||||
}
|
||||
} catch {
|
||||
Write-Warning "$runner`: health check failed"
|
||||
}
|
||||
} else {
|
||||
Write-Error "$runner`: not running"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Show logs
|
||||
function Show-Logs {
|
||||
param([string]$Runner = "")
|
||||
|
||||
if ($Runner) {
|
||||
Write-Info "Showing logs for $Runner..."
|
||||
docker-compose -f $ComposeFile logs -f $Runner
|
||||
} else {
|
||||
Write-Info "Showing logs for all runners..."
|
||||
docker-compose -f $ComposeFile logs -f
|
||||
}
|
||||
}
|
||||
|
||||
# Clean up runners and data
|
||||
function Clean-Runners {
|
||||
$response = Read-Host "This will remove all runners and their data. Are you sure? (y/N)"
|
||||
|
||||
if ($response -match "^[Yy]$") {
|
||||
Write-Info "Cleaning up runners and data..."
|
||||
|
||||
# Stop and remove containers
|
||||
docker-compose -f $ComposeFile down -v
|
||||
|
||||
# Remove volumes
|
||||
try {
|
||||
$volumes = docker volume ls -q | Where-Object { $_ -match "runner-data" }
|
||||
if ($volumes) {
|
||||
docker volume rm $volumes
|
||||
}
|
||||
docker volume rm shared-cache 2>$null
|
||||
} catch {
|
||||
Write-Warning "Some volumes could not be removed (this is normal if they don't exist)"
|
||||
}
|
||||
|
||||
Write-Success "Cleanup completed!"
|
||||
} else {
|
||||
Write-Info "Cleanup cancelled."
|
||||
}
|
||||
}
|
||||
|
||||
# Show help
|
||||
function Show-Help {
|
||||
Write-Host "LabFusion Gitea Runners Management Script (PowerShell)"
|
||||
Write-Host ""
|
||||
Write-Host "Usage: .\scripts\manage-runners.ps1 [COMMAND] [RUNNER_NAME]"
|
||||
Write-Host ""
|
||||
Write-Host "Commands:"
|
||||
Write-Host " start Start all runners"
|
||||
Write-Host " stop Stop all runners"
|
||||
Write-Host " restart Restart all runners"
|
||||
Write-Host " status Show runner status and health"
|
||||
Write-Host " logs Show logs for all runners"
|
||||
Write-Host " logs [runner] Show logs for specific runner"
|
||||
Write-Host " clean Remove all runners and data (destructive)"
|
||||
Write-Host " help Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "Examples:"
|
||||
Write-Host " .\scripts\manage-runners.ps1 start"
|
||||
Write-Host " .\scripts\manage-runners.ps1 status"
|
||||
Write-Host " .\scripts\manage-runners.ps1 logs labfusion-runner-heavy"
|
||||
Write-Host " .\scripts\manage-runners.ps1 clean"
|
||||
}
|
||||
|
||||
# Main script logic
|
||||
switch ($Command) {
|
||||
"start" { Start-Runners }
|
||||
"stop" { Stop-Runners }
|
||||
"restart" { Restart-Runners }
|
||||
"status" { Show-Status }
|
||||
"logs" { Show-Logs -Runner $RunnerName }
|
||||
"clean" { Clean-Runners }
|
||||
"help" { Show-Help }
|
||||
default {
|
||||
Write-Error "Unknown command: $Command"
|
||||
Write-Host ""
|
||||
Show-Help
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
209
runners/manage-runners.sh
Normal file
209
runners/manage-runners.sh
Normal file
@@ -0,0 +1,209 @@
|
||||
#!/bin/bash
|
||||
|
||||
# LabFusion Gitea Runners Management Script
|
||||
# Usage: ./scripts/manage-runners.sh [start|stop|restart|status|logs|clean]
|
||||
|
||||
set -e
|
||||
|
||||
COMPOSE_FILE="docker-compose.runners.yml"
|
||||
ENV_FILE=".env.runners"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Helper functions
|
||||
log_info() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
log_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# Check if .env.runners exists
|
||||
check_env_file() {
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
log_error "Environment file $ENV_FILE not found!"
|
||||
log_info "Please copy env.runners.example to $ENV_FILE and configure it:"
|
||||
log_info " cp env.runners.example $ENV_FILE"
|
||||
log_info " # Edit $ENV_FILE with your Gitea instance URL and runner token"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Start runners
|
||||
start_runners() {
|
||||
log_info "Starting LabFusion Gitea runners..."
|
||||
check_env_file
|
||||
|
||||
docker-compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" up -d
|
||||
|
||||
log_success "Runners started successfully!"
|
||||
log_info "Runners:"
|
||||
log_info " - Heavy (Java/Python): labfusion-runner-heavy"
|
||||
log_info " - Light (Node.js/Frontend): labfusion-runner-light"
|
||||
log_info " - Docker (Integration): labfusion-runner-docker"
|
||||
log_info " - Security (Scans): labfusion-runner-security"
|
||||
|
||||
# Wait a moment for health checks
|
||||
sleep 5
|
||||
show_status
|
||||
}
|
||||
|
||||
# Stop runners
|
||||
stop_runners() {
|
||||
log_info "Stopping LabFusion Gitea runners..."
|
||||
|
||||
docker-compose -f "$COMPOSE_FILE" down
|
||||
|
||||
log_success "Runners stopped successfully!"
|
||||
}
|
||||
|
||||
# Restart runners
|
||||
restart_runners() {
|
||||
log_info "Restarting LabFusion Gitea runners..."
|
||||
stop_runners
|
||||
sleep 2
|
||||
start_runners
|
||||
}
|
||||
|
||||
# Show runner status
|
||||
show_status() {
|
||||
log_info "LabFusion Gitea Runners Status:"
|
||||
echo
|
||||
|
||||
# Check if compose file exists
|
||||
if [ ! -f "$COMPOSE_FILE" ]; then
|
||||
log_error "Docker Compose file $COMPOSE_FILE not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Show container status
|
||||
docker-compose -f "$COMPOSE_FILE" ps
|
||||
|
||||
echo
|
||||
log_info "Runner Health Status:"
|
||||
|
||||
# Check each runner's health
|
||||
for runner in labfusion-runner-heavy labfusion-runner-light labfusion-runner-docker labfusion-runner-security; do
|
||||
if docker ps --format "table {{.Names}}\t{{.Status}}" | grep -q "$runner"; then
|
||||
status=$(docker inspect --format='{{.State.Health.Status}}' "$runner" 2>/dev/null || echo "unknown")
|
||||
case $status in
|
||||
"healthy")
|
||||
log_success "$runner: $status"
|
||||
;;
|
||||
"unhealthy")
|
||||
log_error "$runner: $status"
|
||||
;;
|
||||
"starting")
|
||||
log_warning "$runner: $status"
|
||||
;;
|
||||
*)
|
||||
log_warning "$runner: $status"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
log_error "$runner: not running"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Show logs
|
||||
show_logs() {
|
||||
local runner=${2:-""}
|
||||
|
||||
if [ -n "$runner" ]; then
|
||||
log_info "Showing logs for $runner..."
|
||||
docker-compose -f "$COMPOSE_FILE" logs -f "$runner"
|
||||
else
|
||||
log_info "Showing logs for all runners..."
|
||||
docker-compose -f "$COMPOSE_FILE" logs -f
|
||||
fi
|
||||
}
|
||||
|
||||
# Clean up runners and data
|
||||
clean_runners() {
|
||||
log_warning "This will remove all runners and their data. Are you sure? (y/N)"
|
||||
read -r response
|
||||
|
||||
if [[ "$response" =~ ^[Yy]$ ]]; then
|
||||
log_info "Cleaning up runners and data..."
|
||||
|
||||
# Stop and remove containers
|
||||
docker-compose -f "$COMPOSE_FILE" down -v
|
||||
|
||||
# Remove volumes
|
||||
docker volume rm $(docker volume ls -q | grep runner-data) 2>/dev/null || true
|
||||
docker volume rm shared-cache 2>/dev/null || true
|
||||
|
||||
log_success "Cleanup completed!"
|
||||
else
|
||||
log_info "Cleanup cancelled."
|
||||
fi
|
||||
}
|
||||
|
||||
# Show help
|
||||
show_help() {
|
||||
echo "LabFusion Gitea Runners Management Script"
|
||||
echo
|
||||
echo "Usage: $0 [COMMAND]"
|
||||
echo
|
||||
echo "Commands:"
|
||||
echo " start Start all runners"
|
||||
echo " stop Stop all runners"
|
||||
echo " restart Restart all runners"
|
||||
echo " status Show runner status and health"
|
||||
echo " logs Show logs for all runners"
|
||||
echo " logs [runner] Show logs for specific runner"
|
||||
echo " clean Remove all runners and data (destructive)"
|
||||
echo " help Show this help message"
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo " $0 start"
|
||||
echo " $0 status"
|
||||
echo " $0 logs labfusion-runner-heavy"
|
||||
echo " $0 clean"
|
||||
}
|
||||
|
||||
# Main script logic
|
||||
case "${1:-help}" in
|
||||
start)
|
||||
start_runners
|
||||
;;
|
||||
stop)
|
||||
stop_runners
|
||||
;;
|
||||
restart)
|
||||
restart_runners
|
||||
;;
|
||||
status)
|
||||
show_status
|
||||
;;
|
||||
logs)
|
||||
show_logs "$@"
|
||||
;;
|
||||
clean)
|
||||
clean_runners
|
||||
;;
|
||||
help|--help|-h)
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
log_error "Unknown command: $1"
|
||||
echo
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user