fix: bound memory and sockets in the manager to prevent host-wide OOM

- proxy: inactivity timeouts and a cap on concurrent requests (503 beyond it)
- docker: cache/coalesce container IP lookups and time out inspect calls
- sessions: SQLite-backed store instead of the leaking MemoryStore
- memory guard: exit when heap+external passes MANAGER_MEMORY_LIMIT_MB so the
  restart policy replaces the process before the host swaps
- builds: serialize them and time out hung git/nixpacks processes
- redeploy with rebuild no longer deploys the old image after a failed build
- /health reports memory and in-flight proxy requests; handle SIGTERM

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Sonnet 5.5 committed 2026-10-19 05:23:18 +02:00
1 parent 05ad174f90
commit eb24e21df7
14 files changed
+371 -12

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
/** Rejects if `promise` hasn't settled within `ms` — for calls that can hang forever (e.g. a wedged Docker daemon). */
export function withTimeout<T>(promise: Promise<T>, ms: number, what: string): Promise<T> {
return new Promise<T>((resolve, reject) => {
const timer = setTimeout(() => reject(new Error(`${what} timed out after ${ms}ms`)), ms);
promise.then(
(value) => {
clearTimeout(timer);
resolve(value);
},
(err) => {
clearTimeout(timer);
reject(err);
},
);
});
}