Backend Phase C: Sync-Kern + Caddy behind-proxy
Sync-Kern:
- internal/sync/hlc.go: Hybrid Logical Clock (wall_ms<<16|counter)
Tick/Now/After, global mutex, strikt monoton + kausal korrekt
- internal/sync/hlc_test.go: Unit-Tests (monoton, kausal, keine Duplikate)
Store-Schicht:
- internal/store/opstore.go: AppendOps idempotent via UNIQUE(client_id,
client_seq) ON CONFLICT DO NOTHING; LWW-Projektion (list_create/
rename/delete, item_add/update/remove) in derselben Transaktion;
PullOps mit Cursor (seq > since, 500er Pages)
- internal/store/liststore.go: CreateList / GetLists / GetList
- internal/store/itemstore.go: GetItems (nicht-gelöschte Items)
- internal/store/suggeststore.go: Search (pg_trgm + LIKE-fallback, 10)
HTTP-Handler:
- internal/httpapi/lists.go: GET/POST /api/lists, GET /api/lists/{id}
- internal/httpapi/ops.go: POST /api/lists/{id}/ops (Push),
GET /api/lists/{id}/ops (Pull ?since=)
- internal/httpapi/suggest.go: GET /api/suggestions?q=
- internal/httpapi/api.go: alle Routen verdrahtet (RequireAuth)
Deployment:
- deploy/Caddyfile.behind-proxy: auto_https off, trusted_proxies
- deploy/Caddyfile: X-Forwarded-Proto hinzugefügt, Kommentar aktualisiert
- deploy/docker-compose.yml: CADDY_HTTP_PORT + CADDY_HTTPS_PORT
- deploy/.env.example: Caddy-Port-Variablen dokumentiert
go build ./... && go vet ./... && go test ./... ✅
HLC-Tests: monoton, kausal, keine Duplikate ✅
AGENTS.md: Phase C vollständig ✅
This commit is contained in:
parent
a5ef8cf3ba
commit
895725b5e5
15 changed files with 1257 additions and 51 deletions
|
|
@ -1,25 +1,27 @@
|
|||
# Caddyfile for mitbringsl.
|
||||
# Caddyfile for mitbringsl – standalone mode (default).
|
||||
# Caddy automatically obtains and renews a Let's Encrypt certificate when the
|
||||
# site address is a real domain. For local development it falls back to an
|
||||
# internal CA / self-signed cert automatically.
|
||||
#
|
||||
# To run behind your own reverse proxy instead, mount Caddyfile.behind-proxy.
|
||||
{
|
||||
# email you@example.com # optional, for ACME account
|
||||
# email you@example.com # optional, for ACME account registration
|
||||
}
|
||||
|
||||
{$SITE_ADDRESS:localhost} {
|
||||
reverse_proxy backend:8080 {
|
||||
header_up X-Real-IP {remote_host}
|
||||
header_up X-Forwarded-For {remote_host}
|
||||
header_up X-Real-IP {remote_host}
|
||||
header_up X-Forwarded-For {remote_host}
|
||||
header_up X-Forwarded-Proto {scheme}
|
||||
}
|
||||
|
||||
# Useful default headers
|
||||
# Useful default security headers
|
||||
header {
|
||||
Strict-Transport-Security "max-age=31536000"
|
||||
X-Content-Type-Options "nosniff"
|
||||
Referrer-Policy "no-referrer"
|
||||
}
|
||||
|
||||
# Health endpoint passthrough already handled by backend; keep it simple.
|
||||
request_body {
|
||||
max_size 2MB
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue