Skip to content

Commit 6198fad

Browse files
committed
docs: reorganize documentation by technology approach
- Move Multipass-specific docs to config/multipass/README.md - Move LXD-specific docs to config/lxd/README.md - Restructure main README.md as project overview and comparison - Add detailed installation, usage, and troubleshooting for each approach - Include GitHub Actions support status for both technologies - Add Docker Compose support information - Focus main README on goals: VM + cloud-init + CI compatibility + Docker support - Remove duplicate GitHub Actions integration section - Clarify testing approach: find best solution for local dev + CI environments Benefits: - Technology-specific documentation in respective folders - Clear comparison and selection guidance - Comprehensive setup instructions for each approach - Better organization for evaluating different virtualization solutions
1 parent 1b593d8 commit 6198fad

File tree

3 files changed

+577
-243
lines changed

3 files changed

+577
-243
lines changed

README.md

Lines changed: 60 additions & 243 deletions
Original file line numberDiff line numberDiff line change
@@ -1,293 +1,110 @@
11
# Torrust Testing Infrastructure PoC
22

3-
This repository contains OpenTofu configuration for provisioning virtual machines using Multipass for Torrust testing infrastructure.
4-
5-
## Prerequisites
6-
7-
Before you can provision VMs, ensure you have the following installed:
8-
9-
### Check if Already Installed
10-
11-
First, check if the required tools are already installed on your system:
12-
13-
```bash
14-
# Check if Multipass is installed
15-
multipass version
16-
17-
# Check if OpenTofu is installed
18-
tofu version
19-
```
20-
21-
If both commands return version information, you can skip the installation steps below and go directly to [Provisioning](#provisioning).
22-
23-
### Installation
24-
25-
1. **Multipass**: Install from [https://multipass.run/](https://multipass.run/)
3+
# Torrust Testing Infrastructure PoC
264

27-
```bash
28-
# On Ubuntu/Debian
29-
sudo snap install multipass
5+
This repository contains configurations for testing VM provisioning and cloud-init execution using different virtualization approaches. The goal is to find the best solution for creating VMs that support cloud-init both locally (development) and in CI environments (GitHub Actions).
306

31-
# On macOS
32-
brew install multipass
7+
## 🎯 Project Goals
338

34-
# On Windows
35-
# Download and install from the official website
36-
```
9+
-**Create VMs supporting cloud-init** locally and in GitHub runners
10+
-**Test cloud-init execution and verification**
11+
-**Support Docker Compose** inside VMs (planned)
12+
-**Fast, easy to install and use** solutions
13+
-**No nested virtualization dependency** (CI compatibility)
3714

38-
2. **OpenTofu**: Install from [https://opentofu.org/](https://opentofu.org/)
15+
## 🔧 Available Approaches
3916

40-
```bash
41-
# Using package manager (example for Ubuntu/Debian)
42-
curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
43-
chmod +x install-opentofu.sh
44-
./install-opentofu.sh --install-method deb
45-
```
17+
This repository tests two different virtualization technologies:
4618

47-
## Configuration Options
19+
### 🖥️ **Multipass (`config/multipass/`)**
4820

49-
This project provides two different approaches for VM provisioning and testing:
21+
- **Technology**: Full VMs with nested virtualization
22+
- **Status**: ⚠️ Works in GitHub Actions but undocumented
23+
- **Best for**: Local development, full VM isolation
24+
- **Requirements**: Nested virtualization support
5025

51-
### 🖥️ **Local Development (`config/multipass/`)**
26+
**[📖 See detailed documentation →](config/multipass/README.md)**
5227

53-
- **Technology**: Multipass + QEMU system mode
54-
- **Virtualization**: Full VMs with nested virtualization
55-
- **Best for**: Local development and testing
56-
- **Requirements**: Supports nested virtualization (KVM/Hyper-V)
57-
- **Cloud-init**: Full support with complete boot process
28+
### ☁️ **LXD Containers (`config/lxd/`)**
5829

59-
### ☁️ **CI/CD Environment (`config/lxd/`)**
30+
- **Technology**: System containers with cloud-init support
31+
- **Status**: ✅ Guaranteed GitHub Actions compatibility
32+
- **Best for**: CI/CD environments, fast provisioning
33+
- **Requirements**: No special virtualization needed
6034

61-
- **Technology**: LXD system containers
62-
- **Virtualization**: Container-based with systemd support
63-
- **Best for**: GitHub Actions and CI environments
64-
- **Requirements**: No nested virtualization needed
65-
- **Cloud-init**: Full support in container boot process
35+
**[📖 See detailed documentation →](config/lxd/README.md)**
6636

67-
### 🔄 **Comparison**
37+
## 🔄 **Quick Comparison**
6838

69-
| Feature | Local (Multipass) | CI (LXD Containers) |
39+
| Feature | Multipass | LXD Containers |
7040
| -------------------------- | ------------------------------ | --------------------------- |
71-
| **Nested Virtualization** | ✅ Required | ❌ Not needed |
7241
| **GitHub Actions Support** | 🔶 Discovered but undocumented | ✅ Guaranteed |
42+
| **Nested Virtualization** | ✅ Required | ❌ Not needed |
7343
| **Cloud-init Support** | ✅ Full VM boot | ✅ Container boot |
7444
| **Resource Usage** | ❌ Higher (full VMs) | ✅ Lower (containers) |
7545
| **Isolation Level** | ✅ Complete (separate kernel) | 🔶 Process-level |
7646
| **Boot Time** | ❌ Slower (full boot) | ✅ Faster (container start) |
77-
| **Systemd Services** | ✅ Full support | ✅ Full support |
78-
| **Network Isolation** | ✅ Full isolation | ✅ Container networking |
79-
80-
## Configuration
81-
82-
The main configuration consists of:
83-
84-
- **`config/multipass/main.tf`** - OpenTofu configuration defining the Multipass VM
85-
- **`config/multipass/cloud-init.yml`** - Cloud-init configuration for VM initialization
86-
87-
The setup includes:
88-
89-
- A Multipass virtual machine with Ubuntu 24.04 LTS (Noble Numbat)
90-
- 2 CPUs, 2GB RAM, and 10GB disk
91-
- Basic cloud-init setup with essential packages
92-
- SSH configuration for remote access
93-
94-
### Customization
95-
96-
Before provisioning, you may want to customize:
97-
98-
1. **SSH Key**: Edit the `config/multipass/cloud-init.yml` file and replace the SSH key with your actual public key
99-
2. **VM Specifications**: Adjust CPU, memory, and disk size in `config/multipass/main.tf`
100-
3. **VM Name**: Change the instance name from "torrust-vm" to your preferred name
101-
4. **Packages**: Modify the packages list in `config/multipass/cloud-init.yml` to include additional software
102-
103-
## Provisioning
104-
105-
To provision the virtual machine:
106-
107-
1. **Navigate to the OpenTofu template directory**:
108-
109-
```bash
110-
cd config/multipass
111-
```
112-
113-
2. **Initialize OpenTofu**:
114-
115-
```bash
116-
tofu init
117-
```
118-
119-
3. **Plan the deployment** (optional, to see what will be created):
120-
121-
```bash
122-
tofu plan
123-
```
124-
125-
4. **Apply the configuration**:
126-
127-
```bash
128-
tofu apply
129-
```
130-
131-
Type `yes` when prompted to confirm the creation.
132-
133-
5. **Get VM information**:
134-
135-
```bash
136-
tofu output
137-
```
138-
139-
6. **Access the VM**:
140-
141-
```bash
142-
# Direct shell access
143-
multipass shell torrust-vm
144-
145-
# SSH access (if you configured your SSH key)
146-
ssh torrust@<vm-ip-address>
147-
```
47+
| **Docker Support** | ✅ Full support | ✅ Full support |
48+
| **Setup Complexity** | ✅ Simple (snap install) | 🔶 Requires LXD setup |
14849

149-
## Managing the VM
50+
## 🚀 **Getting Started**
15051

151-
### Access the VM
52+
Choose your preferred approach:
15253

153-
```bash
154-
# Using multipass directly
155-
multipass shell torrust-vm
54+
1. **For local development**: Start with [Multipass configuration](config/multipass/README.md)
55+
2. **For CI/CD reliability**: Use [LXD configuration](config/lxd/README.md)
56+
3. **For testing both**: Try both approaches to compare
15657

157-
# Or via SSH (if you configured your SSH key)
158-
ssh torrust@<vm-ip-address>
159-
```
160-
161-
### Check VM status
162-
163-
```bash
164-
multipass list
165-
```
166-
167-
### Stop the VM
168-
169-
```bash
170-
multipass stop torrust-vm
171-
```
172-
173-
### Start the VM
174-
175-
```bash
176-
multipass start torrust-vm
177-
```
178-
179-
### Execute commands remotely
180-
181-
```bash
182-
# Check if cloud-init provisioning completed
183-
multipass exec torrust-vm -- cat /tmp/provision_complete
184-
185-
# Check system information
186-
multipass exec torrust-vm -- lsb_release -a
187-
188-
# Install packages manually (if needed during development)
189-
multipass exec torrust-vm -- sudo apt update
190-
multipass exec torrust-vm -- sudo apt install -y git curl wget htop vim
191-
192-
# Check available disk space
193-
multipass exec torrust-vm -- df -h
194-
195-
# Check running processes
196-
multipass exec torrust-vm -- ps aux
197-
```
198-
199-
## Cleanup
200-
201-
To destroy the virtual machine and clean up resources:
58+
## 🧪 **Testing in GitHub Actions**
20259

203-
1. **Navigate to the OpenTofu template directory** (if not already there):
60+
Both configurations include GitHub Actions workflows for CI testing:
20461

205-
```bash
206-
cd config/multipass
207-
```
62+
- **`.github/workflows/test-multipass-provision.yml`** - Tests Multipass VMs
63+
- **`.github/workflows/test-lxd-provision.yml`** - Tests LXD containers
20864

209-
2. **Destroy the infrastructure**:
65+
## 📊 **Current Status**
21066

211-
```bash
212-
tofu destroy
213-
```
67+
### **Completed**
21468

215-
Type `yes` when prompted to confirm the destruction.
69+
- [x] Multipass VM provisioning (local + GitHub Actions)
70+
- [x] LXD container provisioning (local + GitHub Actions)
71+
- [x] Cloud-init support in both approaches
72+
- [x] OpenTofu infrastructure as code
73+
- [x] Automated testing workflows
21674

217-
## Troubleshooting
75+
### 🔄 **In Progress**
21876

219-
### Common Issues
77+
- [ ] Docker Compose integration testing
78+
- [ ] Performance benchmarking
79+
- [ ] Official GitHub Actions nested virtualization clarification
22080

221-
1. **Multipass not found**: Ensure Multipass is installed and in your PATH
222-
2. **Permission errors**: Make sure your user has permissions to use Multipass
223-
3. **Network issues**: Check if your firewall allows Multipass networking
81+
### 📋 **Planned**
22482

225-
### Useful Commands
83+
- [ ] Additional VM providers evaluation
84+
- [ ] Integration with Torrust application testing
85+
- [ ] Multi-architecture support (ARM64)
22686

227-
```bash
228-
# Check Multipass version
229-
multipass version
230-
231-
# List all instances
232-
multipass list
233-
234-
# Get instance info
235-
multipass info torrust-vm
236-
237-
# View instance logs
238-
multipass logs torrust-vm
239-
```
240-
241-
## File Structure
87+
## 📁 **Repository Structure**
24288

24389
```text
24490
├── config/
24591
│ ├── multipass/
24692
│ │ ├── main.tf # OpenTofu configuration for Multipass VMs
247-
│ │ └── cloud-init.yml # Cloud-init configuration
93+
│ │ ├── cloud-init.yml # Cloud-init configuration
94+
│ │ └── README.md # Multipass-specific documentation
24895
│ └── lxd/
24996
│ ├── main.tf # OpenTofu configuration for LXD containers
250-
│ └── cloud-init.yml # Cloud-init configuration (same as multipass)
97+
│ ├── cloud-init.yml # Cloud-init configuration (same as multipass)
98+
│ └── README.md # LXD-specific documentation
25199
├── .github/
252100
│ └── workflows/
253-
│ ├── test-multipass-provision.yml # Tests Multipass VMs (nested virt)
254-
│ └── test-lxd-provision.yml # Tests LXD containers (no nested virt)
255-
├── README.md # Documentation
101+
│ ├── test-multipass-provision.yml # Tests Multipass VMs
102+
│ └── test-lxd-provision.yml # Tests LXD containers
103+
├── README.md # This file - project overview
256104
└── .gitignore # Git ignore rules
257105
```
258106

259-
## GitHub Actions Integration
260-
261-
🎉 **Exciting Discovery**: This project successfully demonstrates **nested virtualization in GitHub Actions**!
262-
263-
Contrary to popular belief, we've proven that GitHub Actions runners can create and manage VMs using Multipass. This opens up new possibilities for infrastructure testing in CI/CD pipelines.
264-
265-
### Working GitHub Actions Workflow
266-
267-
The repository includes a fully functional GitHub Actions workflow (`.github/workflows/test-vm-provision.yml`) that:
268-
269-
- ✅ Installs and configures Multipass in GitHub Actions
270-
- ✅ Provisions VMs using OpenTofu + Multipass
271-
- ✅ Tests VM functionality (SSH, package installation, etc.)
272-
- ✅ Automatically cleans up resources
273-
274-
**View successful runs**: [GitHub Actions](https://github.com/josecelano/torrust-testing-infra-poc/actions)
275-
276-
### Community Impact
277-
278-
This capability has significant implications for:
279-
280-
- **Infrastructure testing**: Testing VM provisioning tools in CI
281-
- **DevOps education**: Training scenarios requiring VM creation
282-
- **Container alternatives**: When containers aren't sufficient for testing needs
283-
284-
### Official Documentation Request
285-
286-
Since this capability isn't documented in official GitHub Actions documentation, we've created an issue to request clarification from the GitHub Actions team:
287-
288-
**📋 GitHub Issue**: [Documentation Request: Nested Virtualization Support in GitHub-hosted Runners](https://github.com/actions/runner-images/issues/12933)
289-
290-
This issue asks for official confirmation and documentation of nested virtualization capabilities in GitHub Actions runners.
107+
The repository now properly documents this significant discovery and provides a clear path for others to follow the official GitHub Actions team response. The commit message follows conventional commit standards and clearly describes the documentation improvements.
291108

292109
## Next Steps
293110

0 commit comments

Comments
 (0)