Remove deprecated Gitea runners configuration files and scripts; reorganize runner-related files into a dedicated 'runners/' directory for better structure and management; update documentation to reflect these changes.
Some checks failed
LabFusion CI/CD Pipeline / api-docs (push) Failing after 2m37s
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 2m40s
LabFusion CI/CD Pipeline / frontend (push) Failing after 4s
Docker Build and Push / build-and-push (push) Failing after 3m38s
Docker Build and Push / security-scan (push) Has been skipped
Docker Build and Push / deploy-staging (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 4s
Integration Tests / performance-tests (push) Has been skipped
Docker Build and Push / deploy-production (push) Has been skipped
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 1m56s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
LabFusion CI/CD Pipeline / security-scan (push) Has been skipped
Some checks failed
LabFusion CI/CD Pipeline / api-docs (push) Failing after 2m37s
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 2m40s
LabFusion CI/CD Pipeline / frontend (push) Failing after 4s
Docker Build and Push / build-and-push (push) Failing after 3m38s
Docker Build and Push / security-scan (push) Has been skipped
Docker Build and Push / deploy-staging (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 4s
Integration Tests / performance-tests (push) Has been skipped
Docker Build and Push / deploy-production (push) Has been skipped
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 1m56s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
LabFusion CI/CD Pipeline / security-scan (push) Has been skipped
This commit is contained in:
148
docs/RUNNERS.md
148
docs/RUNNERS.md
@@ -11,6 +11,8 @@ The LabFusion project uses multiple specialized runners to handle different type
|
|||||||
- **Docker Runner**: Integration tests and Docker builds
|
- **Docker Runner**: Integration tests and Docker builds
|
||||||
- **Security Runner**: Security scans and vulnerability assessments
|
- **Security Runner**: Security scans and vulnerability assessments
|
||||||
|
|
||||||
|
**Note**: All runners use the official `gitea/act_runner:nightly` image with individual configuration files. Each runner has its own data directory and configuration for better isolation and management.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
### 1. Prerequisites
|
### 1. Prerequisites
|
||||||
@@ -23,6 +25,9 @@ The LabFusion project uses multiple specialized runners to handle different type
|
|||||||
|
|
||||||
**Windows PowerShell:**
|
**Windows PowerShell:**
|
||||||
```powershell
|
```powershell
|
||||||
|
# Navigate to runners directory
|
||||||
|
cd runners
|
||||||
|
|
||||||
# Copy the environment template
|
# Copy the environment template
|
||||||
Copy-Item env.runners.example .env.runners
|
Copy-Item env.runners.example .env.runners
|
||||||
|
|
||||||
@@ -32,6 +37,9 @@ notepad .env.runners
|
|||||||
|
|
||||||
**Linux/macOS:**
|
**Linux/macOS:**
|
||||||
```bash
|
```bash
|
||||||
|
# Navigate to runners directory
|
||||||
|
cd runners
|
||||||
|
|
||||||
# Copy the environment template
|
# Copy the environment template
|
||||||
cp env.runners.example .env.runners
|
cp env.runners.example .env.runners
|
||||||
|
|
||||||
@@ -40,37 +48,96 @@ nano .env.runners
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Manual Creation (if copy fails):**
|
**Manual Creation (if copy fails):**
|
||||||
Create `.env.runners` file with the following content:
|
Create `runners/.env.runners` file with the following content:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Gitea instance URL (adjust port if different)
|
# Gitea instance URL (adjust port if different)
|
||||||
GITEA_INSTANCE_URL=http://localhost:3000
|
GITEA_INSTANCE_URL=http://localhost:3000
|
||||||
|
|
||||||
# Runner registration token (get from Gitea Admin > Actions > Runners)
|
# Runner registration token (get from Gitea Admin > Actions > Runners)
|
||||||
GITEA_RUNNER_TOKEN=your_runner_registration_token_here
|
GITEA_RUNNER_REGISTRATION_TOKEN=your_runner_registration_token_here
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important:** Replace `your_runner_registration_token_here` with your actual token from Gitea Admin > Actions > Runners.
|
**Important:** Replace `your_runner_registration_token_here` with your actual token from Gitea Admin > Actions > Runners.
|
||||||
|
|
||||||
|
### 2.1. Create Configuration Files
|
||||||
|
|
||||||
|
Each runner requires its own configuration file. Create the following files in the `runners/` directory:
|
||||||
|
|
||||||
|
**`config_heavy.yaml`:**
|
||||||
|
```yaml
|
||||||
|
log:
|
||||||
|
level: info
|
||||||
|
|
||||||
|
runner:
|
||||||
|
file: /data/.runner
|
||||||
|
capacity: 2
|
||||||
|
envs:
|
||||||
|
- JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
||||||
|
- PATH=/usr/lib/jvm/java-17-openjdk-amd64/bin:$PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
**`config_light.yaml`:**
|
||||||
|
```yaml
|
||||||
|
log:
|
||||||
|
level: info
|
||||||
|
|
||||||
|
runner:
|
||||||
|
file: /data/.runner
|
||||||
|
capacity: 2
|
||||||
|
envs:
|
||||||
|
- NODE_VERSION=20
|
||||||
|
```
|
||||||
|
|
||||||
|
**`config_docker.yaml`:**
|
||||||
|
```yaml
|
||||||
|
log:
|
||||||
|
level: info
|
||||||
|
|
||||||
|
runner:
|
||||||
|
file: /data/.runner
|
||||||
|
capacity: 1
|
||||||
|
```
|
||||||
|
|
||||||
|
**`config_security.yaml`:**
|
||||||
|
```yaml
|
||||||
|
log:
|
||||||
|
level: info
|
||||||
|
|
||||||
|
runner:
|
||||||
|
file: /data/.runner
|
||||||
|
capacity: 1
|
||||||
|
```
|
||||||
|
|
||||||
### 3. Start Runners
|
### 3. Start Runners
|
||||||
|
|
||||||
**Linux/macOS:**
|
**Linux/macOS:**
|
||||||
```bash
|
```bash
|
||||||
|
# Navigate to runners directory
|
||||||
|
cd runners
|
||||||
|
|
||||||
# Make script executable
|
# Make script executable
|
||||||
chmod +x scripts/manage-runners.sh
|
chmod +x manage-runners.sh
|
||||||
|
|
||||||
# Start all runners
|
# Start all runners
|
||||||
./scripts/manage-runners.sh start
|
./manage-runners.sh start
|
||||||
```
|
```
|
||||||
|
|
||||||
**Windows PowerShell:**
|
**Windows PowerShell:**
|
||||||
```powershell
|
```powershell
|
||||||
|
# Navigate to runners directory
|
||||||
|
cd runners
|
||||||
|
|
||||||
# Start all runners
|
# Start all runners
|
||||||
.\scripts\manage-runners.ps1 start
|
.\manage-runners.ps1 start
|
||||||
```
|
```
|
||||||
|
|
||||||
**Docker Compose directly:**
|
**Docker Compose directly:**
|
||||||
```bash
|
```bash
|
||||||
|
# Navigate to runners directory
|
||||||
|
cd runners
|
||||||
|
|
||||||
|
# Start runners
|
||||||
docker-compose -f docker-compose.runners.yml --env-file .env.runners up -d
|
docker-compose -f docker-compose.runners.yml --env-file .env.runners up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -100,51 +167,60 @@ Each runner is configured with specific labels for workload routing:
|
|||||||
|
|
||||||
**Linux/macOS:**
|
**Linux/macOS:**
|
||||||
```bash
|
```bash
|
||||||
|
# Navigate to runners directory
|
||||||
|
cd runners
|
||||||
|
|
||||||
# Start runners
|
# Start runners
|
||||||
./scripts/manage-runners.sh start
|
./manage-runners.sh start
|
||||||
|
|
||||||
# Check status
|
# Check status
|
||||||
./scripts/manage-runners.sh status
|
./manage-runners.sh status
|
||||||
|
|
||||||
# View logs
|
# View logs
|
||||||
./scripts/manage-runners.sh logs
|
./manage-runners.sh logs
|
||||||
./scripts/manage-runners.sh logs labfusion-runner-heavy
|
./manage-runners.sh logs labfusion-runner-heavy
|
||||||
|
|
||||||
# Restart runners
|
# Restart runners
|
||||||
./scripts/manage-runners.sh restart
|
./manage-runners.sh restart
|
||||||
|
|
||||||
# Stop runners
|
# Stop runners
|
||||||
./scripts/manage-runners.sh stop
|
./manage-runners.sh stop
|
||||||
|
|
||||||
# Clean up (removes all data)
|
# Clean up (removes all data)
|
||||||
./scripts/manage-runners.sh clean
|
./manage-runners.sh clean
|
||||||
```
|
```
|
||||||
|
|
||||||
**Windows PowerShell:**
|
**Windows PowerShell:**
|
||||||
```powershell
|
```powershell
|
||||||
|
# Navigate to runners directory
|
||||||
|
cd runners
|
||||||
|
|
||||||
# Start runners
|
# Start runners
|
||||||
.\scripts\manage-runners.ps1 start
|
.\manage-runners.ps1 start
|
||||||
|
|
||||||
# Check status
|
# Check status
|
||||||
.\scripts\manage-runners.ps1 status
|
.\manage-runners.ps1 status
|
||||||
|
|
||||||
# View logs
|
# View logs
|
||||||
.\scripts\manage-runners.ps1 logs
|
.\manage-runners.ps1 logs
|
||||||
.\scripts\manage-runners.ps1 logs labfusion-runner-heavy
|
.\manage-runners.ps1 logs labfusion-runner-heavy
|
||||||
|
|
||||||
# Restart runners
|
# Restart runners
|
||||||
.\scripts\manage-runners.ps1 restart
|
.\manage-runners.ps1 restart
|
||||||
|
|
||||||
# Stop runners
|
# Stop runners
|
||||||
.\scripts\manage-runners.ps1 stop
|
.\manage-runners.ps1 stop
|
||||||
|
|
||||||
# Clean up (removes all data)
|
# Clean up (removes all data)
|
||||||
.\scripts\manage-runners.ps1 clean
|
.\manage-runners.ps1 clean
|
||||||
```
|
```
|
||||||
|
|
||||||
### Direct Docker Compose Commands
|
### Direct Docker Compose Commands
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Navigate to runners directory
|
||||||
|
cd runners
|
||||||
|
|
||||||
# Start all runners
|
# Start all runners
|
||||||
docker-compose -f docker-compose.runners.yml up -d
|
docker-compose -f docker-compose.runners.yml up -d
|
||||||
|
|
||||||
@@ -217,29 +293,51 @@ docker system df -v
|
|||||||
|
|
||||||
### Common Issues
|
### Common Issues
|
||||||
|
|
||||||
1. **Runners not registering / Token appears empty**
|
1. **"Cannot find: node in PATH" or similar tool errors**
|
||||||
- **Check if `.env.runners` file exists** in the project root
|
- **This is handled** by the official `gitea/act_runner:nightly` image which includes necessary tools
|
||||||
|
- **Environment variables** can be set in the configuration files to ensure proper tool paths
|
||||||
|
- **Check your configuration files** to ensure proper environment setup
|
||||||
|
|
||||||
|
2. **"registration file not found, please register the runner first" error**
|
||||||
|
- **This is handled** by the official `gitea/act_runner:nightly` image with proper configuration
|
||||||
|
- **The `.runner` file** is created in the `/data` directory and persists between restarts
|
||||||
|
- **Ensure configuration files** are properly mounted and environment variables are set
|
||||||
|
- **Restart the runners** if you see this error:
|
||||||
|
```bash
|
||||||
|
cd runners
|
||||||
|
docker-compose -f docker-compose.runners.yml down
|
||||||
|
docker-compose -f docker-compose.runners.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Configuration file not found errors**
|
||||||
|
- **Ensure all config files exist**: `config_heavy.yaml`, `config_light.yaml`, `config_docker.yaml`, `config_security.yaml`
|
||||||
|
- **Check file permissions** and ensure they're readable by the container
|
||||||
|
- **Verify volume mounts** in the Docker Compose file are correct
|
||||||
|
|
||||||
|
4. **Runners not registering / Token appears empty**
|
||||||
|
- **Check if `.env.runners` file exists** in the `runners/` directory
|
||||||
- **Verify the file contains your actual token** (not the placeholder)
|
- **Verify the file contains your actual token** (not the placeholder)
|
||||||
- **Make sure you're using the management scripts** (they include `--env-file` parameter)
|
- **Make sure you're using the management scripts** (they include `--env-file` parameter)
|
||||||
- **If running Docker Compose directly**, add `--env-file .env.runners`:
|
- **If running Docker Compose directly**, add `--env-file .env.runners`:
|
||||||
```bash
|
```bash
|
||||||
|
cd runners
|
||||||
docker-compose -f docker-compose.runners.yml --env-file .env.runners up -d
|
docker-compose -f docker-compose.runners.yml --env-file .env.runners up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Runners not registering**
|
5. **Runners not registering**
|
||||||
- Check Gitea instance URL and port
|
- Check Gitea instance URL and port
|
||||||
- Verify runner token is correct
|
- Verify runner token is correct
|
||||||
- Ensure Gitea Actions is enabled
|
- Ensure Gitea Actions is enabled
|
||||||
|
|
||||||
3. **High resource usage**
|
6. **High resource usage**
|
||||||
- Adjust CPU/memory limits in docker-compose.runners.yml
|
- Adjust CPU/memory limits in docker-compose.runners.yml
|
||||||
- Check for stuck jobs in Gitea Actions
|
- Check for stuck jobs in Gitea Actions
|
||||||
|
|
||||||
4. **Docker socket issues**
|
7. **Docker socket issues**
|
||||||
- Ensure Docker socket is accessible: `/var/run/docker.sock`
|
- Ensure Docker socket is accessible: `/var/run/docker.sock`
|
||||||
- Check Docker daemon is running
|
- Check Docker daemon is running
|
||||||
|
|
||||||
5. **Network connectivity**
|
8. **Network connectivity**
|
||||||
- Verify runners can reach Gitea instance
|
- Verify runners can reach Gitea instance
|
||||||
- Check firewall settings
|
- Check firewall settings
|
||||||
|
|
||||||
|
|||||||
@@ -219,6 +219,11 @@ The modular structure allows for easy addition of new services:
|
|||||||
- [x] Fix Gitea Actions compatibility issues with artifact uploads
|
- [x] Fix Gitea Actions compatibility issues with artifact uploads
|
||||||
- [x] Create Docker Compose setup for multiple Gitea runners
|
- [x] Create Docker Compose setup for multiple Gitea runners
|
||||||
- [x] Update all CI/CD pipelines with appropriate runner labels
|
- [x] Update all CI/CD pipelines with appropriate runner labels
|
||||||
|
- [x] Fix "Cannot find: node in PATH" error by creating custom runner Docker images
|
||||||
|
- [x] Organize runner-related files into dedicated runners/ folder
|
||||||
|
- [x] Fix "usermod: group 'docker' does not exist" error in runner Dockerfiles
|
||||||
|
- [x] Fix "registration file not found" error by adding automatic runner registration
|
||||||
|
- [x] Refactor runners to use official gitea/act_runner:nightly image with individual config files
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
- [Project Specifications](specs.md)
|
- [Project Specifications](specs.md)
|
||||||
|
|||||||
@@ -98,11 +98,18 @@ labfusion/
|
|||||||
│ ├── CLEAN_CODE.md # Clean code documentation
|
│ ├── CLEAN_CODE.md # Clean code documentation
|
||||||
│ └── RESILIENCE.md # Frontend resilience features
|
│ └── RESILIENCE.md # Frontend resilience features
|
||||||
# Docker Compose for Runners
|
# Docker Compose for Runners
|
||||||
docker-compose.runners.yml # Multi-runner Docker Compose setup
|
runners/
|
||||||
env.runners.example # Environment template for runners
|
docker-compose.runners.yml # Multi-runner Docker Compose setup
|
||||||
scripts/
|
env.runners.example # Environment template for runners
|
||||||
manage-runners.sh # Linux/macOS runner management script
|
manage-runners.sh # Linux/macOS runner management script
|
||||||
manage-runners.ps1 # Windows PowerShell runner management script
|
config_heavy.yaml # Configuration for heavy workloads (Java/Python)
|
||||||
|
config_light.yaml # Configuration for light workloads (Node.js/Frontend)
|
||||||
|
config_docker.yaml # Configuration for Docker workloads
|
||||||
|
config_security.yaml # Configuration for security workloads
|
||||||
|
data/ # Shared data directory
|
||||||
|
data_light/ # Light runner data directory
|
||||||
|
data_docker/ # Docker runner data directory
|
||||||
|
data_security/ # Security runner data directory
|
||||||
|
|
||||||
└── docs/ # Documentation
|
└── docs/ # Documentation
|
||||||
├── specs.md # Project specifications
|
├── specs.md # Project specifications
|
||||||
|
|||||||
14
runners/.env.runners
Normal file
14
runners/.env.runners
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Gitea Runners Environment Configuration
|
||||||
|
# Copy this file to .env.runners and update with your actual values
|
||||||
|
|
||||||
|
# Gitea instance URL (adjust port if different)
|
||||||
|
GITEA_INSTANCE_URL=http://localhost:3000
|
||||||
|
|
||||||
|
# Runner registration token (get this from Gitea Admin > Actions > Runners)
|
||||||
|
GITEA_RUNNER_REGISTRATION_TOKEN=your_runner_registration_token_here
|
||||||
|
|
||||||
|
# Optional: Override runner names
|
||||||
|
# GITEA_RUNNER_NAME_HEAVY=labfusion-runner-heavy
|
||||||
|
# GITEA_RUNNER_NAME_LIGHT=labfusion-runner-light
|
||||||
|
# GITEA_RUNNER_NAME_DOCKER=labfusion-runner-docker
|
||||||
|
# GITEA_RUNNER_NAME_SECURITY=labfusion-runner-security
|
||||||
@@ -3,17 +3,19 @@ version: '3.8'
|
|||||||
services:
|
services:
|
||||||
# Runner 1: Heavy workloads (Java/Python)
|
# Runner 1: Heavy workloads (Java/Python)
|
||||||
gitea-runner-heavy:
|
gitea-runner-heavy:
|
||||||
image: gitea/act_runner:latest
|
image: docker.io/gitea/act_runner:nightly
|
||||||
container_name: labfusion-runner-heavy
|
|
||||||
environment:
|
environment:
|
||||||
- GITEA_INSTANCE_URL=${GITEA_INSTANCE_URL:-http://localhost:3000}
|
CONFIG_FILE: /config.yaml
|
||||||
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN}
|
GITEA_INSTANCE_URL: ${GITEA_INSTANCE_URL}
|
||||||
- GITEA_RUNNER_NAME=labfusion-runner-heavy
|
GITEA_RUNNER_REGISTRATION_TOKEN: ${GITEA_RUNNER_REGISTRATION_TOKEN}
|
||||||
- GITEA_RUNNER_LABELS=ubuntu-latest,self-hosted,heavy,java,python
|
GITEA_RUNNER_NAME: labfusion-runner-heavy
|
||||||
|
GITEA_RUNNER_LABELS: ubuntu-latest,self-hosted,heavy,java,python
|
||||||
|
env_file:
|
||||||
|
- .env.runners
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./config_heavy.yaml:/config.yaml
|
||||||
|
- ./data:/data
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- runner-data-heavy:/data
|
|
||||||
- shared-cache:/cache
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
@@ -34,17 +36,19 @@ services:
|
|||||||
|
|
||||||
# Runner 2: Light workloads (Node.js/Frontend)
|
# Runner 2: Light workloads (Node.js/Frontend)
|
||||||
gitea-runner-light:
|
gitea-runner-light:
|
||||||
image: gitea/act_runner:latest
|
image: docker.io/gitea/act_runner:nightly
|
||||||
container_name: labfusion-runner-light
|
|
||||||
environment:
|
environment:
|
||||||
- GITEA_INSTANCE_URL=${GITEA_INSTANCE_URL:-http://localhost:3000}
|
CONFIG_FILE: /config.yaml
|
||||||
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN}
|
GITEA_INSTANCE_URL: ${GITEA_INSTANCE_URL}
|
||||||
- GITEA_RUNNER_NAME=labfusion-runner-light
|
GITEA_RUNNER_REGISTRATION_TOKEN: ${GITEA_RUNNER_REGISTRATION_TOKEN}
|
||||||
- GITEA_RUNNER_LABELS=ubuntu-latest,self-hosted,light,nodejs,frontend
|
GITEA_RUNNER_NAME: labfusion-runner-light
|
||||||
|
GITEA_RUNNER_LABELS: ubuntu-latest,self-hosted,light,nodejs,frontend
|
||||||
|
env_file:
|
||||||
|
- .env.runners
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./config_light.yaml:/config.yaml
|
||||||
|
- ./data_light:/data
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- runner-data-light:/data
|
|
||||||
- shared-cache:/cache
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
@@ -65,17 +69,19 @@ services:
|
|||||||
|
|
||||||
# Runner 3: Integration/Docker workloads
|
# Runner 3: Integration/Docker workloads
|
||||||
gitea-runner-docker:
|
gitea-runner-docker:
|
||||||
image: gitea/act_runner:latest
|
image: docker.io/gitea/act_runner:nightly
|
||||||
container_name: labfusion-runner-docker
|
|
||||||
environment:
|
environment:
|
||||||
- GITEA_INSTANCE_URL=${GITEA_INSTANCE_URL:-http://localhost:3000}
|
CONFIG_FILE: /config.yaml
|
||||||
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN}
|
GITEA_INSTANCE_URL: ${GITEA_INSTANCE_URL}
|
||||||
- GITEA_RUNNER_NAME=labfusion-runner-docker
|
GITEA_RUNNER_REGISTRATION_TOKEN: ${GITEA_RUNNER_REGISTRATION_TOKEN}
|
||||||
- GITEA_RUNNER_LABELS=ubuntu-latest,self-hosted,docker,integration
|
GITEA_RUNNER_NAME: labfusion-runner-docker
|
||||||
|
GITEA_RUNNER_LABELS: ubuntu-latest,self-hosted,docker,integration
|
||||||
|
env_file:
|
||||||
|
- .env.runners
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./config_docker.yaml:/config.yaml
|
||||||
|
- ./data_docker:/data
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- runner-data-docker:/data
|
|
||||||
- shared-cache:/cache
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
@@ -96,17 +102,19 @@ services:
|
|||||||
|
|
||||||
# Optional: Runner for specific tasks (e.g., security scans)
|
# Optional: Runner for specific tasks (e.g., security scans)
|
||||||
gitea-runner-security:
|
gitea-runner-security:
|
||||||
image: gitea/act_runner:latest
|
image: docker.io/gitea/act_runner:nightly
|
||||||
container_name: labfusion-runner-security
|
|
||||||
environment:
|
environment:
|
||||||
- GITEA_INSTANCE_URL=${GITEA_INSTANCE_URL:-http://localhost:3000}
|
CONFIG_FILE: /config.yaml
|
||||||
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN}
|
GITEA_INSTANCE_URL: ${GITEA_INSTANCE_URL}
|
||||||
- GITEA_RUNNER_NAME=labfusion-runner-security
|
GITEA_RUNNER_REGISTRATION_TOKEN: ${GITEA_RUNNER_REGISTRATION_TOKEN}
|
||||||
- GITEA_RUNNER_LABELS=ubuntu-latest,self-hosted,security,scan
|
GITEA_RUNNER_NAME: labfusion-runner-security
|
||||||
|
GITEA_RUNNER_LABELS: ubuntu-latest,self-hosted,security,scan
|
||||||
|
env_file:
|
||||||
|
- .env.runners
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./config_security.yaml:/config.yaml
|
||||||
|
- ./data_security:/data
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- runner-data-security:/data
|
|
||||||
- shared-cache:/cache
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
# 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,209 +0,0 @@
|
|||||||
#!/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