Start the Torrust Tracker application services on a released environment.
Starts the Docker Compose services for the Torrust Tracker, bringing the application online. This command takes an environment from the "Released" state to the "Running" state with active tracker services.
The run command starts services using docker compose up -d and verifies they are running and accessible.
torrust-tracker-deployer run <ENVIRONMENT><ENVIRONMENT>(required) - Name of the environment to start
- Environment released - Must run
releasecommand first - Docker Compose files deployed - Application configuration must be on VM
- Firewall configured - Tracker ports must be open (done by
configure)
[Released] --run--> [Running]
When you run an environment:
- Starts Docker Compose services - Brings up tracker container (
docker compose up -d) - Validates services are running - Checks Docker Compose status
- Validates external accessibility - Verifies tracker services respond from outside VM
- Tracker API health check (port 1212) - required
- HTTP Tracker health checks (all configured HTTP tracker ports) - optional
Note: All tracker ports must be explicitly configured (port 0 for dynamic assignment is not supported). See ADR: Port Zero Not Supported for details.
Important: Initial backup creation is not yet automatically triggered during the run command. This is a planned enhancement (Phase 4 Part 2.2).
Currently, after the run command completes:
-
The backup service is configured and the crontab entry is installed
-
Scheduled backups will run automatically on your configured schedule via crontab
-
You can manually trigger an initial backup using:
ssh -i <key> user@<instance-ip> cd /opt/torrust docker compose --profile backup run --rm backup
For more information on manual backup procedures, see Backup Management.
The tracker container provides:
- UDP Tracker - BitTorrent announce endpoints (default ports: 6868, 6969)
- HTTP Tracker - HTTP-based announce endpoint (default port: 7070)
- HTTP API - RESTful API for tracker management (default port: 1212)
All services run inside a single torrust/tracker:develop Docker container.
When the run command completes successfully, it displays service URLs for easy access:
⏳ [1/2] Validating environment...
⏳ ✓ Environment name validated: full-stack-docs (took 0ms)
⏳ [2/2] Running application services...
⏳ ✓ Services started (took 39.9s)
✅ Run command completed for 'full-stack-docs'
Services are now accessible:
Tracker (UDP): udp://10.140.190.211:6969/announce
Tracker (UDP): udp://10.140.190.211:6970/announce
Tracker (HTTP): https://tracker1.example.com/announce
Tracker (HTTP): https://tracker2.example.com/announce
API: https://api.example.com/api
Health Check: https://health.example.com/health_check
Grafana: https://grafana.example.com/
Note: HTTPS services require DNS configuration. See 'show' command for details.
Tip: Run 'torrust-tracker-deployer show full-stack-docs' for full details
Notes:
- Only publicly accessible services are shown (localhost-only services are excluded)
- UDP trackers are not shown (no web-accessible endpoint)
- Prometheus is internal-only and not displayed
- For HTTPS/TLS environments, you'll also see a DNS configuration hint
For environments with TLS configured, you'll see additional DNS configuration guidance:
✓ Run command completed for 'my-tls-env'
Service URLs:
API: https://tracker.example.com:1212
HTTP Tracker: https://tracker.example.com:7070
Health Check: https://tracker.example.com:1212/api/health_check
⚠️ DNS Configuration Required:
Configure these domains to point to 192.168.1.100:
- tracker.example.com
Tip: Run 'torrust-tracker-deployer show my-tls-env' for full details
The run command supports JSON output for automation workflows using the --output-format json or -o json flag.
torrust-tracker-deployer run <ENVIRONMENT> --output-format json
# Or use the short form:
torrust-tracker-deployer run <ENVIRONMENT> -o json{
"environment_name": "my-environment",
"state": "Running",
"services": {
"udp_trackers": ["udp://udp.tracker.local:6969/announce"],
"https_http_trackers": [],
"direct_http_trackers": ["http://10.140.190.133:7070/announce"],
"localhost_http_trackers": [],
"api_endpoint": "http://10.140.190.133:1212/api",
"api_uses_https": false,
"api_is_localhost_only": false,
"health_check_url": "http://10.140.190.133:1313/health_check",
"health_check_uses_https": false,
"health_check_is_localhost_only": false,
"tls_domains": []
},
"grafana": {
"url": "http://10.140.190.133:3000/",
"uses_https": false
}
}When TLS is configured, the output includes HTTPS URLs and domain information:
{
"environment_name": "my-tls-env",
"state": "Running",
"services": {
"udp_trackers": ["udp://udp.tracker.example.com:6969/announce"],
"https_http_trackers": ["https://tracker.example.com:7070/announce"],
"direct_http_trackers": [],
"localhost_http_trackers": [],
"api_endpoint": "https://tracker.example.com:1212/api",
"api_uses_https": true,
"api_is_localhost_only": false,
"health_check_url": "https://tracker.example.com:1313/health_check",
"health_check_uses_https": true,
"health_check_is_localhost_only": false,
"tls_domains": ["tracker.example.com"]
},
"grafana": {
"url": "https://tracker.example.com:3000/",
"uses_https": true
}
}# Get API endpoint for automated testing
API_ENDPOINT=$(torrust-tracker-deployer run my-env -o json | jq -r '.services.api_endpoint')
curl "$API_ENDPOINT/health_check"# Determine if API uses HTTPS
USES_HTTPS=$(torrust-tracker-deployer run my-env -o json | jq -r '.services.api_uses_https')
if [ "$USES_HTTPS" = "true" ]; then
echo "HTTPS is enabled"
else
echo "Using HTTP only"
fi# Get all HTTP/HTTPS tracker announce URLs for testing
torrust-tracker-deployer run my-env -o json | \
jq -r '.services | (.direct_http_trackers + .https_http_trackers)[]'# Extract domains that need DNS configuration
DOMAINS=$(torrust-tracker-deployer run my-env -o json | jq -r '.services.tls_domains[]')
for domain in $DOMAINS; do
echo "Configure DNS A record: $domain → $(jq -r '.services.api_endpoint' <<< "$JSON" | cut -d: -f2 | tr -d '/')"
done# Save output for later analysis
torrust-tracker-deployer run production-env -o json > run-output.json
# Parse for verification
jq '.services.api_endpoint' run-output.json
jq '.services.udp_trackers[]' run-output.json
jq '.grafana.url' run-output.json| Field | Type | Description |
|---|---|---|
environment_name |
string | Name of the environment |
state |
string | Always "Running" after successful run |
services.udp_trackers |
string[] | UDP tracker announce URLs |
services.https_http_trackers |
string[] | HTTPS HTTP tracker announce URLs (TLS configured) |
services.direct_http_trackers |
string[] | HTTP tracker announce URLs (no TLS) |
services.localhost_http_trackers |
string[] | Localhost-only HTTP trackers (for testing) |
services.api_endpoint |
string | Tracker API base URL |
services.api_uses_https |
boolean | True if API uses HTTPS |
services.api_is_localhost_only |
boolean | True if API only bound to localhost |
services.health_check_url |
string | Health check endpoint URL |
services.health_check_uses_https |
boolean | True if health check uses HTTPS |
services.health_check_is_localhost_only |
boolean | True if health check only on localhost |
services.tls_domains |
string[] | Domains requiring DNS configuration for TLS |
grafana.url |
string | Grafana dashboard URL (if enabled) |
grafana.uses_https |
boolean | True if Grafana uses HTTPS |
Note: grafana will be null if monitoring is not enabled in the environment configuration.
# Start tracker services
torrust-tracker-deployer run my-environment# 1. Create environment
torrust-tracker-deployer create template --provider lxd > my-env.json
# Edit my-env.json with your settings
torrust-tracker-deployer create environment --env-file my-env.json
# 2. Provision infrastructure
torrust-tracker-deployer provision my-environment
# 3. Configure system
torrust-tracker-deployer configure my-environment
# 4. Release application
torrust-tracker-deployer release my-environment
# 5. Start services
torrust-tracker-deployer run my-environment
# Tracker is now running!After running, you can verify the tracker is working:
# Get VM IP address
VM_IP=$(torrust-tracker-deployer show my-environment | grep 'IP Address' | awk '{print $3}')
# Check tracker API health
curl http://$VM_IP:1212/api/health_check
# Expected: {"status":"ok"} or similar health response
# Check tracker stats
curl http://$VM_IP:1212/api/v1/stats
# Expected: JSON with tracker statistics (torrents, seeders, leechers, etc.)
# Check HTTP tracker health
curl http://$VM_IP:7070/api/health_check
# Expected: {"status":"ok"} or similar health response# SSH into VM
ssh -i ~/.ssh/your-key user@$VM_IP
# Check Docker Compose services
cd /opt/torrust
docker compose ps
# Expected output shows "tracker" service with status "Up"
# View tracker logs
docker compose logs tracker
# Follow tracker logs in real-time
docker compose logs -f trackerIf you enabled backup in your environment configuration:
# Check if backup files were created
ssh -i ~/.ssh/your-key user@$VM_IP "ls -lh /opt/torrust/storage/backup/sqlite/"
ssh -i ~/.ssh/your-key user@$VM_IP "ls -lh /opt/torrust/storage/backup/config/"
# Expected: Files like sqlite_20260203_030000.db.gz and config_20260203_030000.tar.gz
# Check crontab for scheduled backups
ssh -i ~/.ssh/your-key user@$VM_IP "crontab -l"
# Expected: Backup cron job with your configured schedule
# View backup logs
ssh -i ~/.ssh/your-key user@$VM_IP "tail -20 /var/log/torrust-backup.log"
# Expected: Messages showing backup cycle completed successfullyThe tracker exposes these ports (configurable in environment JSON):
| Port | Protocol | Service | Purpose |
|---|---|---|---|
| 6868 | UDP | UDP Tracker | BitTorrent announce (UDP) |
| 6969 | UDP | UDP Tracker | BitTorrent announce (UDP) |
| 7070 | TCP | HTTP Tracker | BitTorrent announce (HTTP) |
| 1212 | TCP | HTTP API | Tracker management API |
All ports are accessible externally if firewall is configured correctly.
Problem: Trying to run before releasing application files.
Solution:
# Run release first
torrust-tracker-deployer release my-environment
# Then try run again
torrust-tracker-deployer run my-environmentProblem: Docker shows services running but API not responding.
Solution:
# Get VM IP
VM_IP=$(torrust-tracker-deployer show my-environment | grep 'IP Address' | awk '{print $3}')
# Check if service is listening internally
ssh -i ~/.ssh/your-key user@$VM_IP "curl http://localhost:1212/api/health_check"
# If this works, it's a firewall issue - check UFW rules
ssh -i ~/.ssh/your-key user@$VM_IP "sudo ufw status numbered"
# Verify tracker ports are allowed (6868/udp, 6969/udp, 7070/tcp, 1212/tcp)Problem: Container starts but immediately exits.
Solution:
# SSH into VM and check logs
ssh -i ~/.ssh/your-key user@$VM_IP "cd /opt/torrust && docker compose logs tracker"
# Common issues:
# 1. Configuration error in tracker.toml
# 2. Database file permissions
# 3. Port already in use
# Check tracker configuration
ssh -i ~/.ssh/your-key user@$VM_IP "cat /opt/torrust/storage/tracker/etc/tracker.toml"
# Check database file exists and has correct permissions
ssh -i ~/.ssh/your-key user@$VM_IP "ls -la /opt/torrust/storage/tracker/lib/database/"Problem: Services running internally but not accessible from outside.
Solution:
# Verify firewall rules
ssh -i ~/.ssh/your-key user@$VM_IP "sudo ufw status numbered"
# Check if ports are listening
ssh -i ~/.ssh/your-key user@$VM_IP "sudo netstat -tulnp | grep -E '6868|6969|7070|1212'"
# Test connectivity from host
nc -zv $VM_IP 7070 # HTTP Tracker
nc -zv $VM_IP 1212 # HTTP API
# For UDP (may timeout but verifies firewall)
nc -zvu $VM_IP 6868 # UDP TrackerTo stop tracker services:
# SSH into VM
ssh -i ~/.ssh/your-key user@$VM_IP
# Stop services
cd /opt/torrust
docker compose down
# Or stop without removing containers
docker compose stopTo restart after stopping:
# Re-run the run command
torrust-tracker-deployer run my-environment
# Or SSH and start manually
ssh -i ~/.ssh/your-key user@$VM_IP "cd /opt/torrust && docker compose up -d"The run command performs external health checks to validate deployment:
-
Docker Compose Status Check (internal, via SSH)
- Verifies tracker container is in "running" state
- Checks via
docker compose ps
-
Tracker API Health Check (external, direct HTTP)
- Tests
http://<vm-ip>:1212/api/health_check - Required check - deployment fails if not accessible
- Validates both service functionality AND firewall rules
- Tests
-
HTTP Tracker Health Checks (external, direct HTTP)
- Tests
http://<vm-ip>:<port>/health_checkfor all configured HTTP trackers - Required checks - deployment fails if not accessible
- If you configure multiple HTTP trackers (e.g., ports 7070, 7071, 7072), all will be validated
- Tests
If external checks fail but Docker shows services running, it indicates a firewall or network configuration issue.
Once running, the tracker can be used by BitTorrent clients:
udp://<vm-ip>:6868/announce
udp://<vm-ip>:6969/announce
http://<vm-ip>:7070/announce
# Get tracker statistics
curl http://$VM_IP:1212/api/v1/stats
# Authenticate with admin token (from environment config)
curl -H "Authorization: Bearer MyAccessToken" \
http://$VM_IP:1212/api/v1/statsAfter starting services:
- Test announce - Configure a BitTorrent client to use your tracker
- Monitor logs - Watch tracker activity via Docker logs
- Test API - Explore tracker management API endpoints
When finished:
- Stop services - Use
docker compose downon VM - Destroy environment - Use
destroycommand to clean up infrastructure
release- Deploy application configuration (required before run)configure- Configure system infrastructuretest- Verify infrastructure readinessdestroy- Clean up deployment
The run command executes these steps in order:
- Start services (
StartServicesStep) - Runsdocker compose up -dvia Ansible - Validate running services (
RunningServicesValidator)- Checks Docker Compose status (via SSH)
- Checks external tracker API accessibility (direct HTTP - required)
- Checks external HTTP tracker accessibility for all configured HTTP trackers (direct HTTP - optional)
The validation ensures:
- Services are actually running inside the VM
- Firewall rules allow external access
- Tracker API responds to health checks
- All HTTP tracker instances (if configured) are accessible externally
Port Configuration Note: Dynamic port assignment (port 0) is not supported. All tracker ports must be explicitly specified in the environment configuration. This ensures deterministic deployment and reliable firewall configuration.