|
| 1 | +# Change Grafana Default Port from 3100 to 3000 |
| 2 | + |
| 3 | +**Issue**: #275 |
| 4 | +**Parent Epic**: None (standalone task) |
| 5 | +**Related**: [ADR: Grafana Integration Pattern](../decisions/grafana-integration-pattern.md) |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +Change the Grafana host port from 3100 to 3000 in the Docker Compose template and all related documentation. |
| 10 | + |
| 11 | +The Grafana service was originally copied from the [Torrust Demo project](https://github.com/torrust/torrust-demo), which uses port 3100 to avoid conflicts with other services using port 3000 (like Node.js dev servers). In this deployer configuration, we don't have that conflict, so we should use the default Grafana port (3000) for simplicity and to align with common expectations. |
| 12 | + |
| 13 | +## Goals |
| 14 | + |
| 15 | +- [ ] Use Grafana's default port (3000) instead of custom port 3100 |
| 16 | +- [ ] Update all documentation references from port 3100 to 3000 |
| 17 | +- [ ] Update Rust source code port references |
| 18 | +- [ ] Create an ADR documenting this decision |
| 19 | + |
| 20 | +## 🏗️ Architecture Requirements |
| 21 | + |
| 22 | +**DDD Layer**: Infrastructure (template) + Application + Presentation |
| 23 | +**Module Path**: Multiple locations |
| 24 | +**Pattern**: Configuration change |
| 25 | + |
| 26 | +### Module Structure Requirements |
| 27 | + |
| 28 | +- [ ] Update docker-compose template |
| 29 | +- [ ] Update Rust source code port constants/references |
| 30 | +- [ ] Update documentation |
| 31 | + |
| 32 | +### Architectural Constraints |
| 33 | + |
| 34 | +- [ ] No functional changes beyond port number update |
| 35 | +- [ ] All references must be consistent across codebase |
| 36 | + |
| 37 | +### Anti-Patterns to Avoid |
| 38 | + |
| 39 | +- ❌ Leaving inconsistent port references in documentation |
| 40 | +- ❌ Missing any hardcoded port references |
| 41 | + |
| 42 | +## Specifications |
| 43 | + |
| 44 | +### Files to Update |
| 45 | + |
| 46 | +#### Template (Primary Change) |
| 47 | + |
| 48 | +- `templates/docker-compose/docker-compose.yml.tera` - Change `"3100:3000"` to `"3000:3000"` |
| 49 | + |
| 50 | +#### Rust Source Code |
| 51 | + |
| 52 | +- `src/application/command_handlers/show/info/grafana.rs` |
| 53 | +- `src/infrastructure/remote_actions/validators/grafana.rs` |
| 54 | +- `src/presentation/views/commands/show/environment_info/grafana.rs` |
| 55 | +- `src/testing/e2e/tasks/run_run_validation.rs` |
| 56 | + |
| 57 | +#### Active Documentation (Update these) |
| 58 | + |
| 59 | +- `docs/decisions/grafana-integration-pattern.md` |
| 60 | +- `docs/decisions/docker-ufw-firewall-security-strategy.md` |
| 61 | +- `docs/analysis/security/docker-network-segmentation-analysis.md` |
| 62 | +- `docs/e2e-testing/manual/grafana-verification.md` |
| 63 | +- `docs/user-guide/README.md` |
| 64 | +- `docs/user-guide/security.md` |
| 65 | +- `docs/user-guide/quick-start/docker.md` |
| 66 | +- `docs/user-guide/services/grafana.md` |
| 67 | +- `docs/user-guide/services/https.md` |
| 68 | + |
| 69 | +#### Archived/Experimental Documentation (Do NOT update) |
| 70 | + |
| 71 | +- `docs/research/caddy-tls-proxy-evaluation/production-deployment.md` - Historical research |
| 72 | +- `docs/research/caddy-tls-proxy-evaluation/experiment-files/docker-compose.yml` - Historical experiment |
| 73 | +- `experiments/caddy-full-stack/docker-compose.yml` - Experimental setup |
| 74 | + |
| 75 | +## Implementation Plan |
| 76 | + |
| 77 | +### Phase 1: Template and Source Code (15 min) |
| 78 | + |
| 79 | +- [ ] Task 1.1: Update `templates/docker-compose/docker-compose.yml.tera` port from 3100 to 3000 |
| 80 | +- [ ] Task 1.2: Update all Rust source files with port references |
| 81 | +- [ ] Task 1.3: Run pre-commit checks to verify no compilation/test failures |
| 82 | + |
| 83 | +### Phase 2: Documentation Updates (15 min) |
| 84 | + |
| 85 | +- [ ] Task 2.1: Update all active documentation files listed above |
| 86 | +- [ ] Task 2.2: Run linters to verify documentation formatting |
| 87 | + |
| 88 | +### Phase 3: ADR and Finalization (10 min) |
| 89 | + |
| 90 | +- [ ] Task 3.1: Create ADR documenting the port change decision |
| 91 | +- [ ] Task 3.2: Run full pre-commit checks |
| 92 | +- [ ] Task 3.3: Commit all changes |
| 93 | +- [ ] Task 3.4: Push to remote main branch |
| 94 | + |
| 95 | +## Acceptance Criteria |
| 96 | + |
| 97 | +> **Note for Contributors**: These criteria define what the PR reviewer will check. Use this as your pre-review checklist before submitting the PR to minimize back-and-forth iterations. |
| 98 | +
|
| 99 | +**Quality Checks**: |
| 100 | + |
| 101 | +- [ ] Pre-commit checks pass: `./scripts/pre-commit.sh` |
| 102 | + |
| 103 | +**Task-Specific Criteria**: |
| 104 | + |
| 105 | +- [ ] Docker Compose template uses port 3000:3000 for Grafana |
| 106 | +- [ ] All Rust source code references updated to port 3000 |
| 107 | +- [ ] All active documentation references updated to port 3000 |
| 108 | +- [ ] No grep results for "3100" related to Grafana in active code/docs |
| 109 | +- [ ] ADR created explaining the rationale for the change |
| 110 | +- [ ] E2E tests pass with the new port |
| 111 | + |
| 112 | +## Related Documentation |
| 113 | + |
| 114 | +- [ADR: Grafana Integration Pattern](../decisions/grafana-integration-pattern.md) |
| 115 | +- [Torrust Demo](https://github.com/torrust/torrust-demo) - Original source of Grafana configuration |
| 116 | +- [Grafana Docker Documentation](https://grafana.com/docs/grafana/latest/setup-grafana/installation/docker/) |
| 117 | + |
| 118 | +## Notes |
| 119 | + |
| 120 | +- The change from 3100 to 3000 is purely cosmetic/simplification - both ports work identically |
| 121 | +- Port 3000 is Grafana's default internal port, so using 3000:3000 is more intuitive |
| 122 | +- Archived/experimental documentation is intentionally NOT updated to preserve historical accuracy |
0 commit comments