Shared-IP safety: entry autoban and entry notifications default off, and a shared IP is treated as review evidence only. ban_user/ban_cluster refuse reason=entry_ip_collision (also with the legacy flag set to 1), so token status and quota are never touched; explicit admin moderation still works. Reproducible startup: new bot/runtime_config.py and scripts/run.py load the repository .env (or --env-file) without shell interpolation, normalize config/DB/upstream aliases, and make the bot, Mini App, gateway, econ cap, account admin, mk_daemon, entry admin and key notifications resolve the same paths. "run.py <target> --check" is an offline preflight that starts nothing and reports placeholders, missing upstream DB and invalid data directories. Resource limits: aggregate Office decompression, a 400 read-entry cap and a per-row XLSX cell budget stop early; truncated or corrupt archives are reported instead of raising. Deploy and docs: only source-backed systemd units remain, and deploy/runtime.env.example documents the environment contract including the 0600 session-secret file rules. Removed the destructive "cp bot/iishko_bot.py bot/grok_bot.py" instruction, the unused generated site/ snapshot and the unsupported iishko-ts staging unit; corrected .env.example, README, ARCHITECTURE, SECURITY, docs/native-gateway.md and iishko-ts/README.md. Tests: entry safety, runtime bootstrap, economy paths, file intake, deploy contract, abilities_guard CLI, and a startup smoke that launches all three components through scripts/run.py with non-loopback network blocked. Every config reader, selfcheck included, accepts a UTF-8 BOM. Verified on this tree: pytest 716 passed + 322 subtests, node --test 73/73, go test and go vet clean, selfcheck --source-only ok, gitleaks worktree and history 0 findings. No production or live-split changes are included.
95 lines
2.3 KiB
Caddyfile
95 lines
2.3 KiB
Caddyfile
{
|
|
acme_ca https://acme-v02.api.letsencrypt.org/directory
|
|
# Bound the buffers: on 2026-09-30 caddy reached 5.9 GB anon-rss and the kernel
|
|
# OOM-killed it three times, which took the whole site and API down with it.
|
|
servers {
|
|
trusted_proxies static 127.0.0.1/32 # TODO: your edge/CDN proxy CIDR
|
|
trusted_proxies_strict
|
|
timeouts {
|
|
read_body 60s
|
|
read_header 30s
|
|
write 1h
|
|
idle 5m
|
|
}
|
|
}
|
|
}
|
|
|
|
(api_common) {
|
|
# There were NO access logs at all, so the 429 storm of 2026-10-03 could not be
|
|
# attributed to a client until the relay log was grepped by hand.
|
|
log {
|
|
output file /var/log/caddy/access.log {
|
|
roll_size 30MiB
|
|
roll_keep 10
|
|
roll_keep_for 720h
|
|
}
|
|
format json
|
|
}
|
|
header {
|
|
Strict-Transport-Security "max-age=15552000; includeSubDomains"
|
|
X-Content-Type-Options "nosniff"
|
|
Referrer-Policy "strict-origin-when-cross-origin"
|
|
-Server
|
|
}
|
|
request_body {
|
|
max_size 40MB
|
|
}
|
|
}
|
|
|
|
api.your-domain.com {
|
|
import api_common
|
|
# Media/TTS (/v1/media/*) is NOT routed here: this repo ships no media adapter.
|
|
# The gateway skin proxies every /v1/* path to the upstream. If you run an
|
|
# operator-run adapter on loopback,
|
|
# add your own route above the catch-all:
|
|
#
|
|
# handle /v1/media/* {
|
|
# reverse_proxy 127.0.0.1:<your-adapter-port> {
|
|
# flush_interval -1
|
|
# transport http {
|
|
# read_timeout 300s
|
|
# dial_timeout 10s
|
|
# }
|
|
# }
|
|
# }
|
|
# [WEBAPP-WIRE 19.10] Mini App: /webapp -> 127.0.0.1:8850
|
|
handle /webapp {
|
|
redir /webapp/ 301
|
|
}
|
|
handle_path /webapp/* {
|
|
reverse_proxy 127.0.0.1:8850 {
|
|
header_up X-Real-IP {client_ip}
|
|
flush_interval -1
|
|
transport http {
|
|
read_timeout 60s
|
|
dial_timeout 5s
|
|
}
|
|
}
|
|
}
|
|
handle {
|
|
reverse_proxy 127.0.0.1:48001 {
|
|
header_up X-Forwarded-For {client_ip}
|
|
# generations and SSE streams outlive the defaults; "context canceled" /
|
|
# "http2: stream closed" in the error log were proxies giving up early
|
|
flush_interval -1
|
|
transport http {
|
|
read_timeout 900s
|
|
dial_timeout 10s
|
|
keepalive 30s
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
your-domain.com {
|
|
import api_common
|
|
reverse_proxy 127.0.0.1:48001 {
|
|
header_up X-Forwarded-For {client_ip}
|
|
flush_interval -1
|
|
transport http {
|
|
read_timeout 900s
|
|
dial_timeout 10s
|
|
}
|
|
}
|
|
}
|