docs: update Redis auth, PM2 config, and eviction policy documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Porwoll 2026-02-14 17:56:16 +00:00
parent d50d3cd208
commit 7446318bf3
5 changed files with 13 additions and 7 deletions

View file

@ -167,7 +167,7 @@ Beispiel: `src/migrations/20260109_020000_add_blogwoman_collections.ts`
- **Plugin ImportMap:** Nach Plugin-Änderungen `pnpm payload generate:importmap` - **Plugin ImportMap:** Nach Plugin-Änderungen `pnpm payload generate:importmap`
- **User-Tenant-Zuweisung:** Neue User müssen manuell Tenants zugewiesen bekommen - **User-Tenant-Zuweisung:** Neue User müssen manuell Tenants zugewiesen bekommen
- **Admin Login:** Custom Route mit Audit-Logging (`src/app/(payload)/api/users/login/route.ts`) - **Admin Login:** Custom Route mit Audit-Logging (`src/app/(payload)/api/users/login/route.ts`)
- **Queue Worker:** Benötigt `tsx` als devDependency (TypeScript via PM2) - **Queue Worker:** PM2 nutzt `node_modules/tsx/dist/cli.mjs` direkt (nicht `npx`), `exec_mode: 'fork'`
- **PgBouncer:** Transaction-Mode kann Migrationen stören → `./scripts/db-direct.sh` - **PgBouncer:** Transaction-Mode kann Migrationen stören → `./scripts/db-direct.sh`
- **TRUST_PROXY=true:** PFLICHT hinter Reverse-Proxy, sonst funktionieren Rate-Limiting und IP-Allowlists nicht - **TRUST_PROXY=true:** PFLICHT hinter Reverse-Proxy, sonst funktionieren Rate-Limiting und IP-Allowlists nicht
- **CSRF_SECRET:** PFLICHT in Production (oder PAYLOAD_SECRET) - Server startet nicht ohne - **CSRF_SECRET:** PFLICHT in Production (oder PAYLOAD_SECRET) - Server startet nicht ohne
@ -374,6 +374,7 @@ Wichtigste Variablen (vollständige Liste in `.env`):
| `TRUST_PROXY` | `true` hinter Reverse-Proxy | Ja | | `TRUST_PROXY` | `true` hinter Reverse-Proxy | Ja |
| `CSRF_SECRET` | CSRF-Token Secret (oder PAYLOAD_SECRET) | Prod | | `CSRF_SECRET` | CSRF-Token Secret (oder PAYLOAD_SECRET) | Prod |
| `CRON_SECRET` | Auth für Cron-Endpoints | Ja | | `CRON_SECRET` | Auth für Cron-Endpoints | Ja |
| `REDIS_PASSWORD` | Redis Authentifizierung | Ja |
| `REDIS_URL` | Redis Cache (localhost:6379) | Optional | | `REDIS_URL` | Redis Cache (localhost:6379) | Optional |
| `META_APP_ID/SECRET` | Facebook/Instagram OAuth | Für Community | | `META_APP_ID/SECRET` | Facebook/Instagram OAuth | Für Community |
| `GOOGLE_CLIENT_ID/SECRET` | YouTube OAuth | Für YouTube | | `GOOGLE_CLIENT_ID/SECRET` | YouTube OAuth | Für YouTube |

View file

@ -125,6 +125,7 @@ const status = await getPdfJobStatus(job.id)
- `QUEUE_RETENTION_CONCURRENCY`: Parallele Retention-Jobs (default: 1) - `QUEUE_RETENTION_CONCURRENCY`: Parallele Retention-Jobs (default: 1)
- `QUEUE_DEFAULT_RETRY`: Retry-Versuche (default: 3) - `QUEUE_DEFAULT_RETRY`: Retry-Versuche (default: 3)
- `QUEUE_REDIS_DB`: Redis-Datenbank für Queue (default: 1) - `QUEUE_REDIS_DB`: Redis-Datenbank für Queue (default: 1)
- `REDIS_PASSWORD`: Redis-Authentifizierung (Pflicht)
**Dateien:** **Dateien:**
- `src/lib/queue/queue-service.ts` - Zentrale Queue-Verwaltung - `src/lib/queue/queue-service.ts` - Zentrale Queue-Verwaltung
@ -181,6 +182,8 @@ Scheduler (Cron) → Retention Queue (BullMQ) → Retention Worker
## Redis Caching ## Redis Caching
Redis erfordert Authentifizierung (`REDIS_PASSWORD`). Eviction-Policy: `noeviction` (BullMQ-Anforderung — verhindert Datenverlust bei Queue-Jobs).
```typescript ```typescript
import { redis } from '@/lib/redis' import { redis } from '@/lib/redis'

View file

@ -304,12 +304,12 @@ module.exports = {
}, },
{ {
name: 'queue-worker', name: 'queue-worker',
script: './scripts/run-queue-worker.ts', script: 'node_modules/tsx/dist/cli.mjs',
interpreter: 'node', args: 'scripts/run-queue-worker.ts',
interpreter_args: '--import tsx', exec_mode: 'fork',
cwd: '/home/payload/payload-cms', cwd: '/home/payload/payload-cms',
instances: 1, instances: 1,
max_memory_restart: '500M' max_memory_restart: '768M'
} }
] ]
} }
@ -399,6 +399,7 @@ PORT=3001
# Redis # Redis
REDIS_URL=redis://localhost:6379 REDIS_URL=redis://localhost:6379
REDIS_PASSWORD=***
# Security # Security
CSRF_SECRET=*** CSRF_SECRET=***
@ -422,6 +423,7 @@ PORT=3000
# Redis # Redis
REDIS_URL=redis://localhost:6379 REDIS_URL=redis://localhost:6379
REDIS_PASSWORD=***
# Security # Security
CSRF_SECRET=*** CSRF_SECRET=***

View file

@ -304,7 +304,7 @@ curl -I https://cms.c2sgmbh.de/admin
curl -I https://cms.c2sgmbh.de/api curl -I https://cms.c2sgmbh.de/api
# Redis verbunden? # Redis verbunden?
redis-cli ping redis-cli -a $REDIS_PASSWORD ping
``` ```
--- ---

View file

@ -175,7 +175,7 @@ systemctl status frontend-*
| PostgreSQL 17 | postgres | 5432 | localhost | ✅ Läuft | | PostgreSQL 17 | postgres | 5432 | localhost | ✅ Läuft |
| Payload CMS | payload | 3001 | https://cms.c2sgmbh.de | ✅ Läuft | | Payload CMS | payload | 3001 | https://cms.c2sgmbh.de | ✅ Läuft |
| Umami Analytics | umami | 3000 | https://analytics.c2sgmbh.de | ✅ Läuft | | Umami Analytics | umami | 3000 | https://analytics.c2sgmbh.de | ✅ Läuft |
| Redis Cache | redis | 6379 | localhost | ✅ Läuft | | Redis Cache | redis | 6379 | localhost (auth: REDIS_PASSWORD, policy: noeviction) | ✅ Läuft |
| Nginx | root | 80/443 | Reverse Proxy | ✅ Läuft | | Nginx | root | 80/443 | Reverse Proxy | ✅ Läuft |
### Deploy ### Deploy