@@ -53,7 +53,58 @@ If you need to manually deploy on the server:
5353 docker compose --env-file /var/lib/torrust/compose/.env up -d
5454 ```
5555
56- ## 3. Verification and Smoke Testing
56+ ## 3. SSL Certificate Management
57+
58+ ### Certificate Generation Strategy
59+
60+ The deployment process generates SSL certificates on each deployment rather than
61+ reusing certificates. This approach provides several advantages:
62+
63+ #### Why Generate Certificates Per Deployment?
64+
65+ 1 . ** Production Flexibility** : Different environments use different domains:
66+
67+ - Local testing: ` test.local `
68+ - Staging: ` staging.example.com `
69+ - Production: ` tracker.torrust-demo.com `
70+
71+ 2 . ** Certificate Validity** : Self-signed certificates are domain-specific and must
72+ exactly match the domain being used in each deployment environment.
73+
74+ 3 . ** Security Best Practices** : Fresh certificates for each deployment ensure no
75+ stale or leaked credentials are reused.
76+
77+ 4 . ** Workflow Consistency** : The same deployment process works across all
78+ environments without manual certificate management or copying certificates
79+ between systems.
80+
81+ 5 . ** Zero Configuration** : No need to maintain a certificate store or handle
82+ certificate distribution between development and production environments.
83+
84+ #### Certificate Types by Environment
85+
86+ - ** Local/Testing** : Self-signed certificates with 10-year validity (for convenience in testing)
87+ - ** Production** : Let's Encrypt certificates (automatically renewed)
88+
89+ #### Implementation Details
90+
91+ The certificate generation happens during the application deployment phase
92+ (` make app-deploy ` ) and includes:
93+
94+ 1 . ** Self-signed certificates** : Generated using OpenSSL with domain-specific
95+ Subject Alternative Names (SAN)
96+ 2 . ** Certificate placement** : Stored in ` /var/lib/torrust/proxy/certs/ ` and
97+ ` /var/lib/torrust/proxy/private/ ` on the target server
98+ 3 . ** Container mounting** : Certificates are mounted into nginx container at runtime
99+ 4 . ** Automatic configuration** : nginx configuration is automatically templated
100+ with the correct certificate paths
101+
102+ While it would be possible to reuse certificates for local testing (since we
103+ always use ` test.local ` ), this approach ensures that the deployment workflow is
104+ identical between local testing and production, reducing the chance of
105+ environment-specific issues.
106+
107+ ## 4. Verification and Smoke Testing
57108
58109After deployment, verify that all services are running correctly.
59110
0 commit comments