โ ๏ธ 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 โ
๐ See detailed comparison โ
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.
Install the required tools:
# Check installations
lxd version && tofu version && ansible --version && cargo --version
Missing tools? See detailed installation guides:
Quick 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 ansible
The main application provides usage instructions:
# Build and run the application
cargo run
# Or install and run directly
cargo install --path .
torrust-tracker-deployer
This project includes convenient scripts for common development tasks:
# Run all linters (markdown, YAML, TOML, shell scripts, Rust)
cargo run --bin linter all
Or 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 linting
๐ See linting documentation โ
Use 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
--keep
flag to inspect generateddata/
andbuild/
directories after testse2e-tests-full
can 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.To explore the deployment process:
- Run E2E tests with
--keep
flag: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
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.md # Testing conventions
โ โโโ 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
- ๐ค 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
, andstatus
commands 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