Deploy a Torrust Tracker with full provider support using native installation.
Alternative: For a faster setup with Docker (Hetzner only), see Docker Deployment.
- Rust toolchain - For building the deployer
- LXD - For local development (optional)
- Hetzner Account - For cloud deployments (optional)
- OpenTofu - Infrastructure as Code tool
- Ansible - Configuration management
- SSH keys - Key pair for VM access
Tip: Run
cargo run --bin dependency-installer checkto verify all prerequisites are met.
Before starting, decide which provider to use:
| Provider | Best For | Requirements |
|---|---|---|
| LXD | Local development, CI/CD, testing | Linux with LXD installed |
| Hetzner Cloud | Production deployments | Hetzner account + API token |
📖 See Provider Guides for detailed setup instructions.
# Install dependencies automatically
cargo run --bin dependency-installer install
# Verify installation
cargo run --bin dependency-installer checkNote: For manual installation instructions, see the tool-specific documentation in
docs/tech-stack/.
This example walks through the complete deployment lifecycle from template generation to infrastructure testing.
Create a template configuration file for your chosen provider:
For LXD (local development):
torrust-tracker-deployer create template --provider lxd my-environment.jsonFor Hetzner Cloud (production):
torrust-tracker-deployer create template --provider hetzner my-environment.jsonOutput:
✓ Template generated: my-environment.json
This creates a pre-filled template with provider-specific values that you can customize.
Edit the generated template:
nano my-environment.jsonExample LXD configuration:
{
"environment": {
"name": "my-environment"
},
"ssh_credentials": {
"private_key_path": "fixtures/testing_rsa",
"public_key_path": "fixtures/testing_rsa.pub",
"username": "torrust",
"port": 22
},
"provider": {
"provider": "lxd",
"profile_name": "torrust-profile-local"
}
}Example Hetzner configuration:
{
"environment": {
"name": "my-production-env"
},
"ssh_credentials": {
"private_key_path": "~/.ssh/id_ed25519",
"public_key_path": "~/.ssh/id_ed25519.pub",
"username": "torrust",
"port": 22
},
"provider": {
"provider": "hetzner",
"api_token": "your-hetzner-api-token-here",
"server_type": "cx22",
"location": "nbg1"
}
}Note: For LXD testing, use the test SSH keys from
fixtures/directory. For production, use your own SSH keys (e.g.,~/.ssh/id_ed25519).
Key fields to customize:
environment.name- Environment identifier (must be unique)ssh_credentials.private_key_path- Path to your SSH private key filessh_credentials.public_key_path- Path to your SSH public key filessh_credentials.username- SSH username for VM access (default: torrust)ssh_credentials.port- SSH port (default: 22)provider- Provider-specific configuration (see Provider Guides)
Generate the deployment environment from your template:
torrust-tracker-deployer create environment --env-file my-environment.jsonOutput:
✓ Validating configuration...
✓ Creating environment structure...
✓ Environment created successfully: my-environment
This creates the environment directory structure and validates your configuration.
Create and configure VM infrastructure:
torrust-tracker-deployer provision my-environmentOutput:
⏳ [1/3] Validating environment...
✓ Environment name validated: my-environment (took 0ms)
⏳ [2/3] Creating command handler...
✓ Done (took 0ms)
⏳ [3/3] Provisioning infrastructure...
✓ Infrastructure provisioned (took 39.0s)
✅ Environment 'my-environment' provisioned successfully
What happens:
- Creates LXD VM instance
- Configures network and storage
- Deploys SSH keys
- Waits for VM initialization
Duration: ~40-60 seconds
Install Docker and Docker Compose on the provisioned VM:
torrust-tracker-deployer configure my-environmentOutput:
⏳ [1/3] Validating environment...
✓ Environment name validated: my-environment (took 0ms)
⏳ [2/3] Creating command handler...
✓ Done (took 0ms)
⏳ [3/3] Configuring infrastructure...
✓ Infrastructure configured (took 43.1s)
✅ Environment 'my-environment' configured successfully
What happens:
- Installs Docker Engine
- Installs Docker Compose plugin
- Adds SSH user to docker group
- Configures security updates and firewall
- Verifies installation
Duration: ~40-60 seconds
Pull the Docker image and prepare for running:
torrust-tracker-deployer release my-environmentOutput:
⏳ [1/2] Validating environment...
✓ Environment name validated: my-environment (took 0ms)
⏳ [2/2] Releasing application...
✓ Application released successfully (took 7.1s)
✅ Release command completed successfully for 'my-environment'
What happens:
- Pulls tracker Docker image from registry
- Prepares Docker container configuration
- Sets up runtime environment
Duration: ~7-10 seconds
Start the tracker service:
torrust-tracker-deployer run my-environmentOutput:
⏳ [1/2] Validating environment...
✓ Environment name validated: my-environment (took 0ms)
⏳ [2/2] Running application services...
✓ Services started (took 10.3s)
✅ Run command completed for 'my-environment'
What happens:
- Starts tracker Docker container
- Waits for health checks to pass
- Verifies tracker is accessible
Duration: ~10-15 seconds
When you're done, destroy the environment:
torrust-tracker-deployer destroy my-environmentOutput:
⏳ [1/3] Validating environment...
✓ Environment name validated: my-environment (took 0ms)
⏳ [2/3] Creating command handler...
✓ Done (took 0ms)
⏳ [3/3] Tearing down infrastructure...
✓ Infrastructure torn down (took 218ms)
✅ Environment 'my-environment' destroyed successfully
What happens:
- Stops all running containers
- Destroys LXD VM instance
- Removes LXD profile
- Cleans up OpenTofu state
- Removes environment directories
# Create template, edit it, then provision, configure, release, and run
torrust-tracker-deployer create template dev.json && \
# Edit dev.json with your SSH keys and settings, then:
torrust-tracker-deployer create environment --env-file dev.json && \
torrust-tracker-deployer provision dev && \
torrust-tracker-deployer configure dev && \
torrust-tracker-deployer release dev && \
torrust-tracker-deployer run dev# Check dependencies
cargo run --bin dependency-installer check
# Create template
torrust-tracker-deployer create template <output-path>
# Create environment
torrust-tracker-deployer create environment --env-file <config-file>
# Provision infrastructure
torrust-tracker-deployer provision <environment>
# Configure software
torrust-tracker-deployer configure <environment>
# Release tracker
torrust-tracker-deployer release <environment>
# Run tracker
torrust-tracker-deployer run <environment>
# Run smoke tests
torrust-tracker-deployer test <environment>
# Clean up
torrust-tracker-deployer destroy <environment>Error: Failed to connect to LXD
Solution:
sudo lxd init --auto
sudo usermod -a -G lxd $USER
newgrp lxdError: Failed to connect via SSH
Solution:
# Check VM status
lxc list
# Verify cloud-init completed
lxc exec <instance-name> -- cloud-init status --wait
# Check SSH key permissions
chmod 600 /path/to/private/keyError: Docker command not found
Solution:
# SSH into VM
ssh -i <private-key> torrust@<vm-ip>
# Check Docker status
sudo systemctl status docker
# Restart Docker if needed
sudo systemctl restart docker
# Re-run configuration
torrust-tracker-deployer configure my-environmentError: Port 22 already in use
Solution:
# List existing containers
lxc list
# Remove old instance
lxc delete <instance-name> --force
# Try again
torrust-tracker-deployer provision my-environmentAfter completing this quick start:
- Read the user guides - Learn more about each command in
docs/user-guide/commands/ - Explore advanced configuration - Customize your deployments
- Integrate with CI/CD - Automate your deployment pipeline
- Review troubleshooting - Understand common issues and solutions
- Command Reference - Detailed documentation for all commands
- Architecture Guide - Understanding the codebase
- Contributing Guide - Contributing to the project
- Console Commands - Technical command reference
If you encounter issues:
- Check the troubleshooting section above
- Review the command-specific guides in
docs/user-guide/commands/ - Check the known issues documentation
- Open an issue on GitHub with:
- Steps to reproduce
- Error messages
- Environment details (OS, LXD version, etc.)