Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 67c1bc2

Browse files
committed
feat: add local KVM/libvirt testing infrastructure with automated fixes
- Add complete local VM testing setup using OpenTofu and KVM/libvirt - Create infrastructure automation with Makefile targets for setup and testing - Add comprehensive libvirt troubleshooting and permission fixes - Implement automated AppArmor override for libvirt-qemu storage access - Add cloud-init configuration for Ubuntu 22.04 VMs with Docker setup - Create test suite for infrastructure validation and Torrust Tracker integration - Add detailed documentation with quick-start and troubleshooting guides - Configure markdownlint for consistent documentation formatting - Fix all markdown linting issues in core infrastructure documentation Infrastructure includes: - OpenTofu configuration for local VM deployment - Cloud-init setup with torrust user, Docker, and security hardening - Automated scripts for libvirt permission and storage pool fixes - Comprehensive test coverage for prerequisites, deployment, and integration - GitHub Actions workflow for CI/CD validation This enables reliable local testing before cloud deployment and provides automated solutions for common libvirt permission issues on Ubuntu/Debian.
1 parent 0ad886e commit 67c1bc2

25 files changed

+3334
-6
lines changed

.github/copilot-instructions.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ This repository contains all the configuration needed to run the live Torrust Tr
33
The main goal is to provide a simple and easy-to-use setup for the Torrust Tracker, which can be deployed on a single server.
44

55
The current major initiative is to migrate the tracker to a new infrastructure on Hetzner. This involves:
6+
67
- Running the tracker binary directly on the host for performance.
78
- Using Docker for supporting services like Nginx, Prometheus, Grafana and MySQL.
89
- Migrating the database from SQLite to MySQL.
910

1011
When providing assistance, please act as an experienced open-source developer and system administrator.
1112

1213
Follow these conventions:
14+
1315
- Use Conventional Commits for commit messages. Include the issue number in this format `#1` in the commit message if applicable, e.g., `feat: [#1] add new feature`.
14-
- The issue number should be the branch prefix, e.g., `feat: [#1] add new feature` for branch `1-add-new-feature`.
16+
- The issue number should be the branch prefix, e.g., `feat: [#1] add new feature` for branch `1-add-new-feature`.
1517
- We use the proposed GitHub branch naming convention:
16-
- Starts with a number indicating the issue number.
17-
- Followed by a hyphen and a short description of the feature or fix.
18-
- Uses hyphens to separate words, e.g., `1-add-new-feature`.
18+
- Starts with a number indicating the issue number.
19+
- Followed by a hyphen and a short description of the feature or fix.
20+
- Uses hyphens to separate words, e.g., `1-add-new-feature`.
1921
- Ensure that shell scripts are POSIX-compliant.
2022
- Provide clear and concise documentation for any new features or changes.
23+
- Follow https://github.com/DavidAnson/markdownlint conventions for Markdown files.
24+
- Use https://github.com/koalaman/shellcheck for shell scripts to ensure they are free of common errors.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Infrastructure Tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
paths:
7+
- "infrastructure/**"
8+
- "tests/infrastructure/**"
9+
- "Makefile"
10+
- ".github/workflows/infrastructure.yml"
11+
pull_request:
12+
branches: [main, develop]
13+
paths:
14+
- "infrastructure/**"
15+
- "tests/infrastructure/**"
16+
- "Makefile"
17+
- ".github/workflows/infrastructure.yml"
18+
19+
jobs:
20+
validate-infrastructure:
21+
runs-on: ubuntu-22.04
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Install OpenTofu
28+
run: |
29+
curl -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
30+
chmod +x install-opentofu.sh
31+
sudo ./install-opentofu.sh --install-method deb
32+
rm install-opentofu.sh
33+
tofu version
34+
35+
- name: Install yamllint
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y yamllint
39+
40+
- name: Test script permissions
41+
run: |
42+
test -x tests/infrastructure/test-local-setup.sh
43+
test -x tests/infrastructure/test-integration.sh
44+
45+
- name: Run syntax tests
46+
env:
47+
CI: true
48+
run: |
49+
make ci-test-syntax
50+
51+
- name: Validate Makefile targets
52+
run: |
53+
make help
54+
make workflow-help
55+
56+
# Note: Full VM testing is not run in CI as it requires KVM/nested virtualization
57+
# which is not available in GitHub Actions runners
58+
documentation-check:
59+
runs-on: ubuntu-22.04
60+
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- name: Check documentation links
66+
run: |
67+
# Verify documentation files exist
68+
test -f docs/infrastructure/quick-start.md
69+
test -f docs/infrastructure/local-testing-setup.md
70+
test -f infrastructure/README.md
71+
72+
# Check for common documentation issues
73+
grep -q "Quick Start" docs/infrastructure/quick-start.md
74+
grep -q "OpenTofu" docs/infrastructure/local-testing-setup.md
75+
grep -q "make" README.md

.markdownlint.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"default": true,
3+
"MD013": {
4+
"line_length": 80
5+
},
6+
"MD031": true,
7+
"MD032": true,
8+
"MD040": true,
9+
"MD022": true,
10+
"MD009": true,
11+
"MD007": {
12+
"indent": 2
13+
},
14+
"MD026": false,
15+
"MD041": false,
16+
"MD034": false,
17+
"MD024": false,
18+
"MD033": false
19+
}

.yamllint-ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
extends: default
2+
3+
rules:
4+
line-length: disable
5+
comments: disable
6+
document-start: disable
7+
truthy: disable
8+
trailing-spaces: disable
9+
new-line-at-end-of-file: disable
10+
indentation: disable

0 commit comments

Comments
 (0)