Implement global rate limiter and refactor auth middleware
- Add global rate limiter utility with configurable limits and cleanup - Move rate limiting logic to middleware for consistent application - Update auth routes to use new rate limiter - Add comprehensive tests for rate limiter functionality - Update documentation with backend development guidelines and tasks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,53 +1,3 @@
|
||||
## [CRITICAL] Docker containers lack resource limits
|
||||
|
||||
**Where found**
|
||||
|
||||
- `Docker/docker-compose.yml` — no `deploy.limits` or `deploy.reservations` sections
|
||||
|
||||
**Why this is needed**
|
||||
|
||||
Without resource limits, single container can consume all host CPU, memory, disk. "Noisy neighbor" scenario where backend memory leak → uses 100% RAM → OOM kill → host unresponsive.
|
||||
|
||||
**Goal**
|
||||
|
||||
Set hard and soft resource limits for all containers.
|
||||
|
||||
**What to do**
|
||||
|
||||
1. Add resource limits to `docker-compose.yml`:
|
||||
```yaml
|
||||
backend:
|
||||
deploy:
|
||||
limits:
|
||||
cpus: '2'
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: '1'
|
||||
memory: 256M
|
||||
```
|
||||
|
||||
2. Document these limits in `Docs/Deployment.md`
|
||||
3. For Kubernetes, add equivalent `resources.limits` and `resources.requests`
|
||||
|
||||
**Possible traps and issues**
|
||||
|
||||
- Limits set too low → OOM kill or throttling
|
||||
- Backend may need more memory for large blocklists
|
||||
- Test under expected load before finalizing
|
||||
- Different environments may need different limits
|
||||
|
||||
**Docs changes needed**
|
||||
|
||||
- Update `Docker/docker-compose.yml` with `deploy` sections
|
||||
- Add section in `Docs/Deployment.md` § Resource Allocation
|
||||
|
||||
**Doc references**
|
||||
|
||||
- `Docker/docker-compose.yml`
|
||||
- `Docs/Deployment.md` (resource allocation)
|
||||
|
||||
---
|
||||
|
||||
## [CRITICAL] Global rate limiting missing
|
||||
|
||||
**Where found**
|
||||
|
||||
Reference in New Issue
Block a user