fix(librechat): mongo via digest-pinned podman quadlet (kills the source-build freeze) #6

Merged
Faris merged 2 commits from fix/librechat-podman-mongo into main 2026-10-02 19:35:20 +01:00
Owner

What

nixpkgs mongodb is SSPL — no binary cache, so services.librechat.enableLocalDB pulled a multi-hour C++ source build (~7G peak RAM + 3G swap in one service) into every deploy; auto-deploy restarted it on every boot and froze the box twice today (14:30, 17:37).

Fix

  • Mongo leaves the nixpkgs eval entirely: the rootless fleet gets librechat-mongo (digest-pinned mongo:8), declared inside hosts/server/containers/librechat.nix via home-manager.users.admin.services.podman.containers — one file holds the nspawn, firewall, secrets bootstrap and its DB. Loopback 27017 only; the nspawn reaches it directly (host netns).
  • --wiredTigerCacheSizeG=0.5 + MemoryMax=2G: mongod sizes its WT cache from visible RAM (host 30G) — without the cap it would target ~14G.
  • allowUnfree dropped from the inner eval (mongodb was the only unfree; meilisearch is MIT).
  • db-dump.sh gains a librechat-mongo mongodump archive; AGENTS.md carries the SSPL-no-binary-cache gotcha.

Bootstrap (done on the server)

  • /pool/services/librechat/secrets/mongo.env (0600: MONGO_INITDB_ROOT_USERNAME=librechat, MONGO_INITDB_ROOT_PASSWORD, MONGO_INITDB_DATABASE)
  • /pool/services/librechat/secrets/mongo-uri (0600, newline-free URI, authSource=admin)
  • /pool/services/podman/librechat-mongo/ data dir

Verified: nix build .#nixosConfigurations.nixos-server.config.system.build.toplevel — no mongodb anywhere in the build set.

After merge

sudo systemctl start auto-deploy.timer (it was stopped to break the freeze loop; its first re-run records a baseline, second run deploys).

## What nixpkgs `mongodb` is SSPL — no binary cache, so `services.librechat.enableLocalDB` pulled a multi-hour C++ source build (~7G peak RAM + 3G swap in one service) into every deploy; auto-deploy restarted it on every boot and froze the box twice today (14:30, 17:37). ## Fix - Mongo leaves the nixpkgs eval entirely: the rootless fleet gets `librechat-mongo` (digest-pinned `mongo:8`), declared **inside `hosts/server/containers/librechat.nix`** via `home-manager.users.admin.services.podman.containers` — one file holds the nspawn, firewall, secrets bootstrap and its DB. Loopback 27017 only; the nspawn reaches it directly (host netns). - `--wiredTigerCacheSizeG=0.5` + `MemoryMax=2G`: mongod sizes its WT cache from visible RAM (host 30G) — without the cap it would target ~14G. - `allowUnfree` dropped from the inner eval (mongodb was the only unfree; meilisearch is MIT). - `db-dump.sh` gains a `librechat-mongo` mongodump archive; AGENTS.md carries the SSPL-no-binary-cache gotcha. ## Bootstrap (done on the server) - `/pool/services/librechat/secrets/mongo.env` (0600: MONGO_INITDB_ROOT_USERNAME=librechat, MONGO_INITDB_ROOT_PASSWORD, MONGO_INITDB_DATABASE) - `/pool/services/librechat/secrets/mongo-uri` (0600, newline-free URI, authSource=admin) - `/pool/services/podman/librechat-mongo/` data dir Verified: `nix build .#nixosConfigurations.nixos-server.config.system.build.toplevel` — no mongodb anywhere in the build set. ## After merge `sudo systemctl start auto-deploy.timer` (it was stopped to break the freeze loop; its first re-run records a baseline, second run deploys).
fix(librechat): mongo via rootless podman quadlet — drop the source-only nixpkgs mongodb
All checks were successful
eval / eval (pull_request) Successful in 23s
b050295228
nixpkgs mongodb is SSPL: no binary cache, multi-hour source build at ~7G
peak RAM + swap — auto-deploy rebuilt it on every boot and froze the box
twice on 2026-10-02. librechat now points MONGO_URI (credentials file) at
the digest-pinned mongo:8 quadlet librechat-mongo, on host loopback 27017
(nspawn shares the host netns); WT cache capped and MemoryMax set because
mongod sizes its cache from host RAM. allowUnfree dropped from the inner
eval (nothing unfree left). db-dump gains a mongodump archive; AGENTS
carries the SSPL-no-binary-cache gotcha.
refactor(librechat): declare the mongo quadlet inside librechat.nix
All checks were successful
eval / eval (pull_request) Successful in 22s
49d7ab97f7
One file tells the whole librechat story: nspawn, firewall, secrets
bootstrap and its rootless mongo (home-manager.users.admin injection;
home/podman/ai.nix is back to origin/main).
Faris merged commit 31f8d26271 into main 2026-10-02 19:35:20 +01:00
Faris deleted branch fix/librechat-podman-mongo 2026-10-02 19:35:20 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Faris/nixos!6
No description provided.