Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 8acc177

Browse files
committed
docs: add redesign documentation for configuration management
- Add configuration variables and user inputs analysis - Add environment naming and configuration design - Update redesign README with new documentation structure - Update project words dictionary with new terms These documents support the configuration management implementation design for the project redesign from PoC to production.
1 parent 34dd274 commit 8acc177

File tree

4 files changed

+506
-3
lines changed

4 files changed

+506
-3
lines changed

docs/redesign/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ After a quick review we move to Phase 2 (measure current behaviour: performance,
8080

8181
**Implementation Phases** (in new `torrust-tracker-installer` repository):
8282

83-
5. Implementation (build the new system)
84-
6. Testing & validation (comprehensive testing)
85-
7. Migration & deployment (production rollout)
83+
1. Implementation (build the new system)
84+
2. Testing & validation (comprehensive testing)
85+
3. Migration & deployment (production rollout)
8686

8787
## Next Up (Short List)
8888

Lines changed: 366 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,366 @@
1+
# Configuration Variables and User Inputs
2+
3+
## Overview
4+
5+
This document defines the comprehensive set of configuration variables and user inputs
6+
required for successful deployment of Torrust Tracker environments, based on the actual
7+
Proof of Concept (PoC) implementation. It categorizes variables by their purpose,
8+
provides real examples from the PoC codebase, and establishes the two-tier configuration
9+
architecture used in production.
10+
11+
## Configuration Architecture
12+
13+
### Two-Tier System
14+
15+
The PoC implements a **two-tier configuration architecture**:
16+
17+
1. **Environment-Specific Configuration** (`infrastructure/config/environments/`):
18+
19+
- `staging-hetzner-staging.env` - Staging environment for Hetzner Cloud
20+
- `development-libvirt.env` - Development environment for local libvirt
21+
- `e2e-libvirt.env` - End-to-end testing environment
22+
23+
2. **Provider-Specific Configuration** (`infrastructure/config/providers/`):
24+
- `hetzner-staging.env` - Hetzner Cloud provider defaults and authentication
25+
- `libvirt.env` - libvirt provider defaults and local virtualization settings
26+
27+
### Key Architectural Notes
28+
29+
> **Important**: All environments have a **common parts** and another part that **depends on the provider**.
30+
> We have not decided the format yet (multiformat would be ideal). The configuration system must handle:
31+
>
32+
> - Arrays (e.g., lists of UDP/HTTP tracker ports)
33+
> - Common vs provider-specific parts
34+
> - Multiple configuration strategy options with schema validation
35+
36+
## Configuration Variable Classification Tree
37+
38+
```text
39+
Configuration Variables
40+
├── 1. General Configuration
41+
│ ├── Domain Configuration (TRACKER_DOMAIN, GRAFANA_DOMAIN, CERTBOT_EMAIL)
42+
│ ├── Environment Identification (ENVIRONMENT_TYPE, PROVIDER)
43+
│ └── Floating IP Configuration (FLOATING_IPV4, FLOATING_IPV6)
44+
├── 2. Provisioning Configuration
45+
│ ├── VM Configuration (VM_NAME, VM_MEMORY, VM_VCPUS, VM_DISK_SIZE)
46+
│ ├── Provider Settings (HETZNER_*, PROVIDER_LIBVIRT_*)
47+
│ ├── Authentication (SSH_PUBLIC_KEY, HETZNER_API_TOKEN)
48+
│ └── Firewall Configuration (implicit via tracker ports)
49+
└── 3. Deployment Configuration
50+
├── Docker Compose Services
51+
│ ├── MySQL (MYSQL_ROOT_PASSWORD, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_USER)
52+
│ ├── Tracker (TRACKER_ADMIN_TOKEN + port configuration)
53+
│ ├── Grafana (GF_SECURITY_ADMIN_USER, GF_SECURITY_ADMIN_PASSWORD)
54+
│ └── System (USER_ID, DOLLAR)
55+
├── Backup Configuration (ENABLE_DB_BACKUPS, BACKUP_RETENTION_DAYS)
56+
├── SSL Certificate Management (ENABLE_SSL, SSL certificate paths)
57+
└── Deployment Automation (infrastructure scripts configuration)
58+
```
59+
60+
## Tracker Port Configuration
61+
62+
### UDP Tracker Ports
63+
64+
The PoC configures **two UDP tracker endpoints**:
65+
66+
```toml
67+
# From tracker.toml.tpl configuration
68+
[[udp_trackers]]
69+
bind_address = "0.0.0.0:6868" # Internal testing and alternative endpoint
70+
71+
[[udp_trackers]]
72+
bind_address = "0.0.0.0:6969" # Official public tracker endpoint
73+
```
74+
75+
**Port 6868**: Internal testing UDP tracker
76+
77+
- **Purpose**: Development testing and alternative endpoint when 6969 is under heavy load
78+
- **Security**: Public access allowed but not advertised on public tracker lists
79+
- **Usage**: Backup endpoint for tracker protocol testing
80+
81+
**Port 6969**: Official public UDP tracker
82+
83+
- **Purpose**: Primary BitTorrent UDP tracker endpoint for production traffic
84+
- **Security**: Public access required for torrent client connections
85+
- **Usage**: Heavy production load, primary endpoint for announce/scrape operations
86+
87+
### HTTP Tracker Ports
88+
89+
The PoC configures **one HTTP tracker endpoint**:
90+
91+
```toml
92+
# From tracker.toml.tpl configuration
93+
[[http_trackers]]
94+
bind_address = "0.0.0.0:7070" # Internal HTTP tracker via Nginx proxy
95+
```
96+
97+
**Port 7070**: HTTP tracker (internal, accessed via Nginx proxy)
98+
99+
- **Purpose**: HTTP tracker protocol support accessed through HTTPS reverse proxy
100+
- **Security**: Internal port, public access via port 443 (HTTPS) through Nginx
101+
- **Usage**: HTTP announce/scrape operations with SSL termination
102+
103+
### API and Monitoring Ports
104+
105+
```toml
106+
# From tracker.toml.tpl configuration
107+
[http_api]
108+
bind_address = "0.0.0.0:1212" # API and metrics endpoint
109+
110+
[health_check_api]
111+
bind_address = "127.0.0.1:1313" # Health check (localhost only)
112+
```
113+
114+
**Port 1212**: Tracker API and Metrics
115+
116+
- **Purpose**: REST API for tracker management and Prometheus metrics collection
117+
- **Security**: Internal port, public access via port 443 (HTTPS) through Nginx proxy
118+
- **Usage**: Statistics, health checks, Prometheus scraping
119+
120+
**Port 1313**: Health Check API
121+
122+
- **Purpose**: Internal health check endpoint for system monitoring
123+
- **Security**: Localhost only (127.0.0.1), not accessible externally
124+
- **Usage**: Container health checks and internal monitoring
125+
126+
## Real Configuration Examples from PoC
127+
128+
### 1. General Configuration Variables
129+
130+
#### Environment Identification
131+
132+
```bash
133+
# staging-hetzner-staging.env
134+
ENVIRONMENT_TYPE=staging
135+
PROVIDER=hetzner-staging
136+
137+
# development-libvirt.env
138+
ENVIRONMENT_TYPE=development
139+
PROVIDER=libvirt
140+
141+
# e2e-libvirt.env
142+
ENVIRONMENT_TYPE=e2e
143+
PROVIDER=libvirt
144+
```
145+
146+
**ENVIRONMENT_TYPE**: Identifies the deployment environment (staging, production, development, e2e)
147+
**PROVIDER**: Specifies the infrastructure provider (hetzner-staging, libvirt)
148+
149+
#### Domain Configuration
150+
151+
```bash
152+
# staging-hetzner-staging.env
153+
TRACKER_DOMAIN=tracker.staging-torrust-demo.com
154+
GRAFANA_DOMAIN=grafana.staging-torrust-demo.com
155+
156+
157+
# development-libvirt.env
158+
TRACKER_DOMAIN=tracker.test.local
159+
GRAFANA_DOMAIN=grafana.test.local
160+
161+
# e2e-libvirt.env
162+
TRACKER_DOMAIN=tracker.e2e.test.local
163+
GRAFANA_DOMAIN=grafana.e2e.test.local
164+
```
165+
166+
**TRACKER_DOMAIN**: Primary domain for tracker service and API endpoints
167+
**GRAFANA_DOMAIN**: Dedicated subdomain for Grafana monitoring dashboard
168+
**CERTBOT_EMAIL**: Email for Let's Encrypt certificate registration (production only)
169+
170+
#### Floating IP Configuration
171+
172+
```bash
173+
# staging-hetzner-staging.env
174+
FLOATING_IPV4=78.47.140.132
175+
FLOATING_IPV6=2a01:4f8:1c17:a01d::1
176+
```
177+
178+
**FLOATING_IPV4**: Hetzner floating IPv4 address for stable DNS mapping
179+
**FLOATING_IPV6**: Hetzner floating IPv6 address for dual-stack networking
180+
181+
### 2. Provisioning Configuration Variables
182+
183+
#### VM Configuration
184+
185+
```bash
186+
# staging-hetzner-staging.env
187+
VM_NAME=staging-tracker
188+
VM_MEMORY=4096
189+
VM_VCPUS=4
190+
VM_DISK_SIZE=50
191+
192+
# development-libvirt.env
193+
VM_NAME=development-tracker
194+
VM_MEMORY=2048
195+
VM_VCPUS=2
196+
VM_DISK_SIZE=30
197+
198+
# e2e-libvirt.env
199+
VM_NAME=e2e-tracker
200+
VM_MEMORY=2048
201+
VM_VCPUS=2
202+
VM_DISK_SIZE=20
203+
```
204+
205+
**VM_NAME**: Identifier for the virtual machine instance
206+
**VM_MEMORY**: RAM allocation in MB (staging: 4GB, dev/testing: 2GB)
207+
**VM_VCPUS**: Virtual CPU cores (staging: 4, dev/testing: 2)
208+
**VM_DISK_SIZE**: Disk space in GB (staging: 50GB, development: 30GB, e2e: 20GB)
209+
210+
#### Provider-Specific Settings
211+
212+
```bash
213+
# hetzner-staging.env
214+
HETZNER_SERVER_TYPE=cpx31
215+
HETZNER_LOCATION=fsn1
216+
HETZNER_IMAGE=ubuntu-24.04
217+
VM_MEMORY_DEFAULT=8192
218+
219+
# libvirt.env
220+
PROVIDER_LIBVIRT_URI=qemu:///system
221+
PROVIDER_LIBVIRT_POOL=user-default
222+
PROVIDER_LIBVIRT_BASE_IMAGE_URL=https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img
223+
VM_MEMORY_DEFAULT=2048
224+
```
225+
226+
**HETZNER_SERVER_TYPE**: Hetzner Cloud server type (cpx31 = 4 vCPU, 8GB RAM, 160GB SSD)
227+
**HETZNER_LOCATION**: Hetzner datacenter location (fsn1 = Falkenstein, Germany)
228+
**PROVIDER_LIBVIRT_URI**: libvirt connection URI for local virtualization
229+
**PROVIDER_LIBVIRT_POOL**: Storage pool for VM disks and images
230+
231+
#### Authentication Configuration
232+
233+
```bash
234+
# hetzner-staging.env
235+
HETZNER_API_TOKEN=your-hetzner-cloud-api-token-here
236+
HETZNER_DNS_API_TOKEN=your-hetzner-dns-api-token-here
237+
238+
# All environments
239+
SSH_PUBLIC_KEY=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC...
240+
```
241+
242+
**HETZNER_API_TOKEN**: API token for Hetzner Cloud infrastructure management
243+
**HETZNER_DNS_API_TOKEN**: API token for Hetzner DNS service management
244+
**SSH_PUBLIC_KEY**: Public SSH key for VM access authentication
245+
246+
### 3. Deployment Configuration Variables
247+
248+
#### Docker Compose Service Configuration
249+
250+
```bash
251+
# All environments
252+
USER_ID=1000
253+
DOLLAR=$
254+
255+
# MySQL Database Configuration
256+
MYSQL_ROOT_PASSWORD=secure_root_password_here
257+
MYSQL_PASSWORD=secure_user_password_here
258+
MYSQL_DATABASE=torrust_tracker
259+
MYSQL_USER=torrust
260+
261+
# Tracker Service Configuration
262+
TRACKER_ADMIN_TOKEN=secure_admin_token_here
263+
264+
# Grafana Configuration
265+
GF_SECURITY_ADMIN_USER=admin
266+
GF_SECURITY_ADMIN_PASSWORD=secure_grafana_password_here
267+
```
268+
269+
**USER_ID**: Unix user ID for container processes (1000 = torrust user)
270+
**DOLLAR**: Literal dollar sign for template processing (preserves nginx variables)
271+
**MYSQL_ROOT_PASSWORD**: MySQL root user password for database administration
272+
**MYSQL_PASSWORD**: MySQL application user password for tracker database access
273+
**TRACKER_ADMIN_TOKEN**: Authentication token for tracker REST API access
274+
**GF_SECURITY_ADMIN_PASSWORD**: Grafana admin user password for dashboard access
275+
276+
#### Backup Configuration
277+
278+
```bash
279+
# staging-hetzner-staging.env
280+
ENABLE_DB_BACKUPS=true
281+
BACKUP_RETENTION_DAYS=30
282+
283+
# development-libvirt.env
284+
ENABLE_DB_BACKUPS=true
285+
BACKUP_RETENTION_DAYS=3
286+
287+
# e2e-libvirt.env
288+
ENABLE_DB_BACKUPS=false
289+
```
290+
291+
**ENABLE_DB_BACKUPS**: Enable automated MySQL database backup system
292+
**BACKUP_RETENTION_DAYS**: Number of days to retain backup files (staging: 30, dev: 3, e2e: disabled)
293+
294+
#### SSL Certificate Management
295+
296+
```bash
297+
# staging-hetzner-staging.env
298+
ENABLE_SSL=true
299+
SSL_GENERATION_METHOD=letsencrypt
300+
301+
# development-libvirt.env
302+
ENABLE_SSL=true
303+
SSL_GENERATION_METHOD=self-signed
304+
305+
# e2e-libvirt.env
306+
ENABLE_SSL=false
307+
```
308+
309+
**ENABLE_SSL**: Enable HTTPS with SSL certificate generation
310+
**SSL_GENERATION_METHOD**: Certificate source (letsencrypt for production, self-signed for development)
311+
312+
## Multi-Format Configuration Strategy
313+
314+
### Current Architecture Benefits
315+
316+
The two-tier system provides:
317+
318+
- **Scalability**: Easy addition of new providers without environment duplication
319+
- **Maintainability**: Common provider settings shared across environments
320+
- **Security**: Provider authentication separated from environment configuration
321+
- **Flexibility**: Environment-specific overrides of provider defaults
322+
323+
### Future Multi-Format Considerations
324+
325+
> **Note**: The configuration format decision is pending. A multiformat approach would ideally support:
326+
327+
1. **Array Configuration**: Lists of tracker ports, SSL domains, backup targets
328+
2. **Schema Validation**: Multiple validation strategies for different complexity levels
329+
3. **Common vs Provider-Specific Parts**: Clear separation with inheritance patterns
330+
4. **Configuration Templates**: Reusable patterns for common deployment scenarios
331+
332+
### Example Array Configuration
333+
334+
```yaml
335+
# Future multiformat example
336+
tracker_ports:
337+
udp:
338+
- port: 6868
339+
purpose: "internal testing"
340+
public: false
341+
- port: 6969
342+
purpose: "production traffic"
343+
public: true
344+
http:
345+
- port: 7070
346+
purpose: "http tracker via nginx"
347+
proxy: true
348+
```
349+
350+
This multiformat strategy would enable more sophisticated configuration validation and better
351+
support for complex deployment scenarios while maintaining the proven two-tier architecture.
352+
353+
## Implementation Design
354+
355+
The implementation of configuration management is documented in the design specifications:
356+
357+
- **[Configuration Management Implementation]**
358+
(../phase3-design/configuration-management-implementation.md) -
359+
Comprehensive technical design including architecture, file formats, schema validation,
360+
and processing pipeline
361+
- **[Environment Naming and Configuration]**
362+
(../phase3-design/environment-naming-and-configuration.md) -
363+
Environment naming conventions and configuration inheritance design
364+
365+
These design documents provide detailed technical specifications for implementing the
366+
configuration requirements outlined in this document.

0 commit comments

Comments
 (0)