Deployment-Härtung + Podman-Container
- http.Server mit Timeouts (Slowloris) und Graceful Shutdown (SIGTERM) - Adresse und DB-Pfad per Env (KVER_ADDR, KVER_DB) - Security-Header global: nosniff, X-Frame-Options, Referrer-Policy, CSP - Upload-Requests hart auf 17 MB gedeckelt (MaxBytesReader statt nur Multipart-Speichergrenze) - Indizes für Feed-, Thread- und Vote-Queries - middleware.RealIP für Logging/Rate-Limit hinter dem Reverse-Proxy - Containerfile (Multi-Stage, Alpine, non-root) + Deploy-Doku in notes/ Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,16 @@ CREATE TABLE IF NOT EXISTS vote (
|
||||
mode TEXT,
|
||||
UNIQUE(uid, pid)
|
||||
);
|
||||
|
||||
-- Indizes für die häufigen Zugriffspfade; ohne sie werden Feed (ORDER BY
|
||||
-- last_activity), Thread (WHERE reply_to) und Vote-Zähler (WHERE pid) mit
|
||||
-- wachsender Tabelle zu Full-Table-Scans. username/session.value/vote(uid,pid)
|
||||
-- sind über UNIQUE bereits indiziert.
|
||||
CREATE INDEX IF NOT EXISTS idx_entry_last_activity ON entry(last_activity);
|
||||
CREATE INDEX IF NOT EXISTS idx_entry_reply_to ON entry(reply_to);
|
||||
CREATE INDEX IF NOT EXISTS idx_entry_uid ON entry(uid);
|
||||
CREATE INDEX IF NOT EXISTS idx_vote_pid ON vote(pid);
|
||||
CREATE INDEX IF NOT EXISTS idx_session_uid ON session(uid);
|
||||
`
|
||||
|
||||
func initDB(dsn string) error {
|
||||
|
||||
Reference in New Issue
Block a user