This document outlines the deployment process for the Torrust Tracker demo application.
- Ensure you have SSH access to the production server.
- The server should be provisioned and configured according to the Production Setup Guide.
The Torrust Tracker Demo now uses a twelve-factor app deployment workflow that separates infrastructure provisioning from application deployment.
Use the automated deployment workflow from your local development machine:
# Deploy infrastructure and application (complete workflow)
make infra-apply ENVIRONMENT=production
make app-deploy ENVIRONMENT=production
# Validate deployment
make app-health-check ENVIRONMENT=productionIf you need to manually deploy on the server:
-
SSH into the server.
-
Navigate to the application directory:
cd /home/torrust/github/torrust/torrust-tracker-demo/application -
Pull the latest changes from the repository:
git pull
-
Deploy using Docker Compose:
# Use the persistent volume environment file docker compose --env-file /var/lib/torrust/compose/.env pull docker compose --env-file /var/lib/torrust/compose/.env down docker compose --env-file /var/lib/torrust/compose/.env up -d
The deployment process generates SSL certificates on each deployment rather than reusing certificates. This approach provides several advantages:
-
Production Flexibility: Different environments use different domains:
- Local testing:
test.local - Staging:
staging.example.com - Production:
tracker.torrust-demo.com
- Local testing:
-
Certificate Validity: Self-signed certificates are domain-specific and must exactly match the domain being used in each deployment environment.
-
Security Best Practices: Fresh certificates for each deployment ensure no stale or leaked credentials are reused.
-
Workflow Consistency: The same deployment process works across all environments without manual certificate management or copying certificates between systems.
-
Zero Configuration: No need to maintain a certificate store or handle certificate distribution between development and production environments.
- Local/Testing: Self-signed certificates with 10-year validity (for convenience in testing)
- Production: Let's Encrypt certificates (automatically renewed)
The certificate generation happens during the application deployment phase
(make app-deploy) and includes:
- Self-signed certificates: Generated using OpenSSL with domain-specific Subject Alternative Names (SAN)
- Certificate placement: Stored in
/var/lib/torrust/proxy/certs/and/var/lib/torrust/proxy/private/on the target server - Container mounting: Certificates are mounted into nginx container at runtime
- Automatic configuration: nginx configuration is automatically templated with the correct certificate paths
While it would be possible to reuse certificates for local testing (since we
always use test.local), this approach ensures that the deployment workflow is
identical between local testing and production, reducing the chance of
environment-specific issues.
After deployment, verify that all services are running correctly.
Check the status of all Docker containers:
# From local machine
make app-health-check ENVIRONMENT=production
# Or manually on server
cd /home/torrust/github/torrust/torrust-tracker-demo/application
docker compose --env-file /var/lib/torrust/compose/.env psCheck the logs for the tracker container to ensure it started without errors:
./share/bin/tracker-filtered-logs.shExecute the following smoke tests from a machine with the torrust-tracker repository cloned.
-
UDP Announce:
cargo run -p torrust-tracker-client --bin udp_tracker_client announce \ udp://tracker.torrust-demo.com:6969/announce \ 9c38422213e30bff212b30c360d26f9a02136422 | jq -
HTTP Announce:
cargo run -p torrust-tracker-client --bin http_tracker_client announce \ https://tracker.torrust-demo.com/announce \ 9c38422213e30bff212b30c360d26f9a02136422 | jq -
Health Check Endpoint:
curl https://tracker.torrust-demo.com/api/health_check
-
Run the comprehensive tracker checker:
TORRUST_CHECKER_CONFIG='{ "udp_trackers": ["udp://tracker.torrust-demo.com:6969/announce"], "http_trackers": ["https://tracker.torrust-demo.com/announce"], "health_checks": ["https://tracker.torrust-demo.com/api/health_check"] }' cargo run -p torrust-tracker-client --bin tracker_checker