Skip to content

Commit 289f0f2

Browse files
committed
docs: [#234] complete Experiment 4 - WebSocket limitation discovered
Experiment 4 tested Pingoo with Grafana to verify WebSocket support for Grafana Live real-time streaming feature. Results: - HTTP requests work correctly (dashboard loads, login works) - WebSocket connections FAIL (Grafana Live does not work) Root cause: Pingoo's http_proxy_service.rs explicitly removes the 'Upgrade' header as a hop-by-hop header, which breaks the WebSocket upgrade handshake. Filed issue pingooio/pingoo#23 to confirm this limitation and discuss potential solutions. Final architecture decision: Use hybrid approach - Pingoo for Tracker services (API + HTTP Tracker), nginx for Grafana (WebSocket support).
1 parent f27e476 commit 289f0f2

File tree

3 files changed

+334
-76
lines changed

3 files changed

+334
-76
lines changed

docs/research/pingoo-tls-proxy-evaluation/README.md

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,42 +39,54 @@ See [phase-1-environment-preparation.md](phase-1-environment-preparation.md) for
3939

4040
### Phase 2: Experiments
4141

42-
| Experiment | Document | Status |
43-
| ---------------------- | ------------------------------------------------------------ | ----------- |
44-
| 1. Minimal Hello World | [experiment-1-hello-world.md](experiment-1-hello-world.md) | ✅ Complete |
45-
| 2. Tracker API HTTPS | [experiment-2-tracker-api.md](experiment-2-tracker-api.md) | ✅ Complete |
46-
| 3. HTTP Tracker HTTPS | [experiment-3-http-tracker.md](experiment-3-http-tracker.md) | ✅ Complete |
47-
| 4. Grafana WebSocket | [experiment-4-grafana.md](experiment-4-grafana.md) | Not started |
42+
| Experiment | Document | Status |
43+
| ---------------------- | ------------------------------------------------------------ | -------------------- |
44+
| 1. Minimal Hello World | [experiment-1-hello-world.md](experiment-1-hello-world.md) | ✅ Complete |
45+
| 2. Tracker API HTTPS | [experiment-2-tracker-api.md](experiment-2-tracker-api.md) | ✅ Complete |
46+
| 3. HTTP Tracker HTTPS | [experiment-3-http-tracker.md](experiment-3-http-tracker.md) | ✅ Complete |
47+
| 4. Grafana WebSocket | [experiment-4-grafana.md](experiment-4-grafana.md) | ⚠️ Partial (WS fail) |
4848

4949
## Key Questions to Answer
5050

51-
1. Does Pingoo automatically generate Let's Encrypt certificates?
52-
2. Does certificate renewal work without manual intervention?
53-
3. Does Pingoo support WebSocket connections (needed for Grafana Live)?
54-
4. How does configuration complexity compare to nginx+certbot?
55-
5. Are there any issues with TLS 1.3-only support?
51+
1. Does Pingoo automatically generate Let's Encrypt certificates? **✅ YES**
52+
2. Does certificate renewal work without manual intervention? **⏳ Cannot test (90-day validity)**
53+
3. Does Pingoo support WebSocket connections (needed for Grafana Live)? **❌ NO**
54+
4. How does configuration complexity compare to nginx+certbot? **Much simpler (~10 lines vs ~50+)**
55+
5. Are there any issues with TLS 1.3-only support? **✅ No issues detected**
5656

57-
## Preliminary Findings (from Experiment 1)
57+
## Findings Summary
5858

59-
-**Automatic certificate generation works** - Pingoo obtained Let's Encrypt cert without manual steps
60-
-**TLS 1.3 with post-quantum cryptography** - Uses X25519MLKEM768 key exchange
61-
-**Minimal configuration** - Only 10 lines of YAML needed
62-
-**No email required** - Unlike certbot, no email setup needed
63-
-**Certificate renewal** - Cannot test yet (cert valid for 90 days)
64-
-**WebSocket support** - Will test in Experiment 4
59+
### ✅ Successful Tests
6560

66-
## Preliminary Decision
61+
- **Automatic certificate generation** - Pingoo obtained Let's Encrypt certs without manual steps
62+
- **TLS 1.3 with post-quantum cryptography** - Uses X25519MLKEM768 key exchange
63+
- **Minimal configuration** - Only ~10 lines of YAML needed
64+
- **No email required** - Unlike certbot, no email setup needed
65+
- **Tracker API proxying** - Health checks and API endpoints work perfectly
66+
- **HTTP Tracker proxying** - BitTorrent announce/scrape work via HTTPS
6767

68-
**Switch to Pingoo** - See [conclusion.md](conclusion.md) for full rationale.
68+
### ❌ Failed Test
6969

70-
Key factors:
70+
- **WebSocket support** - Pingoo strips the `Upgrade` header, breaking WebSocket connections
71+
- Root cause: `Upgrade` header treated as hop-by-hop header in `http_proxy_service.rs`
72+
- Impact: Grafana Live (real-time streaming) does not work
73+
- Workaround: Use nginx for services requiring WebSocket
7174

72-
- Dramatically simpler configuration (~10 lines vs ~50+ for nginx+certbot)
73-
- Modern security defaults (TLS 1.3, post-quantum crypto)
74-
- Zero-touch certificate management
75+
### ⏳ Pending Verification
7576

76-
**Pending**: WebSocket verification for Grafana (Experiment 4). If WebSocket doesn't
77-
work, a hybrid approach (Pingoo for Tracker, nginx for Grafana) is planned.
77+
- **Certificate renewal** - Cannot test yet (cert valid for 90 days)
78+
79+
## Final Decision
80+
81+
**Use hybrid architecture:**
82+
83+
| Service | TLS Proxy | Reason |
84+
| ----------------- | --------- | ------------------------------------ |
85+
| Tracker API | Pingoo | ✅ Simple HTTP proxying works |
86+
| HTTP Tracker | Pingoo | ✅ BitTorrent protocol works via TLS |
87+
| Grafana Dashboard | nginx | ❌ Requires WebSocket for Live |
88+
89+
See [conclusion.md](conclusion.md) for full rationale and implementation plan.
7890

7991
## Timeline
8092

docs/research/pingoo-tls-proxy-evaluation/conclusion.md

Lines changed: 81 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,36 @@
11
# Pingoo TLS Proxy Evaluation - Conclusion
22

3-
**Status**: Decision Pending WebSocket Verification
3+
**Status**: ✅ EVALUATION COMPLETE
44
**Last Updated**: 2026-01-12
55

6-
## Preliminary Decision
6+
## Final Decision
77

8-
**Switch to Pingoo** as the primary TLS proxy for Torrust Tracker deployments.
8+
**Use hybrid architecture:** Pingoo for Tracker services, nginx for Grafana.
99

10-
Pingoo offers significant advantages in simplicity and modern security features that
11-
make it the preferred choice over nginx+certbot for automatic HTTPS/TLS termination.
10+
Pingoo provides excellent TLS termination for HTTP-based services but **does not support WebSocket connections**, which are required for Grafana Live. The hybrid approach maximizes Pingoo's simplicity benefits while maintaining full Grafana functionality.
11+
12+
## Architecture Diagram
13+
14+
```text
15+
┌─────────────────────────────────────────────────────────────────┐
16+
│ Public Internet │
17+
└─────────────────────────────────────────────────────────────────┘
18+
│ │
19+
▼ ▼
20+
┌──────────────────┐ ┌───────────────────┐
21+
│ Pingoo │ │ nginx+certbot │
22+
│ (port 443) │ │ (port 3443) │
23+
│ │ │ │
24+
│ api.example.com │ │grafana.example.com│
25+
│http1.example.com │ │ │
26+
└────────┬─────────┘ └────────┬──────────┘
27+
│ │
28+
▼ ▼
29+
┌──────────────────┐ ┌───────────────────┐
30+
│ Tracker API │ │ Grafana │
31+
│ HTTP Tracker │ │ (WebSocket) │
32+
└──────────────────┘ └───────────────────┘
33+
```
1234

1335
## Decision Rationale
1436

@@ -52,46 +74,34 @@ make it the preferred choice over nginx+certbot for automatic HTTPS/TLS terminat
5274

5375
## Pending Verification
5476

55-
### WebSocket Support (Experiment 4)
77+
### Certificate Renewal
5678

57-
Grafana Live uses WebSocket connections for real-time dashboard updates. We need to
58-
verify that Pingoo correctly proxies WebSocket connections.
79+
Certificate renewal cannot be tested during this evaluation (certificates are valid
80+
for 90 days). Pingoo claims automatic renewal - this should work based on the ACME
81+
implementation, but should be verified after deployment.
5982

60-
**Possible outcomes:**
83+
## WebSocket Limitation - Root Cause
6184

62-
1. **WebSocket works** → Use Pingoo for all services (Tracker API, HTTP Tracker, Grafana)
63-
2. **WebSocket doesn't work** → Hybrid approach (see below)
85+
Pingoo's HTTP proxy explicitly removes the `Upgrade` header, which is required for
86+
WebSocket protocol upgrades. From the source code:
6487

65-
### Fallback Strategy
66-
67-
If Pingoo doesn't support WebSocket for Grafana:
68-
69-
```text
70-
┌─────────────────────────────────────────────────────────────────┐
71-
│ Public Internet │
72-
└─────────────────────────────────────────────────────────────────┘
73-
│ │
74-
▼ ▼
75-
┌──────────────────┐ ┌──────────────────┐
76-
│ Pingoo │ │ nginx+certbot │
77-
│ (port 443) │ │ (port 3443) │
78-
│ │ │ │
79-
│ api.example.com │ │grafana.example.com│
80-
│http1.example.com │ │ │
81-
└────────┬─────────┘ └────────┬─────────┘
82-
│ │
83-
▼ ▼
84-
┌──────────────────┐ ┌──────────────────┐
85-
│ Tracker API │ │ Grafana │
86-
│ HTTP Tracker │ │ (WebSocket) │
87-
└──────────────────┘ └──────────────────┘
88+
```rust
89+
// https://github.com/pingooio/pingoo/blob/main/pingoo/services/http_proxy_service.rs
90+
const HOP_HEADERS: &[&str] = &[
91+
"Connection",
92+
// ... other headers ...
93+
"Upgrade", // This breaks WebSocket!
94+
];
8895
```
8996

90-
**Benefits of hybrid approach:**
97+
This means any service requiring WebSocket connections cannot use Pingoo's `http_proxy`.
98+
This is a fundamental limitation, not a configuration issue.
9199

92-
- Users who don't need Grafana get the simpler Pingoo-only setup
93-
- Grafana users get WebSocket support via nginx
94-
- Can migrate Grafana to Pingoo when WebSocket support is added
100+
### Potential Future Solutions
101+
102+
1. **Pingoo WebSocket support** - The Pingoo team may add WebSocket support
103+
2. **TCP+TLS mode** - Could use raw TCP proxying (loses HTTP routing)
104+
3. **Feature request** - Could file an issue requesting WebSocket support
95105

96106
## Files to Backup (for Disaster Recovery)
97107

@@ -110,12 +120,12 @@ apply to new registrations).
110120

111121
## Experiment Results Summary
112122

113-
| Experiment | Status | Result |
114-
| ---------------------- | ----------- | ---------------------------------------- |
115-
| 1. Hello World | ✅ Complete | SUCCESS - Certificate auto-generated |
116-
| 2. Tracker API | ⏳ Pending | - |
117-
| 3. HTTP Tracker | ⏳ Pending | - |
118-
| 4. Grafana (WebSocket) | ⏳ Pending | CRITICAL - Determines final architecture |
123+
| Experiment | Status | Result |
124+
| ---------------------- | ----------- | -------------------------------------------- |
125+
| 1. Hello World | ✅ Complete | SUCCESS - Certificate auto-generated |
126+
| 2. Tracker API | ✅ Complete | SUCCESS - API endpoints work via HTTPS |
127+
| 3. HTTP Tracker | ✅ Complete | SUCCESS - BitTorrent announce/scrape working |
128+
| 4. Grafana (WebSocket) | ⚠️ Partial | HTTP works, WebSocket FAILS |
119129

120130
## Key Findings from Experiments
121131

@@ -128,14 +138,35 @@ apply to new registrations).
128138
- ✅ Certificate stored with domain-named files for easy identification
129139
- ✅ ACME account persisted for future renewals
130140

141+
### Experiment 2: Tracker API
142+
143+
- ✅ JSON API responses proxied correctly
144+
- ✅ Health check endpoints work
145+
- ✅ No issues with TLS 1.3 for API clients
146+
147+
### Experiment 3: HTTP Tracker
148+
149+
- ✅ BitTorrent `announce` endpoint works via HTTPS
150+
- ✅ BitTorrent `scrape` endpoint works via HTTPS
151+
- ✅ Binary bencoded responses handled correctly
152+
153+
### Experiment 4: Grafana (WebSocket)
154+
155+
- ✅ HTTP dashboard access works
156+
- ✅ Login and navigation work
157+
-**WebSocket fails** - `Upgrade` header stripped by Pingoo
158+
- ❌ Grafana Live (real-time streaming) does not work
159+
131160
## Next Steps
132161

133-
1. Complete Experiment 2 (Tracker API) - Verify JSON API proxying
134-
2. Complete Experiment 3 (HTTP Tracker) - Verify announce/scrape endpoints
135-
3. Complete Experiment 4 (Grafana) - **Critical** WebSocket verification
136-
4. Finalize architecture decision based on Experiment 4 results
137-
5. Update deployment templates to use Pingoo
138-
6. Document migration path from nginx+certbot (if applicable)
162+
1.~~Complete Experiment 1 (Hello World)~~ - Certificate auto-generation verified
163+
2.~~Complete Experiment 2 (Tracker API)~~ - JSON API proxying verified
164+
3.~~Complete Experiment 3 (HTTP Tracker)~~ - BitTorrent protocol verified
165+
4.~~Complete Experiment 4 (Grafana)~~ - WebSocket limitation discovered
166+
5. 🔲 File issue with Pingoo project requesting WebSocket support
167+
6. 🔲 Update deployment templates with hybrid architecture
168+
7. 🔲 Document migration path from pure nginx+certbot
169+
8. 🔲 Implement Pingoo templates in deployer codebase
139170

140171
## References
141172

0 commit comments

Comments
 (0)