Add HTTP resync endpoint for manual rotation triggering
Build and Push Docker Images / build-and-push (push) Successful in 1m30s
Build and Push Docker Images / build-and-push (push) Successful in 1m30s
Expose port 8080 with `/resync` endpoint to trigger on-demand WireGuard rotations. Add RESYNC_PORT and RESYNC_BIND environment variables. Implement thread-safe rotation locking to prevent concurrent runs. Update README with endpoint usage examples.
This commit is contained in:
1 parent
b20ebbfca6
commit
2dbaa0ebb0
3 files changed
+121
-7
No files matched your search
@@ -54,6 +54,22 @@ docker run --rm --entrypoint /opt/venv/bin/python \
|
||||
| `RATE_LIMIT_WAIT_SECONDS` | `3600` | Cooldown bij PIA rate-limit |
|
||||
| `RATE_LIMIT_PATH` | `/config/cache/pia-rate-limit.json` | Persistente rate-limit cooldown |
|
||||
| `TZ` | `Europe/Brussels` | Tijdzone |
|
||||
| `RESYNC_PORT` | `8080` | HTTP-poort voor handmatige resync (`/resync`). Leeg = uitschakelen |
|
||||
| `RESYNC_BIND` | `0.0.0.0` | Bind-adres van de resync-HTTP-server |
|
||||
|
||||
## Handmatige resync
|
||||
|
||||
Start de container en roep de endpoint aan om on demand een force-rotatie te triggeren (dezelfde actie als een `unhealthy`-recovery):
|
||||
|
||||
```bash
|
||||
# vanuit een andere container in hetzelfde Docker-netwerk (bijv. de Gluetun-container)
|
||||
curl -X POST http://gluetun-pia-wireguard-rotator:8080/resync
|
||||
|
||||
# of vanaf de Docker-host als je de poort mapped
|
||||
curl -X POST http://localhost:8080/resync
|
||||
```
|
||||
|
||||
De endpoint geeft `202 Accepted` terug; de daadwerkelijke rotatie gebeurt in de achtergrond. `GET /` toont de beschikbare endpoints.
|
||||
|
||||
## Compose
|
||||
|
||||
@@ -86,6 +102,7 @@ docker run --rm --entrypoint /opt/venv/bin/python \
|
||||
- Wacht tot `UNHEALTHY_ROTATE_COOLDOWN` of tot healthy
|
||||
- Nog unhealthy → stap 2: exclude die IP, force runner-up (#2 latency)
|
||||
4. **Cron due:** latency opnieuw meten; **zelfde beste server** → geen token/addKey/restarts
|
||||
5. Rate-limit: persistente cooldown, daarna retry
|
||||
5. **HTTP-resync:** `POST /resync` triggert een force-rotatie op de achtergrond
|
||||
6. Rate-limit: persistente cooldown, daarna retry
|
||||
|
||||
**Let op:** zet gluetun niet in `RESTART_CONTAINERS`. Elke echte rotatie geeft korte downtime.
|
||||
Reference in new issue
Block a user