⚠️ DEVELOPMENT STATUS: Not Production-ReadyThis project is currently in active development and is not production-ready. It currently only supports local deployment using LXD virtualization for development and testing purposes.
Current Scope:
- ✅ Local LXD virtual machine provisioning
- ✅ Development and testing workflows
- ❌ No real cloud provider support (AWS, GCP, Azure, Hetzner, etc.)
- ❌ No production deployment capabilities
📋 MVP Goal: After completing the roadmap, we will have a Minimum Viable Product (MVP) that supports real cloud providers and production deployments.
This Rust application provides automated deployment infrastructure for Torrust tracker projects. Currently focused on local development and testing, it manages VM provisioning and cloud-init execution using LXD virtual machines. The goal is to establish the foundational deployment patterns that will later support real cloud providers.
Current Development Phase:
- ✅ Create local VMs supporting cloud-init for development and CI testing
- ✅ Test cloud-init execution and verification in controlled environments
- ✅ Support Docker Compose inside VMs for application stacks
- ✅ Fast, easy to install and use local development solution
- ✅ No nested virtualization dependency (CI compatibility)
Future MVP Goals: (See roadmap)
- 🔄 Real cloud provider support (Hetzner, AWS, GCP, Azure)
- 🔄 Production deployment capabilities
- 🔄 Multi-environment management
This repository uses LXD virtual machines for local virtualization and development:
- Technology: Virtual machines with cloud-init support
- Status: ✅ Production-ready for local development and CI testing
- Best for: Local development, CI/CD environments, fast iteration
- Requirements: No special virtualization needed
📖 See detailed documentation →
| Feature | LXD Virtual Machines |
|---|---|
| GitHub Actions Support | ✅ Guaranteed |
| Nested Virtualization | ❌ Not needed |
| Boot Time | ✅ Fast (~5-10s) |
| Resource Usage | ✅ Efficient |
| Installation | ✅ Simple setup |
This is a Rust application that automates deployment infrastructure using OpenTofu and Ansible.
The project provides a dependency installer tool that automatically detects and installs required dependencies:
# Install all required dependencies
cargo run --bin dependency-installer install
# Check which dependencies are installed
cargo run --bin dependency-installer check
# List all dependencies with status
cargo run --bin dependency-installer listThe installer supports: OpenTofu, Ansible, LXD, and cargo-machete.
For detailed information, see 📖 Dependency Installer →.
If you prefer manual installation or need to troubleshoot:
Check installations:
lxd version && tofu version && ansible --version && cargo --versionMissing tools? See detailed installation guides:
Quick manual install:
# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install LXD
sudo snap install lxd && sudo lxd init --auto && sudo usermod -a -G lxd $USER && newgrp lxd
# Install OpenTofu
curl -fsSL https://get.opentofu.org/install-opentofu.sh | sudo bash
# Install Ansible
sudo apt install ansibleThe main application provides usage instructions:
# Build and run the application
cargo run
# Or install and run directly
cargo install --path .
torrust-tracker-deployerFor detailed usage instructions, command reference, and examples, see the 👤 User Guide.
The application includes comprehensive logging with configurable format, output mode, and directory. See 📖 Logging Guide for details on logging configuration options.
This project includes convenient scripts for common development tasks:
# Run all linters (markdown, YAML, TOML, shell scripts, Rust)
cargo run --bin linter allOr run individual linters:
cargo run --bin linter markdown # Markdown linting
cargo run --bin linter yaml # YAML linting
cargo run --bin linter toml # TOML linting
cargo run --bin linter cspell # Spell checking
cargo run --bin linter clippy # Rust code analysis
cargo run --bin linter rustfmt # Rust formatting check
cargo run --bin linter shellcheck # Shell script lintingUse the E2E test binaries to run automated infrastructure tests with hardcoded environments:
# Run comprehensive E2E tests (LOCAL ONLY - connectivity issues in GitHub runners)
cargo run --bin e2e-tests-full
# Run individual E2E test suites
cargo run --bin e2e-config-tests # Configuration generation and validation tests
cargo run --bin e2e-provision-tests # Infrastructure provisioning tests
# Keep the test environment after completion for inspection
cargo run --bin e2e-tests-full -- --keep
cargo run --bin e2e-provision-tests -- --keep
# Use custom templates directory
cargo run --bin e2e-tests-full -- --templates-dir ./custom/templates
# See all available options
cargo run --bin e2e-tests-full -- --help
⚠️ Important Notes:
- E2E tests create hardcoded environments with predefined configurations
- Use
--keepflag to inspect generateddata/andbuild/directories after testse2e-tests-fullcan only run locally due to connectivity issues in GitHub runners- To see final OpenTofu and Ansible templates, check
build/directories after running with--keep
⚠️ Manual deployment is not currently possible. The application only supports E2E tests with hardcoded environments.Temporary Workaround: Until the
provisioncommand is available as a user-facing command, you can use E2E tests to provision infrastructure for experimentation. See the reference section below for details.To explore the deployment process:
- Run E2E tests with
--keepflag:cargo run --bin e2e-tests-full -- --keep- Inspect generated templates in
build/directories- Review environment data in
data/directoriesManual deployment commands will be available after completing the roadmap.
📋 Reference: Experimenting with OpenTofu and Ansible manually (Temporary Workaround)
Note: This is a temporary workaround for experimentation until the
provisioncommand is available as a user-facing CLI command. Currently, infrastructure provisioning is only implemented in E2E tests.
If you want to experiment with OpenTofu and Ansible commands directly using the generated templates:
# Run E2E tests but keep the infrastructure for manual experimentation
cargo run --bin e2e-tests-full -- --keep
# This creates resolved templates (no variables) in build/ directories
# ✅ Verified: Creates build/e2e-full/tofu/lxd/ and build/e2e-full/ansible/# Navigate to the specific environment's resolved OpenTofu templates
cd build/e2e-full/tofu/lxd/
# Or navigate to resolved Ansible templates
cd build/e2e-full/ansible/
# Other available environments:
# cd build/e2e-provision/tofu/lxd/
# cd build/e2e-provision/ansible/
# cd build/e2e-config/ansible/ # (config tests don't create tofu resources)# From build/e2e-full/tofu/lxd/ - Execute OpenTofu commands
tofu plan -var-file=variables.tfvars # ✅ Verified: Works with resolved templates
tofu validate # Validate configuration
tofu output -json # View current outputs
# Note: tofu apply already executed during E2E test
# From build/e2e-full/ansible/ - Execute Ansible commands
ansible-playbook --list-hosts -i inventory.yml wait-cloud-init.yml # ✅ Verified: Works
ansible-playbook -i inventory.yml wait-cloud-init.yml # Run playbook
ansible-playbook -i inventory.yml install-docker.yml # Install Docker# Connect to the running LXD instance directly
lxc exec torrust-tracker-vm-e2e-full -- /bin/bash
# Or via SSH (IP may vary, check tofu output)
ssh -i fixtures/testing_rsa torrust@$(cd build/e2e-full/tofu/lxd && tofu output -json | jq -r '.instance_info.value.ip_address')# ✅ Verified: Destroy the infrastructure when done experimenting
cd build/e2e-full/tofu/lxd/
tofu destroy -var-file=variables.tfvars -auto-approve
# ✅ Verified: This removes both the VM instance and the LXD profile
# Alternative: Use LXD commands directly
# lxc delete torrust-tracker-vm-e2e-full --force
# lxc profile delete torrust-profile-e2e-full
⚠️ Important: Currently there's no application command to destroy infrastructure manually. You must use either:
- OpenTofu destroy (recommended) - Uses resolved templates in
build/directories- LXD commands - Direct LXD resource management
- Re-run E2E tests - Automatically destroys and recreates infrastructure
📖 For comprehensive LXD commands and examples, see LXD documentation
- Provision: OpenTofu creates and configures VMs with cloud-init
- Configure: Ansible connects to VMs and executes management tasks
- Verify: Automated checks ensure proper setup and functionality
| Phase | Tool | Purpose |
|---|---|---|
| Infrastructure | OpenTofu | VM provisioning and cloud-init setup |
| Configuration | Ansible | Task execution and configuration management |
| Verification | Ansible Playbooks | System checks and validation |
📖 See detailed Ansible documentation →
The repository includes comprehensive GitHub Actions workflows for CI testing:
.github/workflows/linting.yml- Code Quality - Runs all linters (markdown, YAML, TOML, Rust, shell scripts).github/workflows/testing.yml- Unit Tests - Runs Rust unit tests and basic validation.github/workflows/test-e2e-config.yml- E2E Config Tests - Tests configuration generation and validation.github/workflows/test-e2e-provision.yml- E2E Provision Tests - Tests infrastructure provisioning workflows.github/workflows/test-lxd-provision.yml- LXD Provisioning - Tests LXD VM provisioning specifically
Note: The full E2E tests (
e2e-tests-full) can only be executed locally due to connectivity issues documented indocs/github-actions-issues/.
This project follows a structured development roadmap to evolve from the current local development focus to a production-ready deployment solution.
Current Development Status:
- ✅ Local LXD Infrastructure: VM provisioning, cloud-init, E2E testing
- ✅ Development Workflows: Linting, testing, CI/CD automation
- ✅ Foundation Layer: OpenTofu + Ansible + Docker integration
Next Major Milestones:
- 🔄 Main Application Commands:
create,deploy,destroy,status - � Real Cloud Providers: Starting with Hetzner, expanding to AWS/GCP/Azure
- 🔄 Production Features: HTTPS, backups, monitoring stack
├── .github/ # CI/CD workflows and GitHub configuration
│ └── workflows/ # GitHub Actions workflow files
├── build/ # 📁 Generated runtime configs (git-ignored)
│ ├── e2e-config/ # E2E config test runtime files
│ ├── e2e-full/ # E2E full test runtime files
│ └── e2e-provision/ # E2E provision test runtime files
├── data/ # Environment-specific data and configurations
│ ├── e2e-config/ # E2E config test environment data
│ ├── e2e-full/ # E2E full test environment data
│ ├── e2e-provision/ # E2E provision test environment data
│ └── logs/ # Application logs
├── docker/ # Docker-related configurations
│ └── provisioned-instance/ # Docker setup for provisioned instances
├── docs/ # 📖 Detailed documentation
│ ├── tech-stack/ # Technology-specific documentation
│ │ ├── opentofu.md # OpenTofu installation and usage
│ │ ├── ansible.md # Ansible installation and usage
│ │ └── lxd.md # LXD virtual machines
│ ├── decisions/ # Architecture Decision Records (ADRs)
│ ├── contributing/ # Contributing guidelines and conventions
│ │ ├── README.md # Main contributing guide
│ │ ├── branching.md # Git branching conventions
│ │ ├── commit-process.md # Commit process and pre-commit checks
│ │ ├── error-handling.md # Error handling principles
│ │ ├── module-organization.md # Module organization conventions
│ │ └── testing/ # Testing conventions and guides
│ ├── features/ # Feature specifications and documentation
│ ├── research/ # Research and analysis documents
│ └── *.md # Various documentation files
├── examples/ # Example configurations and usage
├── fixtures/ # Test fixtures and sample data
│ ├── testing_rsa* # SSH key pair for testing
│ └── tofu/ # OpenTofu test fixtures
├── packages/ # Rust workspace packages
│ └── linting/ # Linting utilities package
│ └── src/ # Linting implementation source code
├── scripts/ # Development and utility scripts
│ └── setup/ # Installation scripts for dependencies
├── src/ # 🦀 Main Rust application source code (DDD Architecture)
│ ├── main.rs # Main application binary entry point
│ ├── lib.rs # Library root module
│ ├── container.rs # Dependency injection container
│ ├── logging.rs # Logging configuration
│ ├── bin/ # Binary executables
│ │ ├── linter.rs # Unified linting command interface
│ │ └── e2e*.rs # End-to-end testing binaries
│ ├── application/ # Application layer (use cases, commands)
│ ├── domain/ # Domain layer (business logic, entities)
│ ├── infrastructure/ # Infrastructure layer (external systems)
│ ├── shared/ # Shared utilities and common code
│ ├── testing/ # Testing utilities and mocks
│ ├── config/ # Configuration handling
│ └── e2e/ # End-to-end testing infrastructure
├── templates/ # 📁 Template configurations (git-tracked)
│ ├── tofu/ # 🏗️ OpenTofu/Terraform templates
│ │ └── lxd/ # LXD VM template configuration
│ └── ansible/ # 🤖 Ansible playbook templates
├── tests/ # Integration and system tests
├── target/ # 🦀 Rust build artifacts (git-ignored)
├── Cargo.toml # Rust workspace configuration
├── Cargo.lock # Rust dependency lock file
├── cspell.json # Spell checking configuration
├── project-words.txt # Custom dictionary for spell checking
├── .markdownlint.json # Markdown linting configuration
├── .taplo.toml # TOML formatting configuration
├── .yamllint-ci.yml # YAML linting configuration for CI
├── README.md # This file - project overview
├── LICENSE # Project license
└── .gitignore # Git ignore rules
- 👤 User Guide - Getting started, command reference, and usage examples
- 🤝 Contributing Guide - Git workflow, commit process, and linting conventions
- 🗺️ Roadmap - Development roadmap and MVP goals
- 📖 Documentation Organization Guide - How documentation is organized and where to contribute
- 📖 OpenTofu Setup Guide - Installation, common commands, and best practices
- 📖 Ansible Setup Guide - Installation, configuration, and project usage
- 📖 VM Providers Comparison - Detailed comparison and decision rationale
This project is currently focused on local development. The path to production-ready deployment is outlined in our 📋 Roadmap.
Key upcoming milestones:
- Real Cloud Provider Support: Starting with Hetzner, then expanding to AWS, GCP, and Azure
- Production Commands:
create,deploy,destroy, andstatuscommands for production environments - Application Stack Management: Complete Docker Compose stacks with Torrust Tracker, MySQL, Prometheus, and Grafana
- HTTPS Support: SSL/TLS configuration for all services
- Backup & Recovery: Database backups and disaster recovery procedures